summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-06-12 16:03:40 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-06-15 15:26:57 +0200
commit5ca7e7aaf0c441f8602a21c4b4b18085063f674c (patch)
treed896fb103b29b903bc82995e86bf79de1b033c53 /vcl
parentb87b42f37f83f95be6b917336eeadd8f2b0d3563 (diff)
fix skewed drawing in Skia's drawTransformedBitmap() (tdf#133925)
In debug builds this led to an assert with the bugdoc, in optimized builds it seems to cause drawing problems. Change-Id: Id52309f2e3d33f8b68952d988b927cea7546d131 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96206 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit fe78804b962a11a35b14ad6ec8afdd02ba40034a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96287
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/gdiimpl.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 58d59cf5aabe..7e522304c85d 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1380,8 +1380,8 @@ bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
// using the rNull, rX, rY points as destinations for the (0,0), (Width,0), (0,Height) source points.
// Round to pixels, otherwise kMScaleX/Y below could be slightly != 1, causing unnecessary uncached
// scaling.
- const basegfx::B2IVector aXRel = basegfx::fround(rX - rNull);
- const basegfx::B2IVector aYRel = basegfx::fround(rY - rNull);
+ const basegfx::B2DVector aXRel = basegfx::B2DTuple(basegfx::fround(rX - rNull));
+ const basegfx::B2DVector aYRel = basegfx::B2DTuple(basegfx::fround(rY - rNull));
const Size aSize = rSourceBitmap.GetSize();
@@ -1389,18 +1389,15 @@ bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
SAL_INFO("vcl.skia.trace", "drawtransformedbitmap(" << this << "): " << aSize << " " << rNull
<< ":" << rX << ":" << rY);
- // TODO: How to cache properly skewed images?
- bool blockCaching = (aXRel.getY() != 0 || aYRel.getX() != 0);
- const Size imageSize(aXRel.getX(), aYRel.getY());
- sk_sp<SkImage> imageToDraw
- = mergeBitmaps(rSkiaBitmap, pSkiaAlphaBitmap, imageSize, blockCaching);
+ const Size imageSize(aXRel.getLength(), aXRel.getLength());
+ sk_sp<SkImage> imageToDraw = mergeBitmaps(rSkiaBitmap, pSkiaAlphaBitmap, imageSize);
if (!imageToDraw)
return false;
SkMatrix aMatrix;
aMatrix.set(SkMatrix::kMScaleX, aXRel.getX() / imageToDraw->width());
- aMatrix.set(SkMatrix::kMSkewY, aXRel.getY() / aSize.Width());
- aMatrix.set(SkMatrix::kMSkewX, aYRel.getX() / aSize.Height());
+ aMatrix.set(SkMatrix::kMSkewY, aXRel.getY() / imageToDraw->width());
+ aMatrix.set(SkMatrix::kMSkewX, aYRel.getX() / imageToDraw->height());
aMatrix.set(SkMatrix::kMScaleY, aYRel.getY() / imageToDraw->height());
aMatrix.set(SkMatrix::kMTransX, rNull.getX());
aMatrix.set(SkMatrix::kMTransY, rNull.getY());