basegfx/source/polygon/b2dpolygon.cxx                     |    8 +--
 basegfx/source/polygon/b2dpolypolygon.cxx                 |    8 +--
 basegfx/source/tools/systemdependentdata.cxx              |   17 +++----
 drawinglayer/source/processor2d/cairopixelprocessor2d.cxx |   15 +++---
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx   |   15 +++---
 include/basegfx/polygon/b2dpolygon.hxx                    |   10 +---
 include/basegfx/polygon/b2dpolypolygon.hxx                |    6 +-
 include/basegfx/utils/systemdependentdata.hxx             |   34 ++++++++++----
 vcl/headless/BitmapHelper.cxx                             |   12 +++-
 vcl/headless/CairoCommon.cxx                              |    9 ++-
 vcl/inc/salbmp.hxx                                        |    4 -
 vcl/source/app/svdata.cxx                                 |    2 
 vcl/source/bitmap/BitmapEx.cxx                            |    7 +-
 vcl/win/gdi/gdiimpl.cxx                                   |    8 ++-
 vcl/win/gdi/salbmp.cxx                                    |    6 +-
 15 files changed, 97 insertions(+), 64 deletions(-)

New commits:
commit f74bb604ff043caa552d809bd8e9157ac7854f96
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Thu Jul 11 17:54:18 2024 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Fri Jul 12 17:59:50 2024 +0200

    Make SystemDependentData mechanism type-based
    
    Up to now that genereal buffering mechanism used
    typeid.*hash_code to identify the class. As we
    have learned this is not safe. Thus I changed it
    to use enum'ed SystemDependentDataType definitions
    
    Change-Id: I803912ec419290db1d40bae0bc41364fad64cbfd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170385
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/basegfx/source/polygon/b2dpolygon.cxx 
b/basegfx/source/polygon/b2dpolygon.cxx
index cf7309d20dd3..90634a377a72 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -1062,11 +1062,11 @@ public:
         mpBufferedData->addOrReplaceSystemDependentData(rData);
     }
 
-    basegfx::SystemDependentData_SharedPtr getSystemDependentData(size_t 
hash_code) const
+    basegfx::SystemDependentData_SharedPtr 
getSystemDependentData(basegfx::SDD_Type aType) const
     {
         if(mpBufferedData)
         {
-            return mpBufferedData->getSystemDependentData(hash_code);
+            return mpBufferedData->getSystemDependentData(aType);
         }
 
         return basegfx::SystemDependentData_SharedPtr();
@@ -1445,9 +1445,9 @@ namespace basegfx
         mpPolygon->addOrReplaceSystemDependentData(rData);
     }
 
-    SystemDependentData_SharedPtr 
B2DPolygon::getSystemDependantDataInternal(size_t hash_code) const
+    SystemDependentData_SharedPtr 
B2DPolygon::getSystemDependantDataInternal(SDD_Type aType) const
     {
-        return mpPolygon->getSystemDependentData(hash_code);
+        return mpPolygon->getSystemDependentData(aType);
     }
 
 } // end of namespace basegfx
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx 
b/basegfx/source/polygon/b2dpolypolygon.cxx
index fe2a7c7f94c8..e830ea728921 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -73,14 +73,14 @@ public:
         mpSystemDependentDataHolder->addOrReplaceSystemDependentData(rData);
     }
 
-    basegfx::SystemDependentData_SharedPtr getSystemDependentData(size_t 
hash_code) const
+    basegfx::SystemDependentData_SharedPtr getSystemDependentData(SDD_Type 
aType) const
     {
         if(!mpSystemDependentDataHolder)
         {
             return basegfx::SystemDependentData_SharedPtr();
         }
 
-        return mpSystemDependentDataHolder->getSystemDependentData(hash_code);
+        return mpSystemDependentDataHolder->getSystemDependentData(aType);
     }
 
     bool operator==(const ImplB2DPolyPolygon& rPolygonList) const
@@ -417,9 +417,9 @@ public:
         mpPolyPolygon->addOrReplaceSystemDependentData(rData);
     }
 
