summaryrefslogtreecommitdiff
path: root/vcl/skia
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-10-29 17:55:46 +0100
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:13 +0100
commitc6524f3836595040db3711567e5f3ad99abd66d8 (patch)
tree675ae3fa145749e23bffbffc03f2f70dc2a1466d /vcl/skia
parent458cac4674dde9c89cffb028a5d174ea61f3b81b (diff)
restore canvas state in SkiaSalGraphicsImpl::drawTransformedBitmap()
Otherwise the transformation stays set on the canvas also for further operations. Change-Id: Ibcb8480a74dd7da880bbc83cb186dabe06394fe9
Diffstat (limited to 'vcl/skia')
-rw-r--r--vcl/skia/gdiimpl.cxx14
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;