summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-06-15 16:07:10 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-06-16 11:11:42 +0200
commitc6ae09ecfa2a8a9746e72b3e52e5b32ece6b77cb (patch)
treea10ac248d2661ca54df983425fc3ee5c438c104c /vcl
parent44041005186b0556a06695920de842c5998851f1 (diff)
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@collabora.com> (cherry picked from commit 094f8dfc3d349c34063bcee48d9b75328cf341b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96415
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/gdiimpl.cxx18
1 files changed, 18 insertions, 0 deletions
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)
{