summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-08-10 14:30:10 +0300
committerTomaž Vajngerl <quikee@gmail.com>2021-08-17 04:42:31 +0200
commit9bd336d6566897a6d2238bf38f927a20ae981da9 (patch)
tree3aacd1a35f87b00ea0259fb1638f204467ad5c8c
parent20d48960d7c6d1fda499983853c9c4e4c9b3f9e1 (diff)
Move GDIMetaFile::GetChecksum to SvmWriter::GetChecksum
Move the method and update all the method calls from GDIMetaFile::GetChecksum -> SvmWriter::GetChecksum Remove the method from gdimtf Change-Id: I68e2b3cf99178947ac4f1474810dd5568f07e122 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120414 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--filter/source/svg/svgwriter.cxx3
-rw-r--r--include/vcl/filter/SvmWriter.hxx1
-rw-r--r--include/vcl/gdimtf.hxx1
-rw-r--r--vcl/source/filter/svm/SvmWriter.cxx347
-rw-r--r--vcl/source/gdi/gdimtf.cxx343
-rw-r--r--vcl/source/gdi/impgraph.cxx2
6 files changed, 351 insertions, 346 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 17401fdd2370..d7bcf77d95be 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -30,6 +30,7 @@
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include <vcl/filter/SvmReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
#include <tools/fract.hxx>
#include <tools/helpers.hxx>
#include <tools/stream.hxx>
@@ -1943,7 +1944,7 @@ BitmapChecksum SVGActionWriter::GetChecksum( const MetaAction* pAction )
GDIMetaFile aMtf;
MetaAction* pA = const_cast<MetaAction*>(pAction);
aMtf.AddAction( pA );
- return aMtf.GetChecksum();
+ return SvmWriter::GetChecksum( aMtf );
}
void SVGActionWriter::SetEmbeddedBitmapRefs( const MetaBitmapActionMap* pEmbeddedBitmapsMap )
diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
index 9bd3989a1b9a..9237f62b2884 100644
--- a/include/vcl/filter/SvmWriter.hxx
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -37,6 +37,7 @@ public:
SvmWriter(SvStream& rIStm);
SvStream& Write(const GDIMetaFile& rMetaFile);
+ static BitmapChecksum GetChecksum(const GDIMetaFile& rMetaFile);
void MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData);
void ActionHandler(MetaAction* pAction);
void PixelHandler(MetaPixelAction* pAction);
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 8ce95ed11029..007f59521cdd 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -179,7 +179,6 @@ public:
void SetPrefMapMode( const MapMode& rMapMode ) { m_aPrefMapMode = rMapMode; }
- BitmapChecksum GetChecksum() const;
sal_uLong GetSizeBytes() const;
/// Creates an antialiased thumbnail
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index 189f6a8e69ac..ddc47a892547 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -69,6 +69,353 @@ SvStream& SvmWriter::Write(const GDIMetaFile& rMetaFile)
return mrStream;
}
+BitmapChecksum SvmWriter::GetChecksum(const GDIMetaFile& rMetaFile)
+{
+ SvMemoryStream aMemStm(65535, 65535);
+ ImplMetaWriteData aWriteData;
+ SVBT16 aBT16;
+ SVBT32 aBT32;
+ BitmapChecksumOctetArray aBCOA;
+ BitmapChecksum nCrc = 0;
+
+ aWriteData.meActualCharSet = aMemStm.GetStreamCharSet();
+
+ for (size_t i = 0, nObjCount = rMetaFile.GetActionSize(); i < nObjCount; i++)
+ {
+ MetaAction* pAction = rMetaFile.GetAction(i);
+
+ switch (pAction->GetType())
+ {
+ case MetaActionType::BMP:
+ {
+ MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::BMPSCALE:
+ {
+ MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::BMPSCALEPART:
+ {
+ MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ Int32ToSVBT32(pAct->GetDestPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::BMPEX:
+ {
+ MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::BMPEXSCALE:
+ {
+ MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::BMPEXSCALEPART:
+ {
+ MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ Int32ToSVBT32(pAct->GetDestPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::MASK:
+ {
+ MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ UInt32ToSVBT32(sal_uInt32(pAct->GetColor()), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::MASKSCALE:
+ {
+ MetaMaskScaleAction* pAct = static_cast<MetaMaskScaleAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ UInt32ToSVBT32(sal_uInt32(pAct->GetColor()), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::MASKSCALEPART:
+ {
+ MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
+
+ ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
+ nCrc = vcl_get_checksum(nCrc, aBT16, 2);
+
+ BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
+ nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
+
+ UInt32ToSVBT32(sal_uInt32(pAct->GetColor()), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetDestSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcPoint().X(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcPoint().Y(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcSize().Width(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+
+ Int32ToSVBT32(pAct->GetSrcSize().Height(), aBT32);
+ nCrc = vcl_get_checksum(nCrc, aBT32, 4);
+ }
+ break;
+
+ case MetaActionType::EPS:
+ {
+ MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
+ nCrc = vcl_get_checksum(nCrc, pAct->GetLink().GetData(),
+ pAct->GetLink().GetDataSize());
+ }
+ break;
+
+ case MetaActionType::CLIPREGION:
+ {
+ MetaClipRegionAction& rAct = static_cast<MetaClipRegionAction&>(*pAction);
+ const vcl::Region& rRegion = rAct.GetRegion();
+
+ if (rRegion.HasPolyPolygonOrB2DPolyPolygon())
+ {
+ // It has shown that this is a possible bottleneck for checksum calculation.
+ // In worst case a very expensive RegionHandle representation gets created.
+ // In this case it's cheaper to use the PolyPolygon
+ const basegfx::B2DPolyPolygon aPolyPolygon(rRegion.GetAsB2DPolyPolygon());
+ SVBT64 aSVBT64;
+
+ for (auto const& rPolygon : aPolyPolygon)
+ {
+ const sal_uInt32 nPointCount(rPolygon.count());
+ const bool bControl(rPolygon.areControlPointsUsed());
+
+ for (sal_uInt32 b(0); b < nPointCount; b++)
+ {
+ const basegfx::B2DPoint aPoint(rPolygon.getB2DPoint(b));
+
+ DoubleToSVBT64(aPoint.getX(), aSVBT64);
+ nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
+ DoubleToSVBT64(aPoint.getY(), aSVBT64);
+ nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
+
+ if (bControl)
+ {
+ if (rPolygon.isPrevControlPointUsed(b))
+ {
+ const basegfx::B2DPoint aCtrl(rPolygon.getPrevControlPoint(b));
+
+ DoubleToSVBT64(aCtrl.getX(), aSVBT64);
+ nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
+ DoubleToSVBT64(aCtrl.getY(), aSVBT64);
+ nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
+ }
+
+ if (rPolygon.isNextControlPointUsed(b))
+ {
+ const basegfx::B2DPoint aCtrl(rPolygon.getNextControlPoint(b));
+
+ DoubleToSVBT64(aCtrl.getX(), aSVBT64);
+ nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
+ DoubleToSVBT64(aCtrl.getY(), aSVBT64);
+ nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
+ }
+ }
+ }
+ }
+
+ sal_uInt8 tmp = static_cast<sal_uInt8>(rAct.IsClipping());
+ nCrc = vcl_get_checksum(nCrc, &tmp, 1);
+ }
+ else
+ {
+ SvmWriter aWriter(aMemStm);
+ aWriter.MetaActionHandler(pAction, &aWriteData);
+ nCrc = vcl_get_checksum(nCrc, aMemStm.GetData(), aMemStm.Tell());
+ aMemStm.Seek(0);
+ }
+ }
+ break;
+
+ default:
+ {
+ SvmWriter aWriter(aMemStm);
+ aWriter.MetaActionHandler(pAction, &aWriteData);
+ nCrc = vcl_get_checksum(nCrc, aMemStm.GetData(), aMemStm.Tell());
+ aMemStm.Seek(0);
+ }
+ break;
+ }
+ }
+
+ return nCrc;
+}
+
void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData)
{
MetaActionType nType = pAction->GetType();
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 60e3ec0f293d..cfeaf1d0a4b3 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2212,349 +2212,6 @@ GDIMetaFile GDIMetaFile::GetMonochromeMtf( const Color& rColor ) const
return aRet;
}
-BitmapChecksum GDIMetaFile::GetChecksum() const
-{
- SvMemoryStream aMemStm( 65535, 65535 );
- ImplMetaWriteData aWriteData;
- SVBT16 aBT16;
- SVBT32 aBT32;
- BitmapChecksumOctetArray aBCOA;
- BitmapChecksum nCrc = 0;
-
- aWriteData.meActualCharSet = aMemStm.GetStreamCharSet();
- for( size_t i = 0, nObjCount = GetActionSize(); i < nObjCount; i++ )
- {
- MetaAction* pAction = GetAction( i );
-
- switch( pAction->GetType() )
- {
- case MetaActionType::BMP:
- {
- MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- Int32ToSVBT32( pAct->GetPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::BMPSCALE:
- {
- MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- Int32ToSVBT32( pAct->GetPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::BMPSCALEPART:
- {
- MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- Int32ToSVBT32( pAct->GetDestPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::BMPEX:
- {
- MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmapEx().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- Int32ToSVBT32( pAct->GetPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::BMPEXSCALE:
- {
- MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmapEx().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- Int32ToSVBT32( pAct->GetPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::BMPEXSCALEPART:
- {
- MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmapEx().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- Int32ToSVBT32( pAct->GetDestPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::MASK:
- {
- MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- UInt32ToSVBT32( sal_uInt32(pAct->GetColor()), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::MASKSCALE:
- {
- MetaMaskScaleAction* pAct = static_cast<MetaMaskScaleAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- UInt32ToSVBT32( sal_uInt32(pAct->GetColor()), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::MASKSCALEPART:
- {
- MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
-
- ShortToSVBT16( static_cast<sal_uInt16>(pAct->GetType()), aBT16 );
- nCrc = vcl_get_checksum( nCrc, aBT16, 2 );
-
- BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA );
- nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
-
- UInt32ToSVBT32( sal_uInt32(pAct->GetColor()), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetDestSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
-
- Int32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 );
- nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- }
- break;
-
- case MetaActionType::EPS :
- {
- MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
- nCrc = vcl_get_checksum( nCrc, pAct->GetLink().GetData(), pAct->GetLink().GetDataSize() );
- }
- break;
-
- case MetaActionType::CLIPREGION :
- {
- MetaClipRegionAction& rAct = static_cast<MetaClipRegionAction&>(*pAction);
- const vcl::Region& rRegion = rAct.GetRegion();
-
- if(rRegion.HasPolyPolygonOrB2DPolyPolygon())
- {
- // It has shown that this is a possible bottleneck for checksum calculation.
- // In worst case a very expensive RegionHandle representation gets created.
- // In this case it's cheaper to use the PolyPolygon
- const basegfx::B2DPolyPolygon aPolyPolygon(rRegion.GetAsB2DPolyPolygon());
- SVBT64 aSVBT64;
-
- for(auto const& rPolygon : aPolyPolygon)
- {
- const sal_uInt32 nPointCount(rPolygon.count());
- const bool bControl(rPolygon.areControlPointsUsed());
-
- for(sal_uInt32 b(0); b < nPointCount; b++)
- {
- const basegfx::B2DPoint aPoint(rPolygon.getB2DPoint(b));
-
- DoubleToSVBT64(aPoint.getX(), aSVBT64);
- nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
- DoubleToSVBT64(aPoint.getY(), aSVBT64);
- nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
-
- if(bControl)
- {
- if(rPolygon.isPrevControlPointUsed(b))
- {
- const basegfx::B2DPoint aCtrl(rPolygon.getPrevControlPoint(b));
-
- DoubleToSVBT64(aCtrl.getX(), aSVBT64);
- nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
- DoubleToSVBT64(aCtrl.getY(), aSVBT64);
- nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
- }
-
- if(rPolygon.isNextControlPointUsed(b))
- {
- const basegfx::B2DPoint aCtrl(rPolygon.getNextControlPoint(b));
-
- DoubleToSVBT64(aCtrl.getX(), aSVBT64);
- nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
- DoubleToSVBT64(aCtrl.getY(), aSVBT64);
- nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
- }
- }
- }
- }
-
- sal_uInt8 tmp = static_cast<sal_uInt8>(rAct.IsClipping());
- nCrc = vcl_get_checksum(nCrc, &tmp, 1);
- }
- else
- {
- pAction->Write( aMemStm, &aWriteData );
- nCrc = vcl_get_checksum( nCrc, aMemStm.GetData(), aMemStm.Tell() );
- aMemStm.Seek( 0 );
- }
- }
- break;
-
- default:
- {
- pAction->Write( aMemStm, &aWriteData );
- nCrc = vcl_get_checksum( nCrc, aMemStm.GetData(), aMemStm.Tell() );
- aMemStm.Seek( 0 );
- }
- break;
- }
- }
-
- return nCrc;
-}
-
sal_uLong GDIMetaFile::GetSizeBytes() const
{
sal_uLong nSizeBytes = 0;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 6e4416935100..ae3f2209a8a8 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1742,7 +1742,7 @@ BitmapChecksum ImpGraphic::getChecksum() const
case GraphicType::GdiMetafile:
{
- mnChecksum = maMetaFile.GetChecksum();
+ mnChecksum = SvmWriter::GetChecksum(maMetaFile);
}
break;
}