vcl/source/outdev/bitmap.cxx | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-)
New commits: commit 0308304366bf1874365b7472ff567411a05550c7 Author: Christopher Sherlock <chris.sherloc...@gmail.com> AuthorDate: Thu Aug 14 22:13:50 2025 +1000 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Sep 16 09:01:17 2025 +0200 vcl: flatten OutputDevice::GetBitmap() We don't need to use the bClipped variable - instead, we return the clipped bitmap if possible. If clipping wasn't possible, then it just falls back to the code that would have run anyway. Change-Id: Ia4c1e567d7fcfc19916aec515aee942e9d42bb15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189601 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index c91908cf2548..73ff0181eb73 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -172,7 +172,6 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const if ( nWidth <= 0 || nHeight <= 0 || nX > (mnOutWidth + mnOutOffX) || nY > (mnOutHeight + mnOutOffY)) return Bitmap(); - Bitmap aBmp; tools::Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) ); bool bClipped = false; @@ -208,8 +207,6 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const if (bClipped) { - bClipped = false; - // If the visible part has been clipped, we have to create a // Bitmap with the correct size in which we copy the clipped // Bitmap to the correct position. @@ -232,27 +229,23 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const OSL_ENSURE(false, "CopyBits with zero or negative width or height"); } - aBmp = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() ); - - bClipped = true; + return aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() ); } } } - if ( !bClipped ) - { - std::shared_ptr<SalBitmap> pSalBmp; - // if we are a virtual device, we might need to remove the unused alpha channel - bool bWithoutAlpha = false; - if (OUTDEV_VIRDEV == GetOutDevType()) - bWithoutAlpha = static_cast<const VirtualDevice*>(this)->IsWithoutAlpha(); - pSalBmp = mpGraphics->GetBitmap( nX, nY, nWidth, nHeight, *this, bWithoutAlpha ); - - if( pSalBmp ) - { - aBmp.ImplSetSalBitmap(pSalBmp); - } - } + std::shared_ptr<SalBitmap> pSalBmp; + // if we are a virtual device, we might need to remove the unused alpha channel + bool bWithoutAlpha = false; + if (OUTDEV_VIRDEV == GetOutDevType()) + bWithoutAlpha = static_cast<const VirtualDevice*>(this)->IsWithoutAlpha(); + + pSalBmp = mpGraphics->GetBitmap( nX, nY, nWidth, nHeight, *this, bWithoutAlpha ); + + Bitmap aBmp; + + if( pSalBmp ) + aBmp.ImplSetSalBitmap(pSalBmp); return aBmp; }