diff options
author | Armin Le Grand <alg@apache.org> | 2014-06-19 16:49:26 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2014-06-19 16:49:26 +0000 |
commit | 61b32a70c92ee1b1148bcd9788561b79dc1910c8 (patch) | |
tree | 4e1c64a4032ddb4bbf1fc2bffea0a1a47b2473ca /sw | |
parent | c20e4c606988de65d45ce3ce9608cb75deb5234a (diff) |
i125111 limit mem footprint for GraphicObjects in 32Bit environments
Notes
Notes:
merged as: 0ca0202a0994c0b7c99c366fd5cafd8a655df203
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 36 |
2 files changed, 32 insertions, 7 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 95eb23c471c2..d96023a94bb8 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1019,6 +1019,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons aContent, aTargetRange, aTargetRange); + + // need to reset the timer manually (was in original paints at GraphicManager) + rGrfObj.restartSwapOutTimer(); } } else diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index bf789f1b5b43..2ba45183563e 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -58,14 +58,36 @@ #include <retrieveinputstreamconsumer.hxx> #include <drawinglayer/processor2d/objectinfoextractor2d.hxx> #include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx> +#include <unotools/cacheoptions.hxx> using namespace com::sun::star; +#define SWAPGRAPHIC_TIMEOUT 5000 -// As Writer graphics are no longer painted via the graphic manager - see <SwNoTxtFrm::PaintPicture(..)> - -// it is needed to swap out the Writer graphics automatically after a certain amount of time. -// --> 5000ms -#define TIMETOSWAPOUTGRAPHICAUTOMATICALLY 5000 +// For comments see same method used in svx +sal_uInt32 getCacheTimeInMs() +{ + static bool bSetAtAll(true); + + if(bSetAtAll) + { + static bool bSetToPreferenceTime(true); + + if(bSetToPreferenceTime) + { + const SvtCacheOptions aCacheOptions; + const sal_Int32 nSeconds(aCacheOptions.GetGraphicManagerObjectReleaseTime()); + + return nSeconds * 1000 / 12; + } + else + { + return SWAPGRAPHIC_TIMEOUT; + } + } + + return 0; +} // -------------------- // SwGrfNode @@ -83,7 +105,7 @@ SwGrfNode::SwGrfNode( mbLinkedInputStreamReady( false ), mbIsStreamReadOnly( sal_False ) { - maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ), TIMETOSWAPOUTGRAPHICAUTOMATICALLY ); + maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ), getCacheTimeInMs() ); bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf = bFrameInPaint = bScaleImageMap = sal_False; bGrafikArrived = sal_True; @@ -102,7 +124,7 @@ SwGrfNode::SwGrfNode( mbIsStreamReadOnly( sal_False ) { maGrfObj = rGrfObj; - maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ), TIMETOSWAPOUTGRAPHICAUTOMATICALLY ); + maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ), getCacheTimeInMs() ); if ( rGrfObj.HasUserData() && rGrfObj.IsSwappedOut() ) maGrfObj.SetSwapState(); bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf = bFrameInPaint = bScaleImageMap = sal_False; @@ -125,7 +147,7 @@ SwGrfNode::SwGrfNode( mbLinkedInputStreamReady( false ), mbIsStreamReadOnly( sal_False ) { - maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ), TIMETOSWAPOUTGRAPHICAUTOMATICALLY ); + maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ), getCacheTimeInMs() ); Graphic aGrf; aGrf.SetDefaultType(); |