diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-31 17:27:01 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-04-10 08:33:55 +0200 |
commit | ea3d755ac949c1b6dada5c341e018f8c23f5d395 (patch) | |
tree | 086b3573d3e2f64fd918df4996d1f00ad9aa863b /include | |
parent | 94185507ed11bf6e2e2e9fa47c247680ae1edb36 (diff) |
vcl: detach usage and remove GraphicManager and GraphicCache
Also remove some GraphicObjectTest because they call into
GraphicManager which now doesn't exist anymore.
Change-Id: Ia434736d8611df629af3e897c878a7fb8bbe4706
Reviewed-on: https://gerrit.libreoffice.org/52243
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/GraphicObject.hxx | 143 | ||||
-rw-r--r-- | include/vcl/graph.hxx | 2 |
2 files changed, 2 insertions, 143 deletions
diff --git a/include/vcl/GraphicObject.hxx b/include/vcl/GraphicObject.hxx index fbd063687e34..64f912e4876d 100644 --- a/include/vcl/GraphicObject.hxx +++ b/include/vcl/GraphicObject.hxx @@ -169,13 +169,9 @@ public: class VCL_DLLPUBLIC GraphicObject { - friend class GraphicManager; friend class SdrGrafObj; private: - - static GraphicManager* mpGlobalMgr; - Graphic maGraphic; GraphicAttr maAttr; Size maPrefSize; @@ -304,10 +300,6 @@ private: ) const; DECL_LINK( ImplAutoSwapOutHdl, Timer*, void ); - - // Handle evtl. needed AfterDataChanges, needs to be called when new - // graphic data is swapped in/added to the GraphicManager - void VCL_DLLPRIVATE ImplAfterDataChange(); protected: SvStream* GetSwapStream() const; @@ -329,20 +321,6 @@ public: void FireSwapInRequest(); void FireSwapOutRequest(); - GraphicManager& GetGraphicManager() const - { - (void)this; // avoid loplugin:staticmethods because first GraphicManager ctor creates - // mpGlobalMgr and the last GraphicManager dtor destroys it - return *mpGlobalMgr; - } - - bool IsCached( - OutputDevice const * pOut, - const Size& rSz, - const GraphicAttr* pAttr, - GraphicManagerDrawFlags nFlags = GraphicManagerDrawFlags::STANDARD - ) const; - const Graphic& GetGraphic() const; void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = nullptr); void SetGraphic( const Graphic& rGraphic, const OUString& rLink ); @@ -477,127 +455,6 @@ public: double fTopCrop, double fRightCrop, double fBottomCrop) const; - - // read access - sal_uLong GetDataChangeTimeStamp() const { return mnDataChangeTimeStamp; } -}; - -class VCL_DLLPUBLIC GraphicManager -{ - friend class GraphicObject; - friend class GraphicDisplayCacheEntry; - -private: - - std::unordered_set< GraphicObject* > maObjList; - sal_uLong mnUsedSize; // currently used memory footprint of all swapped in graphics - std::unique_ptr<GraphicCache> mpCache; - - GraphicManager( const GraphicManager& ) = delete; - GraphicManager& operator=( const GraphicManager& ) = delete; - - bool VCL_DLLPRIVATE ImplDraw( - OutputDevice* pOut, - const Point& rPt, - const Size& rSz, - GraphicObject const & rObj, - const GraphicAttr& rAttr, - bool& rCached - ); - - static bool VCL_DLLPRIVATE ImplCreateOutput( - OutputDevice* pOut, - const Point& rPt, - const Size& rSz, - const BitmapEx& rBmpEx, - const GraphicAttr& rAttr, - BitmapEx* pBmpEx = nullptr - ); - static bool VCL_DLLPRIVATE ImplCreateOutput( - OutputDevice* pOut, - const Point& rPt, - const Size& rSz, - const GDIMetaFile& rMtf, - const GraphicAttr& rAttr, - GDIMetaFile& rOutMtf, - BitmapEx& rOutBmpEx - ); - - static void VCL_DLLPRIVATE ImplAdjust( - BitmapEx& rBmpEx, - const GraphicAttr& rAttr, - GraphicAdjustmentFlags nAdjustmentFlags - ); - static void VCL_DLLPRIVATE ImplAdjust( - GDIMetaFile& rMtf, - const GraphicAttr& rAttr, - GraphicAdjustmentFlags nAdjustmentFlags - ); - static void VCL_DLLPRIVATE ImplAdjust( - Animation& rAnimation, - const GraphicAttr& rAttr, - GraphicAdjustmentFlags nAdjustmentFlags - ); - - static void VCL_DLLPRIVATE ImplDraw( - OutputDevice* pOut, - const Point& rPt, - const Size& rSz, - const GDIMetaFile& rMtf, - const GraphicAttr& rAttr - ); - - // Only used by GraphicObject's Ctor's and Dtor's - void VCL_DLLPRIVATE ImplRegisterObj( - const GraphicObject& rObj, - Graphic& rSubstitute, - const OString* pID, - const GraphicObject* pCopyObj - ); - void VCL_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); - bool VCL_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); } - - // Only used in swap case by GraphicObject - void VCL_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ); - void VCL_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ); - - OString VCL_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; - - // This method allows to check memory footprint for all currently swapped in GraphicObjects on this GraphicManager - // which are based on Bitmaps. This is needed on 32Bit systems and only does something on those systems. The problem - // to solve is that normally the SwapOut is timer-driven, but even with short timer settings there are situations - // where this does not trigger - or in other words: A maximum limitation for GraphicManagers was not in place before. - // For 32Bit systems this leads to situations where graphics will be missing. This method will actively swap out - // the longest swapped in graphics until a maximum memory boundary (derived from user settings in tools/options/memory) - // is no longer exceeded - void VCL_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore); -public: - - GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize ); - ~GraphicManager(); - - void SetMaxCacheSize( sal_uLong nNewCacheSize ); - sal_uLong GetMaxCacheSize() const; - - void SetCacheTimeout( sal_uLong nTimeoutSeconds ); - - bool IsInCache( - OutputDevice const * pOut, - const Point& rPt, - const Size& rSz, - const GraphicObject& rObj, - const GraphicAttr& rAttr - ) const; - - bool DrawObj( - OutputDevice* pOut, - const Point& rPt, - const Size& rSz, - GraphicObject const & rObj, - const GraphicAttr& rAttr, - const GraphicManagerDrawFlags nFlags, - bool& rCached - ); }; namespace vcl diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 4915fa0e347a..9be22958b446 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -201,6 +201,8 @@ public: OUString getOriginURL() const; void setOriginURL(OUString const & rOriginURL); + OString getUniqueID() const; + public: std::shared_ptr<GraphicReader>& GetContext(); |