-    SystemDependentData_SharedPtr 
B2DPolyPolygon::getSystemDependantDataInternal(size_t hash_code) const
+    SystemDependentData_SharedPtr 
B2DPolyPolygon::getSystemDependantDataInternal(SDD_Type aType) const
     {
-        return mpPolyPolygon->getSystemDependentData(hash_code);
+        return mpPolyPolygon->getSystemDependentData(aType);
     }
 
 } // end of namespace basegfx
diff --git a/basegfx/source/tools/systemdependentdata.cxx 
b/basegfx/source/tools/systemdependentdata.cxx
index 0d64d9982cef..c32be27ac945 100644
--- a/basegfx/source/tools/systemdependentdata.cxx
+++ b/basegfx/source/tools/systemdependentdata.cxx
@@ -25,9 +25,11 @@ namespace basegfx
 namespace basegfx
 {
     SystemDependentData::SystemDependentData(
-        SystemDependentDataManager& rSystemDependentDataManager)
-    :   mrSystemDependentDataManager(rSystemDependentDataManager),
-        mnCalculatedCycles(0)
+        SystemDependentDataManager& rSystemDependentDataManager,
+        SDD_Type aSystemDependentDataType)
+    :   mrSystemDependentDataManager(rSystemDependentDataManager)
+    , maSystemDependentDataType(aSystemDependentDataType)
+    , mnCalculatedCycles(0)
     {
     }
 
@@ -120,8 +122,7 @@ namespace basegfx
 
     void 
SystemDependentDataHolder::addOrReplaceSystemDependentData(basegfx::SystemDependentData_SharedPtr&
 rData)
     {
-        const size_t hash_code(typeid(*rData).hash_code());
-        auto result(maSystemDependentReferences.find(hash_code));
+        auto 
result(maSystemDependentReferences.find(rData->getSystemDependentDataType()));
 
         if(result != maSystemDependentReferences.end())
         {
@@ -136,14 +137,14 @@ namespace basegfx
             result = maSystemDependentReferences.end();
         }
 
-        maSystemDependentReferences[hash_code] = rData;
+        maSystemDependentReferences[rData->getSystemDependentDataType()] = 
rData;
         rData->getSystemDependentDataManager().startUsage(rData);
     }
 
