use AlphaMask for variables when calling GetAlphaMask

Right now this doesn't make any difference, since Bitmap is the
superclass of AlphaMask.
But when I switch to using alpha instead of transparency, passing
AlphaMask around is going to mean something different to passing plain
Bitmap around.

Change-Id: Ic1541e5f0a3b97331793cd23e23115faa7f382b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151463
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-05-07 20:17:16 +02:00
parent 918012d94c
commit 1c7cbd6856
8 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -3944,7 +3944,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
pDevice->EnableMapMode(false);
BitmapEx aBmpEx = pDevice->GetBitmapEx({ 0, 0 }, { nCanvasWidth, nCanvasHeight });
Bitmap aBmp = aBmpEx.GetBitmap();
Bitmap aAlpha = aBmpEx.GetAlphaMask();
AlphaMask aAlpha = aBmpEx.GetAlphaMask();
Bitmap::ScopedReadAccess sraBmp(aBmp);
Bitmap::ScopedReadAccess sraAlpha(aAlpha);
@@ -257,7 +257,7 @@ namespace drawinglayer::primitive2d
case Disposal::Not:
{
maVirtualDevice->DrawBitmapEx(rAnimationFrame.maPositionPixel, rAnimationFrame.maBitmapEx);
Bitmap aAlphaMask = rAnimationFrame.maBitmapEx.GetAlphaMask();
AlphaMask aAlphaMask = rAnimationFrame.maBitmapEx.GetAlphaMask();
if (aAlphaMask.IsEmpty())
{
@@ -277,7 +277,7 @@ namespace drawinglayer::primitive2d
case Disposal::Back:
{
// #i70772# react on no mask, for primitives, too.
const Bitmap & rMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
const AlphaMask & rMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
const Bitmap & rContent(rAnimationFrame.maBitmapEx.GetBitmap());
maVirtualDeviceMask->Erase();
+2 -2
View File
@@ -366,7 +366,7 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
if( !pBmpAcc )
return;
Bitmap aMask( aBmpEx.GetAlphaMask() );
AlphaMask aMask( aBmpEx.GetAlphaMask() );
BitmapReadAccess* pMskAcc = !aMask.IsEmpty() ? aMask.AcquireReadAccess() : nullptr;
const tools::Long nWidth = pBmpAcc->Width();
const tools::Long nHeight = pBmpAcc->Height();
@@ -380,7 +380,7 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
if( !pMskAcc )
{
aMask = Bitmap(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256));
aMask.Erase( COL_BLACK );
aMask.Erase( 0 );
pMskAcc = aMask.AcquireReadAccess();
}
@@ -283,7 +283,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
{
pVDev->DrawBitmapEx(rAnimationFrame.maPositionPixel,
rAnimationFrame.maBitmapEx);
Bitmap aMask = rAnimationFrame.maBitmapEx.GetAlphaMask();
AlphaMask aMask = rAnimationFrame.maBitmapEx.GetAlphaMask();
if( aMask.IsEmpty() )
{
+1 -1
View File
@@ -242,7 +242,7 @@ bool GIFWriter::CreateAccess( const BitmapEx& rBmpEx )
{
if( bStatus )
{
Bitmap aMask( rBmpEx.GetAlphaMask() );
AlphaMask aMask( rBmpEx.GetAlphaMask() );
aAccBmp = rBmpEx.GetBitmap();
bTransparent = false;
+4 -4
View File
@@ -819,7 +819,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
Bitmap aBitmap( aBitmapEx.GetBitmap() );
if ( mbGrayScale )
aBitmap.Convert( BmpConversion::N8BitGreys );
Bitmap aMask( aBitmapEx.GetAlphaMask() );
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
Point aPoint( static_cast<const MetaBmpExAction*>(pMA)->GetPoint() );
Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) );
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
@@ -832,7 +832,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
Bitmap aBitmap( aBitmapEx.GetBitmap() );
if ( mbGrayScale )
aBitmap.Convert( BmpConversion::N8BitGreys );
Bitmap aMask( aBitmapEx.GetAlphaMask() );
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
Point aPoint = static_cast<const MetaBmpExScaleAction*>(pMA)->GetPoint();
Size aSize( static_cast<const MetaBmpExScaleAction*>(pMA)->GetSize() );
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
@@ -847,7 +847,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
Bitmap aBitmap( aBitmapEx.GetBitmap() );
if ( mbGrayScale )
aBitmap.Convert( BmpConversion::N8BitGreys );
Bitmap aMask( aBitmapEx.GetAlphaMask() );
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
Point aPoint = static_cast<const MetaBmpExScalePartAction*>(pMA)->GetDestPoint();
Size aSize = static_cast<const MetaBmpExScalePartAction*>(pMA)->GetDestSize();
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
@@ -907,7 +907,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
// gradient action
}
Bitmap aMask( aBitmapEx.GetAlphaMask() );
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
ImplBmp( &aBitmap, &aMask, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
}
else
+3 -3
View File
@@ -1294,7 +1294,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
{
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction *>(pAction);
Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
Bitmap aMsk( pA->GetBitmapEx().GetAlphaMask() );
AlphaMask aMsk( pA->GetBitmapEx().GetAlphaMask() );
if( !aMsk.IsEmpty() )
{
@@ -1312,7 +1312,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
{
const MetaBmpExScaleAction* pA = static_cast<const MetaBmpExScaleAction*>(pAction);
Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
Bitmap aMsk( pA->GetBitmapEx().GetAlphaMask() );
AlphaMask aMsk( pA->GetBitmapEx().GetAlphaMask() );
if( !aMsk.IsEmpty() )
{
@@ -1332,7 +1332,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
BitmapEx aBmpEx( pA->GetBitmapEx() );
aBmpEx.Crop( tools::Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
Bitmap aBmp( aBmpEx.GetBitmap() );
Bitmap aMsk( aBmpEx.GetAlphaMask() );
AlphaMask aMsk( aBmpEx.GetAlphaMask() );
if( !aMsk.IsEmpty() )
{
+3 -3
View File
@@ -1245,7 +1245,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
{
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction *>(pMA);
Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
Bitmap aMsk( pA->GetBitmapEx().GetAlphaMask() );
AlphaMask aMsk( pA->GetBitmapEx().GetAlphaMask() );
if( !aMsk.IsEmpty() )
{
@@ -1263,7 +1263,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
{
const MetaBmpExScaleAction* pA = static_cast<const MetaBmpExScaleAction*>(pMA);
Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
Bitmap aMsk( pA->GetBitmapEx().GetAlphaMask() );
AlphaMask aMsk( pA->GetBitmapEx().GetAlphaMask() );
if( !aMsk.IsEmpty() )
{
@@ -1283,7 +1283,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
BitmapEx aBmpEx( pA->GetBitmapEx() );
aBmpEx.Crop( tools::Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
Bitmap aBmp( aBmpEx.GetBitmap() );
Bitmap aMsk( aBmpEx.GetAlphaMask() );
AlphaMask aMsk( aBmpEx.GetAlphaMask() );
if( !aMsk.IsEmpty() )
{