From c69d4edf61a2647ba8d6104c743e5f2d2cbc4229 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 23 Apr 2020 16:24:17 +0200 Subject: fix tick marks in Draw with Skia (tdf#132334) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I815fba5ae637a64fe381eb9e47632117bebfd81b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92790 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- vcl/skia/gdiimpl.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 378d51d1cf9f..2ffd68dee132 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -642,7 +642,11 @@ void SkiaSalGraphicsImpl::privateDrawAlphaRect(long nX, long nY, long nWidth, lo { 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(); -- cgit