summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-01-20 11:32:33 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-01-20 13:21:26 +0100
commit161d533adf3c2ba1321c0fb0adf863eb766fb5ae (patch)
tree2b797466ec8a4a806cc344008f07f0481411f800 /vcl
parent1d3c6a61a7bf61018d1325cd9b1664a8e9d44c61 (diff)
tweak Skia raster line drawing
At least according to visualbackendtest it works best with 0.25 offset, although it's still not perfect, but the test at least passes this way. Change-Id: I15fdc39c91399efaae41ce7c10635028faf0486d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87060 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/gdiimpl.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 9e513290f959..1475d7cabde8 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -542,7 +542,11 @@ void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
SkPaint paint;
paint.setColor(toSkColor(mLineColor));
paint.setAntiAlias(mParent.getAntiAliasB2DDraw());
- getDrawCanvas()->drawLine(toSkX(nX1), toSkY(nY1), toSkX(nX2), toSkY(nY2), paint);
+ // Raster has better results if shifted by 0.25 (unlike the 0.5 done by toSkX/toSkY).
+ if (!isGPU())
+ getDrawCanvas()->drawLine(nX1 + 0.25, nY1 + 0.25, nX2 + 0.25, nY2 + 0.25, paint);
+ else
+ getDrawCanvas()->drawLine(toSkX(nX1), toSkY(nY1), toSkX(nX2), toSkY(nY2), paint);
if (mXorMode) // limit xor area update
mXorExtents = SkRect::MakeLTRB(nX1, nY1, nX2 + 1, nY2 + 1);
postDraw();
@@ -656,7 +660,10 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo
}
if (mLineColor != SALCOLOR_NONE)
{
- if (isGPU()) // Apply the same adjustment as toSkX()/toSkY() do.
+ // Raster has better results if shifted by 0.25 (unlike the 0.5 done by toSkX/toSkY).
+ if (!isGPU())
+ aPath.offset(0.25, 0.25, nullptr);
+ else // Apply the same adjustment as toSkX()/toSkY() do.
aPath.offset(0.5, 0.5, nullptr);
aPaint.setColor(toSkColorWithTransparency(mLineColor, fTransparency));
aPaint.setStyle(SkPaint::kStroke_Style);