summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/bitmap.cxx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2015-08-26 13:50:57 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-09-01 16:28:45 +0100
commitebb0dc14547e698d7b53005178063da72d48f075 (patch)
tree8cf95d717f32672dc8e6ecf9f6b743227ada889f /vcl/source/gdi/bitmap.cxx
parent7cc4cdc5ef6dff279e072af725c2d7fc1e5da0e8 (diff)
Added support for computing 64-bit checksum of bitmap in OpenGL
Added a C++ and a GLSL implementation of a 64-bit CRC algorithm. Changed hardcoded checksum value in ooxmlimport unit test (testN777345). Change-Id: I16bb985a14866775efda49e21fe033ff64645896
Diffstat (limited to 'vcl/source/gdi/bitmap.cxx')
-rw-r--r--vcl/source/gdi/bitmap.cxx50
1 files changed, 3 insertions, 47 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 9a69eb0f8af1..6f96c050685d 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -245,10 +245,8 @@ Bitmap& Bitmap::operator=( const Bitmap& rBitmap )
bool Bitmap::IsEqual( const Bitmap& rBmp ) const
{
- return( IsSameInstance( rBmp ) ||
- ( rBmp.GetSizePixel() == GetSizePixel() &&
- rBmp.GetBitCount() == GetBitCount() &&
- rBmp.GetChecksum() == GetChecksum() ) );
+ return(IsSameInstance(rBmp) || // Includes both are nullptr
+ (rBmp.mpImpBmp && mpImpBmp && mpImpBmp->ImplIsEqual(*rBmp.mpImpBmp)));
}
void Bitmap::SetEmpty()
@@ -293,49 +291,6 @@ sal_uInt32 Bitmap::GetChecksum() const
if( mpImpBmp )
{
nRet = mpImpBmp->ImplGetChecksum();
-
- if( !nRet )
- {
- BitmapReadAccess* pRAcc = const_cast<Bitmap*>(this)->AcquireReadAccess();
-
- if( pRAcc && pRAcc->Width() && pRAcc->Height() )
- {
- sal_uInt32 nCrc = 0;
- SVBT32 aBT32;
-
- pRAcc->ImplZeroInitUnusedBits();
-
- UInt32ToSVBT32( pRAcc->Width(), aBT32 );
- nCrc = rtl_crc32( nCrc, aBT32, 4 );
-
- UInt32ToSVBT32( pRAcc->Height(), aBT32 );
- nCrc = rtl_crc32( nCrc, aBT32, 4 );
-
- UInt32ToSVBT32( pRAcc->GetBitCount(), aBT32 );
- nCrc = rtl_crc32( nCrc, aBT32, 4 );
-
- UInt32ToSVBT32( pRAcc->GetColorMask().GetRedMask(), aBT32 );
- nCrc = rtl_crc32( nCrc, aBT32, 4 );
-
- UInt32ToSVBT32( pRAcc->GetColorMask().GetGreenMask(), aBT32 );
- nCrc = rtl_crc32( nCrc, aBT32, 4 );
-
- UInt32ToSVBT32( pRAcc->GetColorMask().GetBlueMask(), aBT32 );
- nCrc = rtl_crc32( nCrc, aBT32, 4 );
-
- if( pRAcc->HasPalette() )
- {
- nCrc = rtl_crc32( nCrc, pRAcc->GetPalette().ImplGetColorBuffer(),
- pRAcc->GetPaletteEntryCount() * sizeof( BitmapColor ) );
- }
-
- nRet = rtl_crc32( nCrc, pRAcc->GetBuffer(), pRAcc->GetScanlineSize() * pRAcc->Height() );
-
- mpImpBmp->ImplSetChecksum( nRet );
- }
-
- if (pRAcc) ReleaseAccess( pRAcc );
- }
}
return nRet;
@@ -549,6 +504,7 @@ bool Bitmap::Invert()
pAcc->SetPixel( nY, nX, pAcc->GetPixel( nY, nX ).Invert() );
}
+ mpImpBmp->ImplInvalidateChecksum();
ReleaseAccess( pAcc );
bRet = true;
}