From ebd684486903021f3bd1434474876667d4430c97 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 5 Feb 2016 12:11:16 +0000 Subject: ok non-zeroed empty extents is legitimate after all Change-Id: Ida1e27322bad5d2d36ae4217bb84187a022ebadf --- vcl/headless/svpgdi.cxx | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'vcl/headless') diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 9c9de7450afc..b0f8de8269d0 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1271,21 +1271,15 @@ cairo_user_data_key_t* SvpSalGraphics::getDamageKey() void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const basegfx::B2DRange& rExtents) const { - sal_Int32 nExtentsLeft; - sal_Int32 nExtentsTop; - sal_Int32 nExtentsRight; - sal_Int32 nExtentsBottom; - if (rExtents.isEmpty()) { - nExtentsLeft = 0; - nExtentsTop = 0; - nExtentsRight = 0; - nExtentsBottom = 0; - } else { - nExtentsLeft = rExtents.getMinX(); - nExtentsTop = rExtents.getMinY(); - nExtentsRight = rExtents.getMaxX(); - nExtentsBottom = rExtents.getMaxY(); + if (rExtents.isEmpty()) + { + //nothing changed, return early + cairo_destroy(cr); + return; } + + sal_Int32 nExtentsLeft(rExtents.getMinX()), nExtentsTop(rExtents.getMinY()); + sal_Int32 nExtentsRight(rExtents.getMaxX()), nExtentsBottom(rExtents.getMaxY()); sal_Int32 nWidth = cairo_image_surface_get_width(m_pSurface); sal_Int32 nHeight = cairo_image_surface_get_height(m_pSurface); nExtentsLeft = std::max(nExtentsLeft, 0); -- cgit