From 75e152a7e8f384921d4417d0fb5d2db6a6f357cb Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 29 Mar 2019 13:40:21 +0100 Subject: 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 Tested-by: Jenkins --- vcl/opengl/gdiimpl.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vcl/opengl/gdiimpl.cxx') 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, -- cgit