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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 29 16:58:01 UTC 2019


 vcl/skia/gdiimpl.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit c5df5f44157338d58744d9b31f683bd13b29f2e2
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Oct 29 17:55:46 2019 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Oct 29 17:57:09 2019 +0100

    restore canvas state in SkiaSalGraphicsImpl::drawTransformedBitmap()
    
    Otherwise the transformation stays set on the canvas also for further
    operations.
    
    Change-Id: Ibcb8480a74dd7da880bbc83cb186dabe06394fe9

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 6c07436ddfa3..1565f23c98ca 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -201,6 +201,13 @@ void SkiaSalGraphicsImpl::createSurface()
 
 void SkiaSalGraphicsImpl::destroySurface()
 {
+    if (mSurface)
+    {
+        // check setClipRegion() invariant
+        assert(mSurface->getCanvas()->getSaveCount() == 2);
+        // if this fails, something forgot to use SkAutoCanvasRestore
+        assert(mSurface->getCanvas()->getTotalMatrix().isIdentity());
+    }
     // If we use e.g. Vulkan, we must destroy the surface before the context,
     // otherwise destroying the surface will reference the context. This is
     // handled by calling destroySurface() before destroying the context.
@@ -892,8 +899,11 @@ bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
     aMatrix.set(SkMatrix::kMTransY, rNull.getY());
 
     preDraw();
-    mSurface->getCanvas()->concat(aMatrix);
-    mSurface->getCanvas()->drawBitmap(aTemporaryBitmap, 0, 0);
+    {
+        SkAutoCanvasRestore autoRestore(mSurface->getCanvas(), true);
+        mSurface->getCanvas()->concat(aMatrix);
+        mSurface->getCanvas()->drawBitmap(aTemporaryBitmap, 0, 0);
+    }
     postDraw();
 
     return true;


More information about the Libreoffice-commits mailing list