diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-01-06 09:04:41 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-01-06 14:49:31 +0000 |
commit | 498f0208f55a5b9ce8a130c940ddfcb9c36d6ff9 (patch) | |
tree | 3ac40e6a641fc1c5078e2e6f61009cc379a7de74 /vcl/headless | |
parent | e8d18b471ea5063bc0b2c94afc1b94017e8e66bc (diff) |
move drawPolyLine into CairoCommon and reuse from X11CairoSalGraphicsImpl
Change-Id: I141b12c99825c67e4698d53633a1fa720cc487be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145136
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/headless')
-rw-r--r-- | vcl/headless/CairoCommon.cxx | 14 | ||||
-rw-r--r-- | vcl/headless/SvpGraphicsBackend.cxx | 16 |
2 files changed, 21 insertions, 9 deletions
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index 0779cb65c564..b0c7b505f7cc 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -791,6 +791,20 @@ bool CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, return true; } +void CairoCommon::drawPolyLine(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, + bool bAntiAlias, sal_uInt32 nPoints, const Point* pPtAry) +{ + basegfx::B2DPolygon aPoly; + aPoly.append(basegfx::B2DPoint(pPtAry->getX(), pPtAry->getY()), nPoints); + for (sal_uInt32 i = 1; i < nPoints; ++i) + aPoly.setB2DPoint(i, basegfx::B2DPoint(pPtAry[i].getX(), pPtAry[i].getY())); + aPoly.setClosed(false); + + drawPolyLine(cr, pExtents, rLineColor, bAntiAlias, basegfx::B2DHomMatrix(), aPoly, 0.0, 1.0, + nullptr, basegfx::B2DLineJoin::Miter, css::drawing::LineCap_BUTT, + basegfx::deg2rad(15.0) /*default*/, false); +} + bool CairoCommon::drawPolyLine(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor, bool bAntiAlias, const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolygon& rPolyLine, double fTransparency, diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index bf79416d88b7..134c9fc221e0 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -209,16 +209,14 @@ void SvpGraphicsBackend::implDrawRect(double nX, double nY, double nWidth, doubl void SvpGraphicsBackend::drawPolyLine(sal_uInt32 nPoints, const Point* pPtAry) { - basegfx::B2DPolygon aPoly; - aPoly.append(basegfx::B2DPoint(pPtAry->getX(), pPtAry->getY()), nPoints); - for (sal_uInt32 i = 1; i < nPoints; ++i) - aPoly.setB2DPoint(i, basegfx::B2DPoint(pPtAry[i].getX(), pPtAry[i].getY())); - aPoly.setClosed(false); + cairo_t* cr = m_rCairoCommon.getCairoContext(false, getAntiAlias()); + basegfx::B2DRange aExtents; + m_rCairoCommon.clipRegion(cr); - drawPolyLine(basegfx::B2DHomMatrix(), aPoly, 0.0, 1.0, - nullptr, // MM01 - basegfx::B2DLineJoin::Miter, css::drawing::LineCap_BUTT, - basegfx::deg2rad(15.0) /*default*/, false); + CairoCommon::drawPolyLine(cr, &aExtents, *m_rCairoCommon.m_oLineColor, getAntiAlias(), nPoints, + pPtAry); + + m_rCairoCommon.releaseCairoContext(cr, false, aExtents); } void SvpGraphicsBackend::drawPolygon(sal_uInt32 nPoints, const Point* pPtAry) |