diff options
author | Oliver Bolte <obo@openoffice.org> | 2006-03-22 10:00:26 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2006-03-22 10:00:26 +0000 |
commit | b25d9b203ca4c9cc2aaaa7e791192a8a4eab3293 (patch) | |
tree | 2d81778feecad53684bbdf99533641ec480b1a22 /canvas | |
parent | c720c082e6341c0f0373ad0141e7bcdac17a0e1d (diff) |
INTEGRATION: CWS cairofixes01 (1.2.2); FILE MERGED
2006/03/02 17:40:59 radekdoulik 1.2.2.1: Issue number: 62722
Submitted by: radekdoulik
Reviewed by: radekdoulik
optimize resizing of cairo surfaces
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/cairo/cairo_devicehelper.cxx | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx index 85d9a918987d..ee76239ba0ca 100644 --- a/canvas/source/cairo/cairo_devicehelper.cxx +++ b/canvas/source/cairo/cairo_devicehelper.cxx @@ -4,9 +4,9 @@ * * $RCSfile: cairo_devicehelper.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kz $ $Date: 2006-02-28 10:35:26 $ + * last change: $Author: obo $ $Date: 2006-03-22 11:00:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -310,34 +310,39 @@ namespace cairocanvas { OSL_TRACE("set device size %d x %d", rSize.getX(), rSize.getY() ); - maSize = rSize; - if( mpWindowSurface ) { - mpWindowSurface->Unref(); - } - mpWindowSurface = new Surface( mpSysData, - mpOutputWindow->GetOutOffXPixel(), mpOutputWindow->GetOutOffYPixel(), - maSize.getX(), maSize.getY() ); + mpWindowSurface->Resize( rSize.getX() + mpOutputWindow->GetOutOffXPixel(), rSize.getY() + mpOutputWindow->GetOutOffYPixel() ); + } else + mpWindowSurface = new Surface( mpSysData, + mpOutputWindow->GetOutOffXPixel(), mpOutputWindow->GetOutOffYPixel(), + rSize.getX(), rSize.getY() ); - if( mpBufferSurface ) + if( mpBufferSurface && maSize != rSize ) { mpBufferSurface->Unref(); + mpBufferSurface = NULL; } - mpBufferSurface = mpWindowSurface->getSimilar( CAIRO_CONTENT_COLOR, maSize.getX(), maSize.getY() ); + if( !mpBufferSurface ) + mpBufferSurface = mpWindowSurface->getSimilar( CAIRO_CONTENT_COLOR, rSize.getX(), rSize.getY() ); - if( mpBufferCairo ) + if( mpBufferCairo && maSize != rSize ) { cairo_destroy( mpBufferCairo ); + mpBufferCairo = NULL; } - mpBufferCairo = mpBufferSurface->getCairo(); + if( !mpBufferCairo ) + mpBufferCairo = mpBufferSurface->getCairo(); + + if( maSize != rSize ) + maSize = rSize; mpSpriteCanvas->setSizePixel( maSize ); } const ::basegfx::B2ISize& DeviceHelper::getSizePixel() { - return maSize; + return maSize; } void DeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds ) |