[Libreoffice-commits] core.git: vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 20 06:32:19 UTC 2020
vcl/skia/gdiimpl.cxx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
New commits:
commit 6c703220ff3d7c3931ec324143342b03858c8eea
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Aug 19 12:44:07 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Aug 20 08:31:44 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.lunak at collabora.com>
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 95fe81ec4e34..f522e5b6a857 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -649,6 +649,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)
@@ -657,7 +661,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);
}
@@ -759,9 +763,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)
More information about the Libreoffice-commits
mailing list