diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-06-12 16:03:40 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-06-15 10:07:07 +0200 |
commit | 30deee2265e76052c320a0c1f84486c6dd1bebc3 (patch) | |
tree | 4ac43ad7c572b71dc0a0fa35a2433c2b5ee177d6 /vcl/skia | |
parent | 104173946f1989bc7d7b36855a5058da8cc3409c (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>
Diffstat (limited to 'vcl/skia')
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 15 |
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()); |