summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-05-29 21:07:10 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2017-05-30 18:08:46 +0200
commit23ee2d252e4e026657e9b52e5c9132ca201ac43e (patch)
tree13ea6986f31e0c11407bca35cbde046d572aa4a8
parent0a481b5e2ac4ccb6d310c4be32941a4fa7355f5a (diff)
tdf#107682 - Repeated images replace correct ones in exported PDF
The problem was due to the buffer acquire methods: in Bitmap::Checksum (old implementation) Bitmap::AcquireReadAccess is used to get the bitmap buffer: indeed this method relies on SalBitmap::AcquireBuffer (which is used in the new implementation) but in case the buffer acquisition fails, instead of giving up, it tries to update the imp bitmap instance embedded in the bitmap (see BitmapInfoAccess::ImplCreate). The solution is to perform this further attemp in Bitmap::Checksum when the value returned by ImpBitmap::GetChecksum is 0. Change-Id: Ib901ac941db57756e9a951bacbc573ca206316e0 Reviewed-on: https://gerrit.libreoffice.org/38167 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
-rw-r--r--vcl/source/gdi/bitmap.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 8dc4bd07e0d3..71d5d73f15ab 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -275,6 +275,21 @@ BitmapChecksum Bitmap::GetChecksum() const
if( mxImpBmp )
{
nRet = mxImpBmp->ImplGetChecksum();
+
+ if (!nRet)
+ {
+ // nRet == 0 => probably, we were not able to acquire
+ // the buffer in SalBitmap::updateChecksum;
+ // so, we need to update the imp bitmap for this bitmap instance
+ // as we do in BitmapInfoAccess::ImplCreate
+ std::shared_ptr<ImpBitmap> xNewImpBmp(new ImpBitmap);
+ if (xNewImpBmp->ImplCreate(*mxImpBmp, GetBitCount()))
+ {
+ Bitmap* pThis = const_cast<Bitmap*>(this);
+ pThis->mxImpBmp = xNewImpBmp;
+ nRet = mxImpBmp->ImplGetChecksum();
+ }
+ }
}
return nRet;