[Libreoffice-commits] core.git: vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 21 08:03:53 UTC 2020


 vcl/skia/gdiimpl.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 6c559b122add7db32b06faa15854df58b30460f6
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Apr 20 17:35:30 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Apr 21 10:02:48 2020 +0200

    work around copy-to-self SkSurface::draw() being buggy (tdf#132051)
    
    This may become the actual fix or may be removed later depending
    on the outcome of
    https://groups.google.com/d/msgid/skia-discuss/202004151937.05051.l.lunak%40collabora.com .
    
    Change-Id: I709f3e7bffbe86ddb2f6d75724bf30e4b0f0116e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92587
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 1937115e1c23..6926823a5db0 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -897,6 +897,16 @@ static void copyArea(SkCanvas* canvas, sk_sp<SkSurface> surface, long nDestX, lo
     // Using SkSurface::draw() should be more efficient than SkSurface::makeImageSnapshot(),
     // because it may detect copying to itself and avoid some needless copies.
     // It cannot do a subrectangle though, so clip.
+    if (canvas == surface->getCanvas())
+    {
+        // TODO: Currently copy-to-self is buggy with SkSurface::draw().
+        SkPaint paint;
+        paint.setBlendMode(SkBlendMode::kSrc); // copy as is, including alpha
+        canvas->drawImageRect(surface->makeImageSnapshot(),
+                              SkIRect::MakeXYWH(nSrcX, nSrcY, nSrcWidth, nSrcHeight),
+                              SkRect::MakeXYWH(nDestX, nDestY, nSrcWidth, nSrcHeight), &paint);
+        return;
+    }
     canvas->save();
     canvas->clipRect(SkRect::MakeXYWH(nDestX, nDestY, nSrcWidth, nSrcHeight));
     SkPaint paint;


More information about the Libreoffice-commits mailing list