From 97ac77f067910fa5e8206d75160fa63546a9358d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 07:03:24 +0200 Subject: Merging upstream version 4:24.2.3. Signed-off-by: Daniel Baumann --- vcl/skia/gdiimpl.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'vcl/skia/gdiimpl.cxx') diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index d7028b9598..dce3175feb 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1490,6 +1490,26 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl aPaint.setShader( aBitmap.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, SkSamplingOptions())); } + +#ifdef SK_METAL + // tdf#153306 prevent subpixel shifting of X coordinate + // HACK: for some unknown reason, if the X coordinate of the + // path's bounds is more than 1024, SkBlendMode::kExclusion will + // shift by about a half a pixel to the right with Skia/Metal on + // a Retina display. Weirdly, if the same polygon is repeatedly + // drawn, the total shift is cumulative so if the drawn polygon + // is more than a few pixels wide, the blinking cursor in Writer + // will exhibit this bug but only for one thin vertical slice at + // a time. Apparently, shifting drawing a very tiny amount to + // the left seems to be enough to quell this runaway cumulative + // X coordinate shift. + if (isGPU()) + { + SkMatrix aMatrix; + aMatrix.set(SkMatrix::kMTransX, -0.001); + getDrawCanvas()->concat(aMatrix); + } +#endif } getDrawCanvas()->drawPath(aPath, aPaint); postDraw(); -- cgit v1.2.3