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.Grand@me.com>
This commit is contained in:
committed by
Armin Le Grand
parent
943ee53259
commit
f74bb604ff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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(
|
||||
|
||||
+2
-2
@@ -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>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user