summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/graph.hxx7
-rw-r--r--include/vcl/vectorgraphicdata.hxx1
-rw-r--r--vcl/inc/impgraph.hxx2
-rw-r--r--vcl/source/gdi/bitmapex.cxx8
-rw-r--r--vcl/source/gdi/impgraph.cxx27
-rw-r--r--vcl/source/gdi/vectorgraphicdata.cxx6
6 files changed, 25 insertions, 26 deletions
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index e8af0d2c06ce..d49a8a2ce512 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -195,11 +195,6 @@ public:
BitmapChecksum GetChecksum() const;
- SAL_DLLPRIVATE std::size_t getHash() const
- {
- return reinterpret_cast<std::size_t>(ImplGetImpGraphic());
- }
-
OUString getOriginURL() const;
void setOriginURL(OUString const & rOriginURL);
@@ -247,7 +242,7 @@ struct hash<Graphic>
{
std::size_t operator()(Graphic const & rGraphic) const
{
- return rGraphic.getHash();
+ return static_cast<std::size_t>(rGraphic.GetChecksum());
}
};
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
index 113a733e296d..7a45533b8f6b 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -104,6 +104,7 @@ public:
const basegfx::B2DRange& getRange() const;
const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& getPrimitive2DSequence() const;
const BitmapEx& getReplacement() const;
+ BitmapChecksum GetChecksum() const;
};
typedef std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr;
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 457a33cfcddb..b97f736c770d 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -84,6 +84,8 @@ private:
bool mbSwapOut;
bool mbDummyContext;
VectorGraphicDataPtr maVectorGraphicData;
+ // cache checksum computation
+ mutable BitmapChecksum mnChecksum = 0;
/// The PDF stream from which this Graphic is rendered,
/// as converted (version downgraded) from the original,
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 2ea870e341e6..de9f2fb97762 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -181,9 +181,6 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
if (meTransparent != rBitmapEx.meTransparent)
return false;
- if (!maBitmap.ShallowEquals(rBitmapEx.maBitmap))
- return false;
-
if (GetSizePixel() != rBitmapEx.GetSizePixel())
return false;
@@ -197,7 +194,10 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
if (mbAlpha != rBitmapEx.mbAlpha)
return false;
- return maMask.ShallowEquals(rBitmapEx.maMask);
+ if (maBitmap != rBitmapEx.maBitmap)
+ return false;
+
+ return maMask == rBitmapEx.maMask;
}
bool BitmapEx::IsEmpty() const
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index f99d44799aaa..3cd67b08ce33 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1663,6 +1663,9 @@ bool ImpGraphic::ImplIsLink() const
BitmapChecksum ImpGraphic::ImplGetChecksum() const
{
+ if (mnChecksum != 0)
+ return mnChecksum;
+
BitmapChecksum nRet = 0;
ensureAvailable();
@@ -1676,25 +1679,16 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
case GraphicType::Bitmap:
{
- if(maVectorGraphicData.get() && maEx.IsEmpty())
- {
- // use maEx as local buffer for rendered svg
- const_cast< ImpGraphic* >(this)->maEx = maVectorGraphicData->getReplacement();
- }
-
- if( mpAnimation )
- {
- nRet = mpAnimation->GetChecksum();
- }
- else
- {
- nRet = maEx.GetChecksum();
- }
-
- if (mpPdfData && mpPdfData->hasElements())
+ if(maVectorGraphicData)
+ nRet = maVectorGraphicData->GetChecksum();
+ else if (mpPdfData && mpPdfData->hasElements())
// Include the PDF data in the checksum, so a metafile with
// and without PDF data is considered to be different.
nRet = vcl_get_checksum(nRet, mpPdfData->getConstArray(), mpPdfData->getLength());
+ else if( mpAnimation )
+ nRet = mpAnimation->GetChecksum();
+ else
+ nRet = maEx.GetChecksum();
}
break;
@@ -1704,6 +1698,7 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
}
}
+ mnChecksum = nRet;
return nRet;
}
diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx
index 0e6b610154a8..8c936f00cfd7 100644
--- a/vcl/source/gdi/vectorgraphicdata.cxx
+++ b/vcl/source/gdi/vectorgraphicdata.cxx
@@ -288,4 +288,10 @@ const BitmapEx& VectorGraphicData::getReplacement() const
return maReplacement;
}
+BitmapChecksum VectorGraphicData::GetChecksum() const
+{
+ BitmapChecksum nRet = 0;
+ return vcl_get_checksum(nRet, maVectorGraphicDataArray.getConstArray(), maVectorGraphicDataArray.getLength());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */