[Libreoffice-commits] core.git: vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 07:31:32 UTC 2020


 vcl/skia/salbmp.cxx |   20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

New commits:
commit 843e30dc230b5fcfa9589a9fd1dfe3f040c1e2ef
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Jul 7 13:21:28 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Jul 8 09:30:50 2020 +0200

    make sure SkiaSalBitmap::dump() doesn't change the object
    
    Now that there's delayed resizing and erasing, saving and restoring
    the state is getting complicated, so just work on a copy.
    
    Change-Id: I4df8cdba24d89e16f58d19516d667ff35e42dea6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98255
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 43286ac4a9fe..8cd1a158dc2f 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -925,22 +925,10 @@ OString SkiaSalBitmap::GetAlphaImageKey() const
 #ifdef DBG_UTIL
 void SkiaSalBitmap::dump(const char* file) const
 {
-    sk_sp<SkImage> saveImage = mImage;
-    sk_sp<SkImage> saveAlphaImage = mAlphaImage;
-    bool resetBuffer = !mBuffer;
-    int saveWriteAccessCount = mWriteAccessCount;
-    Size savePrescaleSize = mPixelsSize;
-    SkiaSalBitmap* thisPtr = const_cast<SkiaSalBitmap*>(this);
-    // avoid possible assert
-    thisPtr->mWriteAccessCount = 0;
-    SkiaHelper::dump(GetSkImage(), file);
-    // restore old state, so that debugging doesn't affect it
-    if (resetBuffer)
-        thisPtr->mBuffer.reset();
-    thisPtr->mImage = saveImage;
-    thisPtr->mAlphaImage = saveAlphaImage;
-    thisPtr->mWriteAccessCount = saveWriteAccessCount;
-    thisPtr->mPixelsSize = savePrescaleSize;
+    // Use a copy, so that debugging doesn't affect this instance.
+    SkiaSalBitmap copy;
+    copy.Create(*this);
+    SkiaHelper::dump(copy.GetSkImage(), file);
 }
 
 void SkiaSalBitmap::verify() const


More information about the Libreoffice-commits mailing list