Blame SOURCES/0001-Related-fdo-50697-reset-the-cache-timeout-on-GetGrap.patch

f085be
From 62b0eaf37c08dd27244e77b8bc90c691b000ebd6 Mon Sep 17 00:00:00 2001
f085be
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f085be
Date: Tue, 29 Apr 2014 14:17:11 +0100
f085be
Subject: [PATCH] Related: fdo#50697 reset the cache timeout on GetGraphic
f085be
f085be
so the graphic gets swapped out Xms after the last use and not Xms after
f085be
initial creation regardless of if it got used a moment earlier.
f085be
f085be
Change-Id: I1458f307d090ecd8d8d031b545f23e78bf1bcb67
f085be
---
f085be
 include/svtools/grfmgr.hxx        |  2 ++
f085be
 svtools/source/graphic/grfmgr.cxx | 20 ++++++++++++++++++--
f085be
 2 files changed, 20 insertions(+), 2 deletions(-)
f085be
f085be
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
f085be
index 3e1423a..251ee6d 100644
f085be
--- a/include/svtools/grfmgr.hxx
f085be
+++ b/include/svtools/grfmgr.hxx
f085be
@@ -299,6 +299,8 @@ private:
f085be
 
f085be
                             DECL_LINK( ImplAutoSwapOutHdl, void* );
f085be
 
f085be
+    void SVT_DLLPRIVATE     ResetCacheTimeOut();
f085be
+
f085be
 protected:
f085be
 
f085be
     virtual void            GraphicManagerDestroyed();
f085be
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
f085be
index 087d27b..a405ea7 100644
f085be
--- a/svtools/source/graphic/grfmgr.cxx
f085be
+++ b/svtools/source/graphic/grfmgr.cxx
f085be
@@ -744,10 +744,26 @@ void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData )
f085be
         mpSimpleCache->maGraphic.StopAnimation( pOut, nExtraData );
f085be
 }
f085be
 
f085be
+void GraphicObject::ResetCacheTimeOut()
f085be
+{
f085be
+    if (mpSwapOutTimer)
f085be
+    {
f085be
+        mpSwapOutTimer->Stop();
f085be
+        mpSwapOutTimer->Start();
f085be
+    }
f085be
+}
f085be
+
f085be
 const Graphic& GraphicObject::GetGraphic() const
f085be
 {
f085be
-    if( mbAutoSwapped )
f085be
-        ( (GraphicObject*) this )->ImplAutoSwapIn();
f085be
+    GraphicObject *pThis = const_cast<GraphicObject*>(this);
f085be
+
f085be
+    if (mbAutoSwapped)
f085be
+        pThis->ImplAutoSwapIn();
f085be
+
f085be
+    //fdo#50697 If we've been asked to provide the graphic, then reset
f085be
+    //the cache timeout to start from now and not remain at the
f085be
+    //time of creation
f085be
+    pThis->ResetCacheTimeOut();
f085be
 
f085be
     return maGraphic;
f085be
 }
f085be
-- 
f085be
1.9.0
f085be