diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-27 16:50:38 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-28 13:46:26 +0200 |
commit | b879a01a5ef568065f113fb7da19be0720a1a478 (patch) | |
tree | 5cd2c4615be60e7b037c5a8454740931bad940ec | |
parent | e87b6121c5c26bf9d6fd0e29ac7d8480b24d1870 (diff) |
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@collabora.co.uk>
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 36 |
1 files changed, 35 insertions, 1 deletions
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(); } |