[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/opengl

Miklos Vajna vmiklos at collabora.co.uk
Thu Jun 28 11:46:50 UTC 2018


 vcl/opengl/gdiimpl.cxx |   36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

New commits:
commit b879a01a5ef568065f113fb7da19be0720a1a478
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jun 27 16:50:38 2018 +0200

    tdf#102960 vcl opengl: fix missing support for polygon track frames
    
    Which is used in e.g. the Calc cell border dialog. The approach is
    similar to commit 60790935cc143de49b732e93b6fb923b7669530b (tdf#96657 -
    vcl opengl: implement invert: Track Frame., 2016-01-09) but that one was
    for rectangles, this one is for polygons.
    
    (cherry picked from commit 1e533f69f0c3a9a2136ea5d46b884145703ad637)
    
    Change-Id: Ib1feebab2d14f4450fee0afe96afcea906965fdb
    Reviewed-on: https://gerrit.libreoffice.org/56580
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 6858a2adbae7..0fd1d0788eb6 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1786,7 +1786,41 @@ void OpenGLSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
     PreDraw();
 
     if( UseInvert( nFlags ) )
-        DrawPolygon( nPoints, pPtAry );
+    {
+        if (nFlags & SalInvert::TrackFrame)
+        {
+            // Track frame means the invert50FragmentShader must remain active
+            // (to draw what looks like a dashed line), so DrawLineSegment()
+            // can't be used. Draw the edge of the polygon as polygons instead.
+            for (size_t nPoint = 0; nPoint < nPoints; ++nPoint)
+            {
+                const SalPoint& rFrom = pPtAry[nPoint];
+                const SalPoint& rTo = pPtAry[(nPoint + 1) % nPoints];
+                if (rFrom.mnX == rTo.mnX)
+                {
+                    // Extend to the right, comments assuming "to" is above
+                    // "from":
+                    const SalPoint aPoints[] = { { rFrom.mnX + 1, rFrom.mnY }, // bottom right
+                                                 { rFrom.mnX, rFrom.mnY }, // bottom left
+                                                 { rTo.mnX, rTo.mnY }, // top left
+                                                 { rTo.mnX + 1, rTo.mnY } }; // top right
+                    DrawConvexPolygon(4, aPoints, true);
+                }
+                else
+                {
+                    // Otherwise can extend downwards, comments assuming "to"
+                    // is above and on the right of "from":
+                    const SalPoint aPoints[] = { { rFrom.mnX, rFrom.mnY + 1 }, // bottom left
+                                                 { rFrom.mnX, rFrom.mnY }, // top left
+                                                 { rTo.mnX, rTo.mnY }, // top right
+                                                 { rTo.mnX, rTo.mnY + 1 } }; // bottom right
+                    DrawConvexPolygon(4, aPoints, true);
+                }
+            }
+        }
+        else
+            DrawPolygon(nPoints, pPtAry);
+    }
 
     PostDraw();
 }


More information about the Libreoffice-commits mailing list