[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 15 13:27:28 UTC 2020


 vcl/skia/gdiimpl.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 5ca7e7aaf0c441f8602a21c4b4b18085063f674c
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Jun 12 16:03:40 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Jun 15 15:26:57 2020 +0200

    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 at collabora.com>
    (cherry picked from commit fe78804b962a11a35b14ad6ec8afdd02ba40034a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96287

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());


More information about the Libreoffice-commits mailing list