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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 16 09:12:12 UTC 2020


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

New commits:
commit c6ae09ecfa2a8a9746e72b3e52e5b32ece6b77cb
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Jun 15 16:07:10 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Jun 16 11:11:42 2020 +0200

    implement Skia workaround for adjacent AA-ed polygons (tdf#133016)
    
    Non-antialised adjacent polygons line up perfectly when drawn, and
    LO code assumes this is the case even when AA is enabled, which
    seems to work with Cairo, but not with Skia. So add a hack.
    Ideally LO code should not use such polygons.
    
    Change-Id: Ib46139db80f7bda78fde3aac4244da391133b7cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96369
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 094f8dfc3d349c34063bcee48d9b75328cf341b4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96415

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 7e522304c85d..7acb0f35d07f 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -708,6 +708,24 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo
         aPaint.setColor(toSkColorWithTransparency(mFillColor, fTransparency));
         aPaint.setStyle(SkPaint::kFill_Style);
         getDrawCanvas()->drawPath(aPath, aPaint);
+        // There is some code that needlessly subdivides areas into adjacent rectangles,
+        // but Skia doesn't line them up perfectly if AA is enabled (e.g. Cairo, Qt5 do,
+        // but Skia devs claim it's working as intended
+        // https://groups.google.com/d/msg/skia-discuss/NlKpD2X_5uc/Vuwd-kyYBwAJ).
+        // An example is tdf#133016, which triggers SvgStyleAttributes::add_stroke()
+        // implementing a line stroke as a bunch of polygons instead of just one, and
+        // SvgLinearAtomPrimitive2D::create2DDecomposition() creates a gradient
+        // as a series of polygons of gradually changing color. Those places should be
+        // changed, but for now explicitly draw the polygon outline in these cases,
+        // which will fill the holes between polygons left by AA.
+        // TODO: If fTransparency != 0 then this will draw some pixels twice, if that
+        // is a problem then this can be handled by drawing to a temporary surface
+        // and drawing that using the given transparency.
+        if (mParent.getAntiAliasB2DDraw() && mLineColor == SALCOLOR_NONE)
+        {
+            aPaint.setStyle(SkPaint::kStroke_Style);
+            getDrawCanvas()->drawPath(aPath, aPaint);
+        }
     }
     if (mLineColor != SALCOLOR_NONE)
     {


More information about the Libreoffice-commits mailing list