vcl/skia/gdiimpl.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) New commits: commit 9845f6bde0dc0c2e4a5ee64d69be6f4c30420db3 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Mon Sep 2 09:58:53 2024 -0400 Commit: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> CommitDate: Wed Sep 4 07:55:30 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> (cherry picked from commit bb1ce025ae6479bc3044197f25990d8c41ae09de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172754 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index eaed2d7c99b7..f7a9dda2db84 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