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-27 17:45:10 +0200 |
commit | 1e533f69f0c3a9a2136ea5d46b884145703ad637 (patch) | |
tree | 730aee349186eb99d5594c74206ea227ed4ec087 /vcl | |
parent | fa7ebc82bbcee15cd75b42d1e7b8ef66ed719225 (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.
Change-Id: Ib1feebab2d14f4450fee0afe96afcea906965fdb
Reviewed-on: https://gerrit.libreoffice.org/56534
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'vcl')
-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 8deae07a3b77..bc29e6be7255 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -1785,7 +1785,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(); } |