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>
This commit is contained in:
parent
7b137e5c7b
commit
120070f252
1 changed files with 18 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue