diff options
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
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; |