vcl/headless/svpgdi.cxx | 11 ++++++++--- vcl/inc/headless/svpgdi.hxx | 1 + vcl/unx/generic/gdi/salgdi.cxx | 15 +-------------- 3 files changed, 10 insertions(+), 17 deletions(-)
New commits: commit f9de5f7ea0130a9bad889f9702ac311d6be3deb6 Author: Caolán McNamara <[email protected]> Date: Fri Jun 1 13:06:44 2018 +0100 share the cairo clipping code Change-Id: I2dc8f55fd2612b5fc4440b46ee3184341fd56859 Reviewed-on: https://gerrit.libreoffice.org/55180 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 8bc15fb861dc..4b5050420e7a 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -489,12 +489,12 @@ bool SvpSalGraphics::drawTransformedBitmap( return true; } -void SvpSalGraphics::clipRegion(cairo_t* cr) +void SvpSalGraphics::clipRegion(cairo_t* cr, const vcl::Region& rClipRegion) { RectangleVector aRectangles; - if (!m_aClipRegion.IsEmpty()) + if (!rClipRegion.IsEmpty()) { - m_aClipRegion.GetRegionRectangles(aRectangles); + rClipRegion.GetRegionRectangles(aRectangles); } if (!aRectangles.empty()) { @@ -506,6 +506,11 @@ void SvpSalGraphics::clipRegion(cairo_t* cr) } } +void SvpSalGraphics::clipRegion(cairo_t* cr) +{ + SvpSalGraphics::clipRegion(cr, m_aClipRegion); +} + bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency) { cairo_t* cr = getCairoContext(false); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 37ae2822bf53..c5a0639498ca 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -96,6 +96,7 @@ public: cairo_surface_t* getSurface() const { return m_pSurface; } static cairo_user_data_key_t* getDamageKey(); + static void clipRegion(cairo_t* cr, const vcl::Region& rClipRegion); static basegfx::B2DRange drawPolyLine( cairo_t* cr, const Color& rLineColor, diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index dd09e8d3c62b..e09766c1e598 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -690,20 +690,7 @@ bool X11SalGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon& rOrigPolyPo #if ENABLE_CAIRO_CANVAS void X11SalGraphics::clipRegion(cairo_t* cr) { - if(!maClipRegion.IsEmpty()) - { - RectangleVector aRectangles; - maClipRegion.GetRegionRectangles(aRectangles); - - if (!aRectangles.empty()) - { - for (auto const& rectangle : aRectangles) - { - cairo_rectangle(cr, rectangle.Left(), rectangle.Top(), rectangle.GetWidth(), rectangle.GetHeight()); - } - cairo_clip(cr); - } - } + SvpSalGraphics::clipRegion(cr, maClipRegion); } #endif // ENABLE_CAIRO_CANVAS _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
