summaryrefslogtreecommitdiff
path: root/vcl/opengl/gdiimpl.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-03-29 13:40:21 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-03-29 15:20:49 +0100
commit75e152a7e8f384921d4417d0fb5d2db6a6f357cb (patch)
tree9086cffceca0bd57712e9c3f0c531144af4eb64e /vcl/opengl/gdiimpl.cxx
parent6c29dbb7a1c3a04f3cbaa3dd720db482755538d7 (diff)
tdf#107966 vcl opengl: fix not drawn 1px wide polypolygons
Visible at e.g. in Calc: Format Cells/Borders/Line Styles. The problem was that first commit 2e99e4e11d33679aed674eea0d6054d16d39d6df (opengl: use MVP matrix in vertex shaders, pixel offsets, 2015-07-08) introduced the concept of pixel offsets, setting the value (implicitly) to 0 in OpenGLSalGraphicsImpl::DrawTrapezoid(), but using 0.5 in OpenGLSalGraphicsImpl::FlushLinesOrTriangles(). This is fine, but then later commit 2003076c4318511a3d621558d3b44b4e8e6c6529 (opengl: batch draw polypolygons, 2016-05-29) changed OpenGLSalGraphicsImpl::drawPolyPolygon() to use deferred drawing instead of DrawTrapezoid(), without doing any translation of the input polypolygon. This resulted in loss of those polygons when used in the above mentioned dialog, which has a listbox of bitmaps, where each line style preview is drawn on a virtual device with a height of 1px. So at the end the 1px offset meant the previews were simply missing. ('make CppunitTest_vcl_gen SAL_USE_VCLPLUGIN=gen SAL_FORCEGL=1' is needed on Linux to see the test failing without the fix.) Change-Id: Ia9f3d6e7cb38a43fe2f8a41746b538af68add43c Reviewed-on: https://gerrit.libreoffice.org/69920 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'vcl/opengl/gdiimpl.cxx')
-rw-r--r--vcl/opengl/gdiimpl.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 3a15755eb7a9..1c0d3ecc91e2 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1606,6 +1606,11 @@ bool OpenGLSalGraphicsImpl::drawPolyPolygon(
basegfx::B2DPolyPolygon aPolyPolygon(rPolyPolygon);
aPolyPolygon.transform(rObjectToDevice);
+ // FlushLinesOrTriangles() works with a 0.5 pixel offset, compensate for that here.
+ basegfx::B2DHomMatrix aMatrix;
+ aMatrix.translate(-0.5f, -0.5f);
+ aPolyPolygon.transform(aMatrix);
+
mpRenderList->addDrawPolyPolygon(
aPolyPolygon,
fTransparency,