fix tick marks in Draw with Skia (tdf#132334)
Change-Id: I815fba5ae637a64fe381eb9e47632117bebfd81b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92790
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 378d51d..2ffd68d 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -642,7 +642,11 @@
{
paint.setColor(toSkColorWithTransparency(mLineColor, fTransparency));
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, nWidth - 1, nHeight - 1), paint);
// 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.
canvas->drawIRect(
SkIRect::MakeXYWH(nX, nY, std::max(1L, nWidth - 1), std::max(1L, nHeight - 1)), paint);
}
addXorRegion(SkRect::MakeXYWH(nX, nY, nWidth, nHeight));
postDraw();