[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - vcl/source

Marco Cecchetti marco.cecchetti at collabora.com
Tue May 30 17:55:19 UTC 2017


 vcl/source/gdi/bitmap.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 2cc070ccf1347dcd0cfff048d8bf3cc9c29cc3bd
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon May 29 21:07:10 2017 +0200

    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/38169
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index cf0bf70343e3..b5641b82857d 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -285,6 +285,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;


More information about the Libreoffice-commits mailing list