vcl/source/outdev/bitmap.cxx | 64 ++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 36 deletions(-)
New commits: commit 4a6492e155d44ef51fc9a89271f857a6f987182e Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Sun Sep 24 00:42:07 2023 +1000 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Fri Oct 27 05:52:56 2023 +0200 vcl: flatten OutputDevice::BlendBitmap() Change-Id: Idb0c21dd37af81fae0fd4152f0556edb20e63b80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157190 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index d95c97e8633c..1806635593d2 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -909,8 +909,6 @@ Bitmap OutputDevice::BlendBitmap( if( !pP || !pA ) return aBmp; - Bitmap res; - if( GetBitCount() <= 8 ) { Bitmap aDither(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP); @@ -949,53 +947,47 @@ Bitmap OutputDevice::BlendBitmap( pB.reset(); pW.reset(); - res = aDither; + return aDither; } - else + + BitmapScopedWriteAccess pB(aBmp); + + bool bFastBlend = false; + if (!bHMirr && !bVMirr) { - BitmapScopedWriteAccess pB(aBmp); + SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(), + nOffX, nOffY, aOutSz.Width(), aOutSz.Height()); - bool bFastBlend = false; - if( !bHMirr && !bVMirr ) + bFastBlend = ImplFastBitmapBlending(*pB, *pP, *pA, aTR); + } + + if (!bFastBlend) + { + for (int nY = 0; nY < nDstHeight; nY++) { - SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(), - nOffX, nOffY, aOutSz.Width(), aOutSz.Height()); + tools::Long nMapY = pMapY[nY]; - bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR ); - } + if (bVMirr) + nMapY = aBmpRect.Bottom() - nMapY; - if( !bFastBlend ) - { - for( int nY = 0; nY < nDstHeight; nY++ ) + Scanline pAScan = pA->GetScanline(nMapY); + Scanline pBScan = pB->GetScanline(nY); + for(int nX = 0; nX < nDstWidth; nX++) { - tools::Long nMapY = pMapY[ nY ]; + tools::Long nMapX = pMapX[nX]; - if ( bVMirr ) - { - nMapY = aBmpRect.Bottom() - nMapY; - } - Scanline pAScan = pA->GetScanline( nMapY ); - Scanline pBScan = pB->GetScanline(nY); - for( int nX = 0; nX < nDstWidth; nX++ ) - { - tools::Long nMapX = pMapX[ nX ]; + if (bHMirr) + nMapX = aBmpRect.Right() - nMapX; - if ( bHMirr ) - { - nMapX = aBmpRect.Right() - nMapX; - } - BitmapColor aDstCol = pB->GetPixelFromData( pBScan, nX ); - aDstCol.Merge( pP->GetColor( nMapY, nMapX ), pAScan[ nMapX ] ); - pB->SetPixelOnData( pBScan, nX, aDstCol ); - } + BitmapColor aDstCol = pB->GetPixelFromData(pBScan, nX); + aDstCol.Merge(pP->GetColor(nMapY, nMapX), pAScan[nMapX]); + pB->SetPixelOnData(pBScan, nX, aDstCol); } } - - pB.reset(); - res = aBmp; } - return res; + pB.reset(); + return aBmp; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */