From e1f3120ce83c113d7dc91b60f50344f63f1c41f0 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 10 Apr 2024 16:20:09 +0200 Subject: [PATCH] vcl: return earlier if size is empty Change-Id: I96bcd47d93e0e4d05e33d3ad3eca86c6edcf87ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165950 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Xisco Fauli --- vcl/source/bitmap/BitmapTools.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index ee0134a90010..2330483bb98b 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -376,6 +376,12 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, ::basegfx::B2DRectangle const & rDestRect, ::basegfx::B2DHomMatrix const & rLocalTransform ) { + const Size aDestBmpSize( ::basegfx::fround( rDestRect.getWidth() ), + ::basegfx::fround( rDestRect.getHeight() ) ); + + if( aDestBmpSize.IsEmpty() ) + return BitmapEx(); + const Size aBmpSize( rBitmap.GetSizePixel() ); Bitmap aSrcBitmap( rBitmap.GetBitmap() ); Bitmap aSrcAlpha; @@ -416,12 +422,6 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap, } // else: mapping table is not used - const Size aDestBmpSize( ::basegfx::fround( rDestRect.getWidth() ), - ::basegfx::fround( rDestRect.getHeight() ) ); - - if( aDestBmpSize.IsEmpty() ) - return BitmapEx(); - Bitmap aDstBitmap(aDestBmpSize, aSrcBitmap.getPixelFormat(), &pReadAccess->GetPalette()); Bitmap aDstAlpha( AlphaMask( aDestBmpSize ).GetBitmap() );