vcl/skia/gdiimpl.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit c746693ffc1a47f668fcbb8af6f0a8ef2f1648d8 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Wed Aug 19 12:44:07 2020 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Aug 20 18:24:06 2020 +0200 ensure that polygons that are just a line are drawn by Skia (tdf#135490) Skia doesn't fill polygons that are really just a line, because they are considered empty (width or height are zero). But LO apparently requires those to be drawn, so ensure so. Change-Id: I94f090874c91472ad23993ef095550c7bdf7374a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100985 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> (cherry picked from commit 6c703220ff3d7c3931ec324143342b03858c8eea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101055 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 7b69df95936f..b27ef0c7f488 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -641,6 +641,10 @@ void SkiaSalGraphicsImpl::privateDrawAlphaRect(long nX, long nY, long nWidth, lo { paint.setColor(toSkColorWithTransparency(mFillColor, fTransparency)); paint.setStyle(SkPaint::kFill_Style); + // HACK: If the polygon is just a line, it still should be drawn. But when filling + // Skia doesn't draw empty polygons, so in that case ensure the line is drawn. + if (mLineColor == SALCOLOR_NONE && SkSize::Make(nWidth, nHeight).isEmpty()) + paint.setStyle(SkPaint::kStroke_Style); canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, nWidth, nHeight), paint); } if (mLineColor != SALCOLOR_NONE) @@ -649,7 +653,7 @@ void SkiaSalGraphicsImpl::privateDrawAlphaRect(long nX, long nY, long nWidth, lo paint.setStyle(SkPaint::kStroke_Style); // The obnoxious "-1 DrawRect()" hack that I don't understand the purpose of (and I'm not sure // if anybody does), but without it some cases do not work. The max() is needed because Skia - // will not drawn anything if width or height is 0. + // will not draw anything if width or height is 0. canvas->drawIRect( SkIRect::MakeXYWH(nX, nY, std::max(1L, nWidth - 1), std::max(1L, nHeight - 1)), paint); } @@ -751,9 +755,13 @@ void SkiaSalGraphicsImpl::performDrawPolyPolygon(const basegfx::B2DPolyPolygon& const SkScalar posFix = useAA ? toSkXYFix : 0; if (mFillColor != SALCOLOR_NONE) { + aPath.offset(toSkX(0) + posFix, toSkY(0) + posFix, nullptr); aPaint.setColor(toSkColorWithTransparency(mFillColor, fTransparency)); aPaint.setStyle(SkPaint::kFill_Style); - aPath.offset(toSkX(0) + posFix, toSkY(0) + posFix, nullptr); + // HACK: If the polygon is just a line, it still should be drawn. But when filling + // Skia doesn't draw empty polygons, so in that case ensure the line is drawn. + if (mLineColor == SALCOLOR_NONE && aPath.getBounds().isEmpty()) + aPaint.setStyle(SkPaint::kStroke_Style); getDrawCanvas()->drawPath(aPath, aPaint); } if (mLineColor != SALCOLOR_NONE) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits