vcl/skia/gdiimpl.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) New commits: commit bb1ce025ae6479bc3044197f25990d8c41ae09de Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Mon Sep 2 09:58:53 2024 -0400 Commit: Patrick Luby <guibomac...@gmail.com> CommitDate: Mon Sep 2 19:15:01 2024 +0200
tdf#162646 suppress drawing hairlines when scaling Previously, drawing hairlines (i.e. zero line width) was only suppressed when running unit tests. But drawing hairlines causes unexpected shifting of the lines when using a Retina display on macOS and antialiasing is disabled. Change-Id: I6e788099c110862afc1f7a085dfac4a2908ca51b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172742 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomac...@gmail.com> diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 290483d3aa80..f4e4a2550003 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1105,9 +1105,18 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev // Adjust line width for object-to-device scale. fLineWidth = (rObjectToDevice * basegfx::B2DVector(fLineWidth, 0)).getLength(); +#ifdef MACOSX + // tdf#162646 suppressing drawing hairlines when scaling + // Previously, drawing of hairlines (i.e. zero line width) was only + // suppressed when running unit tests. But drawing hairlines causes + // unexpected shifting of the lines when using a Retina display on + // macOS and antialiasing is disabled. + if (fLineWidth == 0 && mScaling != 1 && (isUnitTestRunning() || !mParent.getAntiAlias())) +#else // On HiDPI displays, do not draw hairlines, draw 1-pixel wide lines in order to avoid // smoothing that would confuse unittests. if (fLineWidth == 0 && mScaling != 1 && isUnitTestRunning()) +#endif fLineWidth = 1; // this will be scaled by mScaling // Transform to DeviceCoordinates, get DeviceLineWidth, execute PixelSnapHairline