From e1d1f92eb90d4ed9f2c4123dc33e473a67497734 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 13 Jan 2016 10:30:07 +0000 Subject: refactor to reuse Change-Id: Ifee1b845eb4c46f35a4ad0b45bf49320772e9569 --- vcl/headless/svpgdi.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'vcl') diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index d90024e08982..2ab29b142917 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1137,13 +1137,9 @@ void SvpSalGraphics::copyArea( long nDestX, copyBits(aTR, this); } -void SvpSalGraphics::copySource( const SalTwoRect& rTR, - cairo_surface_t* source ) +static cairo_rectangle_int_t renderSource(cairo_t* cr, const SalTwoRect& rTR, + cairo_surface_t* source) { - cairo_t* cr = getCairoContext(false); - assert(cr && m_aDevice->isTopDown()); - clipRegion(cr); - cairo_rectangle(cr, rTR.mnDestX, rTR.mnDestY, rTR.mnDestWidth, rTR.mnDestHeight); cairo_rectangle_int_t extents = getFillDamage(cr); @@ -1155,6 +1151,18 @@ void SvpSalGraphics::copySource( const SalTwoRect& rTR, cairo_set_source_surface(cr, source, -rTR.mnSrcX, -rTR.mnSrcY); cairo_paint(cr); + return extents; +} + +void SvpSalGraphics::copySource( const SalTwoRect& rTR, + cairo_surface_t* source ) +{ + cairo_t* cr = getCairoContext(false); + assert(cr && m_aDevice->isTopDown()); + clipRegion(cr); + + cairo_rectangle_int_t extents = renderSource(cr, rTR, source); + releaseCairoContext(cr, false, extents); } -- cgit