-    SystemDependentData_SharedPtr 
SystemDependentDataHolder::getSystemDependentData(size_t hash_code) const
+    SystemDependentData_SharedPtr 
SystemDependentDataHolder::getSystemDependentData(SDD_Type aType) const
     {
         basegfx::SystemDependentData_SharedPtr aRetval;
-        auto result(maSystemDependentReferences.find(hash_code));
+        auto result(maSystemDependentReferences.find(aType));
 
         if(result != maSystemDependentReferences.end())
         {
diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index b29ca97eac4b..1de46473d790 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -250,7 +250,8 @@ class SystemDependentData_CairoPathGeometry : public 
basegfx::SystemDependentDat
 
 public:
     SystemDependentData_CairoPathGeometry(const 
std::shared_ptr<CairoPathHelper>& pCairoPathHelper)
-        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                       
basegfx::SDD_Type::SDDType_CairoPathGeometry)
         , mpCairoPathHelper(pCairoPathHelper)
     {
     }
@@ -349,7 +350,8 @@ void getOrCreatePathGeometry(cairo_t* pRT, const 
basegfx::B2DPolygon& rPolygon,
 {
     // try to access buffered data
     std::shared_ptr<SystemDependentData_CairoPathGeometry> 
pSystemDependentData_CairoPathGeometry(
-        
rPolygon.getSystemDependentData<SystemDependentData_CairoPathGeometry>());
+        rPolygon.getSystemDependentData<SystemDependentData_CairoPathGeometry>(
+            basegfx::SDD_Type::SDDType_CairoPathGeometry));
 
     if (pSystemDependentData_CairoPathGeometry)
     {
@@ -375,7 +377,8 @@ void getOrCreateFillGeometry(cairo_t* pRT, const 
basegfx::B2DPolyPolygon& rPolyP
 {
     // try to access buffered data
     std::shared_ptr<SystemDependentData_CairoPathGeometry> 
pSystemDependentData_CairoPathGeometry(
-        
rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPathGeometry>());
+        
rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPathGeometry>(
+            basegfx::SDD_Type::SDDType_CairoPathGeometry));
 
     if (pSystemDependentData_CairoPathGeometry)
     {
@@ -645,7 +648,8 @@ class SystemDependentData_CairoSurface : public 
basegfx::SystemDependentData
 
 public:
     SystemDependentData_CairoSurface(const BitmapEx& rBitmapEx)
-        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                       basegfx::SDD_Type::SDDType_CairoSurface)
         , mpCairoSurfaceHelper(std::make_shared<CairoSurfaceHelper>(rBitmapEx))
         , maAssociatedAlpha()
     {
@@ -698,8 +702,7 @@ std::shared_ptr<CairoSurfaceHelper> 
getOrCreateCairoSurfaceHelper(const BitmapEx
         // try to access SystemDependentDataHolder and buffered data
         pSystemDependentData_CairoSurface
             = std::static_pointer_cast<SystemDependentData_CairoSurface>(
-                pHolder->getSystemDependentData(
-                    typeid(SystemDependentData_CairoSurface).hash_code()));
+                
pHolder->getSystemDependentData(basegfx::SDD_Type::SDDType_CairoSurface));
 
         // check data validity for associated Alpha
         if (pSystemDependentData_CairoSurface && rBitmapEx.IsAlpha()
diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 74a902727387..089106194754 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -128,7 +128,8 @@ private:
 public:
     SystemDependentData_ID2D1PathGeometry(
         sal::systools::COMReference<ID2D1PathGeometry>& rID2D1PathGeometry)
-        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                       
basegfx::SDD_Type::SDDType_ID2D1PathGeometry)
         , mpID2D1PathGeometry(rID2D1PathGeometry)
     {
     }
@@ -239,7 +240,8 @@ getOrCreatePathGeometry(const basegfx::B2DPolygon& rPolygon,
 {
     // try to access buffered data
     std::shared_ptr<SystemDependentData_ID2D1PathGeometry> 
pSystemDependentData_ID2D1PathGeometry(
-        
rPolygon.getSystemDependentData<SystemDependentData_ID2D1PathGeometry>());
+        rPolygon.getSystemDependentData<SystemDependentData_ID2D1PathGeometry>(
+            basegfx::SDD_Type::SDDType_ID2D1PathGeometry));
 
     if (pSystemDependentData_ID2D1PathGeometry)
     {
@@ -302,7 +304,8 @@ getOrCreateFillGeometry(const basegfx::B2DPolyPolygon& 
rPolyPolygon)
 {
     // try to access buffered data
     std::shared_ptr<SystemDependentData_ID2D1PathGeometry> 
pSystemDependentData_ID2D1PathGeometry(
-        
rPolyPolygon.getSystemDependentData<SystemDependentData_ID2D1PathGeometry>());
+        
rPolyPolygon.getSystemDependentData<SystemDependentData_ID2D1PathGeometry>(
+            basegfx::SDD_Type::SDDType_ID2D1PathGeometry));
 
     if (pSystemDependentData_ID2D1PathGeometry)
     {
@@ -361,7 +364,8 @@ private:
 public:
     SystemDependentData_ID2D1Bitmap(sal::systools::COMReference<ID2D1Bitmap>& 
rD2DBitmap,
                                     const std::shared_ptr<SalBitmap>& 
rAssociatedAlpha)
-        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+        : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                       basegfx::SDD_Type::SDDType_ID2D1Bitmap)
         , mpD2DBitmap(rD2DBitmap)
         , maAssociatedAlpha(rAssociatedAlpha)
     {
@@ -473,8 +477,7 @@ 
getOrCreateB2DBitmap(sal::systools::COMReference<ID2D1RenderTarget>& rRT, const
         // try to access SystemDependentDataHolder and buffered data
         pSystemDependentData_ID2D1Bitmap
             = std::static_pointer_cast<SystemDependentData_ID2D1Bitmap>(
-                pHolder->getSystemDependentData(
-                    typeid(SystemDependentData_ID2D1Bitmap).hash_code()));
+                
pHolder->getSystemDependentData(basegfx::SDD_Type::SDDType_ID2D1Bitmap));
 
         // check data validity for associated Alpha
         if (pSystemDependentData_ID2D1Bitmap
diff --git a/include/basegfx/polygon/b2dpolygon.hxx 
b/include/basegfx/polygon/b2dpolygon.hxx
index c63bda845d96..5cbcbd7caea2 100644
--- a/include/basegfx/polygon/b2dpolygon.hxx
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -26,6 +26,7 @@
 #include <sal/types.h>
 #include <o3tl/cow_wrapper.hxx>
 #include <basegfx/vector/b2enums.hxx>
+#include <basegfx/utils/systemdependentdata.hxx>
 #include <basegfx/basegfxdllapi.h>
 
 class ImplB2DPolygon;
@@ -37,9 +38,6 @@ namespace basegfx
     class B2DHomMatrix;
     class B2DCubicBezier;
     class B2DVector;
-    class SystemDependentData;
-    class SystemDependentDataManager;
-    typedef std::shared_ptr<SystemDependentData> SystemDependentData_SharedPtr;
 }
 
 namespace basegfx
@@ -230,9 +228,9 @@ namespace basegfx
 
         // exclusive management op's for SystemDependentData at B2DPolygon
         template<class T>
-        std::shared_ptr<T> getSystemDependentData() const
+        std::shared_ptr<T> getSystemDependentData(basegfx::SDD_Type aType) 
const
         {
-            return 
std::static_pointer_cast<T>(getSystemDependantDataInternal(typeid(T).hash_code()));
+            return 
std::static_pointer_cast<T>(getSystemDependantDataInternal(aType));
         }
 
         template<class T, class... Args>
@@ -252,7 +250,7 @@ namespace basegfx
 
     private:
         void 
addOrReplaceSystemDependentDataInternal(SystemDependentData_SharedPtr& rData) 
const;
-        SystemDependentData_SharedPtr getSystemDependantDataInternal(size_t 
hash_code) const;
+        SystemDependentData_SharedPtr 
getSystemDependantDataInternal(basegfx::SDD_Type aType) const;
         const basegfx::B2DVector& getPrevControlVector(sal_uInt32 nIndex) 
const;
         const basegfx::B2DVector& getNextControlVector(sal_uInt32 nIndex) 
const;
     };
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx 
b/include/basegfx/polygon/b2dpolypolygon.hxx
index e0cb5c0c5efc..ffd69b23ad07 100644
--- a/include/basegfx/polygon/b2dpolypolygon.hxx
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -121,9 +121,9 @@ namespace basegfx
 
         // exclusive management op's for SystemDependentData at B2DPolygon
         template<class T>
-        std::shared_ptr<T> getSystemDependentData() const
+        std::shared_ptr<T> getSystemDependentData(basegfx::SDD_Type aType) 
const
         {
-            return 
std::static_pointer_cast<T>(getSystemDependantDataInternal(typeid(T).hash_code()));
+            return 
std::static_pointer_cast<T>(getSystemDependantDataInternal(aType));
         }
 
         template<class T, class... Args>
@@ -143,7 +143,7 @@ namespace basegfx
 
     private:
         void 
addOrReplaceSystemDependentDataInternal(SystemDependentData_SharedPtr& rData) 
const;
-        SystemDependentData_SharedPtr getSystemDependantDataInternal(size_t 
hash_code) const;
+        SystemDependentData_SharedPtr 
getSystemDependantDataInternal(basegfx::SDD_Type aType) const;
     };
 
     // typedef for a vector of B2DPolyPolygons
diff --git a/include/basegfx/utils/systemdependentdata.hxx 
b/include/basegfx/utils/systemdependentdata.hxx
index 9304153c1327..b07ae267e662 100644
--- a/include/basegfx/utils/systemdependentdata.hxx
+++ b/include/basegfx/utils/systemdependentdata.hxx
@@ -12,7 +12,7 @@
 #include <sal/types.h>
 #include <basegfx/basegfxdllapi.h>
 #include <memory>
-#include <map>
+#include <unordered_map>
 
 namespace basegfx
 {
@@ -41,6 +41,20 @@ namespace basegfx
         virtual void flushAll() = 0;
     };
 
+    // (S)ystem(D)ependent(D)ata_Type
+    enum class BASEGFX_DLLPUBLIC SDD_Type : sal_uInt16 {
+        SDDType_CairoPathGeometry,
+        SDDType_CairoSurface,
+        SDDType_ID2D1PathGeometry,
+        SDDType_ID2D1Bitmap,
+        SDDType_BitmapHelper,
+        SDDType_MaskHelper,
+        SDDType_CairoPath,
+        SDDType_ModifiedBitmapEx,
+        SDDType_GraphicsPath,
+        SDDType_GdiPlusBitmap
+    };
+
     class BASEGFX_DLLPUBLIC SystemDependentData
     {
     private:
@@ -52,6 +66,9 @@ namespace basegfx
         // a single, globally used one, but not necessarily
         SystemDependentDataManager&     mrSystemDependentDataManager;
 
+        // Type identifier
+        SDD_Type                        maSystemDependentDataType;
+
         // Buffered CalculatedCycles, result of estimations using
         // getHoldCyclesInSeconds and estimateUsageInBytes, executed
         // using getHoldCyclesInSeconds. StartValue is 0 to detect
@@ -60,18 +77,17 @@ namespace basegfx
 
     public:
         SystemDependentData(
-            SystemDependentDataManager& rSystemDependentDataManager);
-
-        // CAUTION! It is VERY important to keep this base class
-        // virtual, else typeid(class).hash_code() from derived classes
-        // will NOT work what is ESSENTIAL for the SystemDependentData
-        // mechanism to work properly. So DO NOT REMOVE virtual here, please.
+            SystemDependentDataManager& rSystemDependentDataManager,
+            SDD_Type aSystemDependentDataType);
         virtual ~SystemDependentData();
 
         // allow access to call startUsage/endUsage/touchUsage
         // using getSystemDependentDataManager()
         SystemDependentDataManager& getSystemDependentDataManager() { return 
mrSystemDependentDataManager; }
 
+        // read access to SDD_Type
+        SDD_Type getSystemDependentDataType() const { return 
maSystemDependentDataType; }
+
         // Calculate HoldCyclesInSeconds based on using
         // getHoldCyclesInSeconds and estimateUsageInBytes, the
         // result is created once on-demand and buffered in
@@ -93,7 +109,7 @@ namespace basegfx
     {
     private:
         // Possibility to hold System-Dependent B2DPolygon-Representations
-        std::map< size_t, SystemDependentData_WeakPtr > 
maSystemDependentReferences;
+        std::unordered_map< SDD_Type, SystemDependentData_WeakPtr > 
maSystemDependentReferences;
 
         // noncopyable
         SystemDependentDataHolder(const SystemDependentDataHolder&) = delete;
@@ -104,7 +120,7 @@ namespace basegfx
         virtual ~SystemDependentDataHolder();
 
         void addOrReplaceSystemDependentData(SystemDependentData_SharedPtr& 
rData);
-        SystemDependentData_SharedPtr getSystemDependentData(size_t hash_code) 
const;
+        SystemDependentData_SharedPtr getSystemDependentData(SDD_Type aType) 
const;
     };
 } // end of namespace basegfx
 
diff --git a/vcl/headless/BitmapHelper.cxx b/vcl/headless/BitmapHelper.cxx
index 312123b7cf3d..cfa9f1556eeb 100644
--- a/vcl/headless/BitmapHelper.cxx
+++ b/vcl/headless/BitmapHelper.cxx
@@ -129,7 +129,8 @@ sal_Int64 estimateUsageInBytesForSurfaceHelper(const 
SurfaceHelper* pHelper)
 
 SystemDependentData_BitmapHelper::SystemDependentData_BitmapHelper(
     std::shared_ptr<BitmapHelper> xBitmapHelper)
-    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                   basegfx::SDD_Type::SDDType_BitmapHelper)
     , maBitmapHelper(std::move(xBitmapHelper))
 {
 }
@@ -141,7 +142,8 @@ sal_Int64 
SystemDependentData_BitmapHelper::estimateUsageInBytes() const
 
 SystemDependentData_MaskHelper::SystemDependentData_MaskHelper(
     std::shared_ptr<MaskHelper> xMaskHelper)
-    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                   basegfx::SDD_Type::SDDType_MaskHelper)
     , maMaskHelper(std::move(xMaskHelper))
 {
 }
@@ -170,7 +172,8 @@ void tryToUseSourceBuffer(const SalBitmap& rSourceBitmap, 
std::shared_ptr<Bitmap
     if (bBufferSource)
     {
         pSystemDependentData_BitmapHelper
-            = 
rSourceBitmap.getSystemDependentData<SystemDependentData_BitmapHelper>();
+            = 
rSourceBitmap.getSystemDependentData<SystemDependentData_BitmapHelper>(
+                basegfx::SDD_Type::SDDType_BitmapHelper);
 
         if (pSystemDependentData_BitmapHelper)
         {
@@ -203,7 +206,8 @@ void tryToUseMaskBuffer(const SalBitmap& rMaskBitmap, 
std::shared_ptr<MaskHelper
     if (bBufferMask)
     {
         pSystemDependentData_MaskHelper
-            = 
rMaskBitmap.getSystemDependentData<SystemDependentData_MaskHelper>();
+            = 
rMaskBitmap.getSystemDependentData<SystemDependentData_MaskHelper>(
+                basegfx::SDD_Type::SDDType_MaskHelper);
 
         if (pSystemDependentData_MaskHelper)
         {
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 38b0bf9418df..80833b18f49c 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -329,7 +329,8 @@ basegfx::B2DPoint PixelSnapper::snap(const 
basegfx::B2DPolygon& rPolygon,
 SystemDependentData_CairoPath::SystemDependentData_CairoPath(size_t 
nSizeMeasure, cairo_t* cr,
                                                              bool bNoJoin, 
bool bAntiAlias,
                                                              const 
std::vector<double>* pStroke)
-    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager(),
+                                   basegfx::SDD_Type::SDDType_CairoPath)
     , mpCairoPath(nullptr)
     , mbNoJoin(bNoJoin)
     , mbAntiAlias(bAntiAlias)
@@ -382,7 +383,8 @@ void add_polygon_path(cairo_t* cr, const 
basegfx::B2DPolyPolygon& rPolyPolygon,
 {
     // try to access buffered data
     std::shared_ptr<SystemDependentData_CairoPath> 
pSystemDependentData_CairoPath(
-        rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>());
+        rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>(
+            basegfx::SDD_Type::SDDType_CairoPath));
 
     if (pSystemDependentData_CairoPath)
     {
@@ -1125,7 +1127,8 @@ bool CairoCommon::drawPolyLine(const 
basegfx::B2DHomMatrix& rObjectToDevice,
 
     // try to access buffered data
     std::shared_ptr<SystemDependentData_CairoPath> 
pSystemDependentData_CairoPath(
-        rPolyLine.getSystemDependentData<SystemDependentData_CairoPath>());
+        rPolyLine.getSystemDependentData<SystemDependentData_CairoPath>(
+            basegfx::SDD_Type::SDDType_CairoPath));
 
     // MM01 need to do line dashing as fallback stuff here now
     const double fDotDashLength(
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 3f9dafab15dc..7d4fceb4397e 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -161,11 +161,11 @@ public:
 
     // exclusive management op's for SystemDependentData at SalBitmap
     template<class T>
-    std::shared_ptr<T> getSystemDependentData() const
+    std::shared_ptr<T> getSystemDependentData(basegfx::SDD_Type aType) const
     {
         const basegfx::SystemDependentDataHolder* 
pDataHolder(accessSystemDependentDataHolder());
         if(pDataHolder)
-            return 
std::static_pointer_cast<T>(pDataHolder->getSystemDependentData(typeid(T).hash_code()));
+            return 
std::static_pointer_cast<T>(pDataHolder->getSystemDependentData(aType));
         return std::shared_ptr<T>();
     }
 
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index a29a28c71701..5eef6bc7bbd5 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -100,7 +100,7 @@ void ImplDeInitSVData()
 
 namespace
 {
-    typedef ::std::map< basegfx::SystemDependentData_SharedPtr, sal_uInt32 > 
EntryMap;
+    typedef ::std::unordered_map< basegfx::SystemDependentData_SharedPtr, 
sal_uInt32 > EntryMap;
 
     class SystemDependentDataBuffer final : public 
basegfx::SystemDependentDataManager
     {
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 3c6679df6795..21b5969c25ec 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -848,7 +848,9 @@ public:
     BufferedData_ModifiedBitmapEx(
         const Bitmap& rChangedBitmap,
         const basegfx::BColorModifierStack& rBColorModifierStack)
-    : 
basegfx::SystemDependentData(Application::GetSystemDependentDataManager())
+    : basegfx::SystemDependentData(
+        Application::GetSystemDependentDataManager(),
+        basegfx::SDD_Type::SDDType_ModifiedBitmapEx)
     , maChangedBitmap(rChangedBitmap)
     , maBColorModifierStack(rBColorModifierStack)
     {
@@ -893,8 +895,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const 
basegfx::BColorModifierStack& rBColorMod
     {
         // try to access SystemDependentDataHolder and buffered data
         pBufferedData_ModifiedBitmapEx = 
std::static_pointer_cast<BufferedData_ModifiedBitmapEx>(
-            pHolder->getSystemDependentData(
-                typeid(BufferedData_ModifiedBitmapEx).hash_code()));
+            
pHolder->getSystemDependentData(basegfx::SDD_Type::SDDType_ModifiedBitmapEx));
 
         if (nullptr != pBufferedData_ModifiedBitmapEx
             && !(pBufferedData_ModifiedBitmapEx->getBColorModifierStack() == 
rBColorModifierStack))
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 2c4c9a38e121..1a186fc4ae8c 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1999,7 +1999,9 @@ 
SystemDependentData_GraphicsPath::SystemDependentData_GraphicsPath(
     std::shared_ptr<Gdiplus::GraphicsPath>& rpGraphicsPath,
     bool bNoLineJoin,
     const std::vector< double >* pStroke)
-:   basegfx::SystemDependentData(Application::GetSystemDependentDataManager()),
+:   basegfx::SystemDependentData(
+        Application::GetSystemDependentDataManager(),
+        basegfx::SDD_Type::SDDType_GraphicsPath),
     mpGraphicsPath(rpGraphicsPath),
     mbNoLineJoin(bNoLineJoin),
     maStroke()
@@ -2071,7 +2073,7 @@ void WinSalGraphicsImpl::drawPolyPolygon(
 
     // try to access buffered data
     std::shared_ptr<SystemDependentData_GraphicsPath> 
pSystemDependentData_GraphicsPath(
-        
rPolyPolygon.getSystemDependentData<SystemDependentData_GraphicsPath>());
+        
rPolyPolygon.getSystemDependentData<SystemDependentData_GraphicsPath>(basegfx::SDD_Type::SDDType_GraphicsPath));
 
     if(pSystemDependentData_GraphicsPath)
     {
@@ -2305,7 +2307,7 @@ bool WinSalGraphicsImpl::drawPolyLine(
 
     // try to access buffered data
     std::shared_ptr<SystemDependentData_GraphicsPath> 
pSystemDependentData_GraphicsPath(
-        rPolygon.getSystemDependentData<SystemDependentData_GraphicsPath>());
+        
rPolygon.getSystemDependentData<SystemDependentData_GraphicsPath>(basegfx::SDD_Type::SDDType_GraphicsPath));
 
     // MM01 need to do line dashing as fallback stuff here now
     const double fDotDashLength(nullptr != pStroke ? 
std::accumulate(pStroke->begin(), pStroke->end(), 0.0) : 0.0);
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index b4960d08c8b9..16cb794eaf8e 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -94,7 +94,9 @@ public:
 SystemDependentData_GdiPlusBitmap::SystemDependentData_GdiPlusBitmap(
     const std::shared_ptr<Gdiplus::Bitmap>& rGdiPlusBitmap,
     const WinSalBitmap* pAssociatedAlpha)
-:   basegfx::SystemDependentData(Application::GetSystemDependentDataManager()),
+:   basegfx::SystemDependentData(
+        Application::GetSystemDependentDataManager(),
+        basegfx::SDD_Type::SDDType_GdiPlusBitmap),
     mpGdiPlusBitmap(rGdiPlusBitmap),
     mpAssociatedAlpha(pAssociatedAlpha)
 {
@@ -159,7 +161,7 @@ std::shared_ptr< Gdiplus::Bitmap > 
WinSalBitmap::ImplGetGdiPlusBitmap(const WinS
 
     // try to access buffered data
     std::shared_ptr<SystemDependentData_GdiPlusBitmap> 
pSystemDependentData_GdiPlusBitmap(
-        getSystemDependentData<SystemDependentData_GdiPlusBitmap>());
+        
getSystemDependentData<SystemDependentData_GdiPlusBitmap>(basegfx::SDD_Type::SDDType_GdiPlusBitmap));
 
     if(pSystemDependentData_GdiPlusBitmap)
     {

Reply via email to