diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-23 17:31:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-07-24 09:15:12 +0200 |
commit | d33a73a2f8a17d7e399ddab0da96e83aab009e55 (patch) | |
tree | 4bb6fe6fa3debaa109bc07b75f03b631a9a5930e | |
parent | 16ddff7dcadfa1c062d9388e76a10583f6d33722 (diff) |
Related: tdf#126227 factor out setting the polygon path
this change should have no visual effect
Change-Id: Id93519e6b74e2c9bc4ddf20e7ab903689d7d8ee3
Reviewed-on: https://gerrit.libreoffice.org/76197
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/headless/svpgdi.cxx | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index b0e4c40cc5fa..18b9c88cc905 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1377,6 +1377,45 @@ bool SvpSalGraphics::drawPolyPolygonBezier( sal_uInt32, return false; } +namespace +{ + void add_polygon_path(cairo_t* cr, const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DHomMatrix& rObjectToDevice, bool bPixelSnap) + { + // try to access buffered data + std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath( + rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>()); + + if(pSystemDependentData_CairoPath) + { + // re-use data + cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath()); + } + else + { + // create data + for (const auto & rPoly : rPolyPolygon) + { + // PixelOffset used: Was dependent of 'm_aLineColor != SALCOLOR_NONE' + // Adapt setupPolyPolygon-users to set a linear transformation to achieve PixelOffset + AddPolygonToPath( + cr, + rPoly, + rObjectToDevice, + bPixelSnap, + false); + } + + // copy and add to buffering mechanism + // for decisions how/what to buffer, see Note in WinSalGraphicsImpl::drawPolyPolygon + pSystemDependentData_CairoPath = rPolyPolygon.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>( + ImplGetSystemDependentDataManager(), + cairo_copy_path(cr), + false, + false); + } + } +} + bool SvpSalGraphics::drawPolyPolygon( const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolyPolygon& rPolyPolygon, @@ -1409,38 +1448,7 @@ bool SvpSalGraphics::drawPolyPolygon( cairo_set_matrix(cr, &aMatrix); } - // try to access buffered data - std::shared_ptr<SystemDependentData_CairoPath> pSystemDependentData_CairoPath( - rPolyPolygon.getSystemDependentData<SystemDependentData_CairoPath>()); - - if(pSystemDependentData_CairoPath) - { - // re-use data - cairo_append_path(cr, pSystemDependentData_CairoPath->getCairoPath()); - } - else - { - // create data - for (const auto & rPoly : rPolyPolygon) - { - // PixelOffset used: Was dependent of 'm_aLineColor != SALCOLOR_NONE' - // Adapt setupPolyPolygon-users to set a linear transformation to achieve PixelOffset - AddPolygonToPath( - cr, - rPoly, - rObjectToDevice, - !getAntiAliasB2DDraw(), - false); - } - - // copy and add to buffering mechanism - // for decisions how/what to buffer, see Note in WinSalGraphicsImpl::drawPolyPolygon - pSystemDependentData_CairoPath = rPolyPolygon.addOrReplaceSystemDependentData<SystemDependentData_CairoPath>( - ImplGetSystemDependentDataManager(), - cairo_copy_path(cr), - false, - false); - } + add_polygon_path(cr, rPolyPolygon, rObjectToDevice, !getAntiAliasB2DDraw()); // To make releaseCairoContext work, use empty extents basegfx::B2DRange extents; |