maAlphaMask in BitmapEx should be AlphaMask

Change-Id: I12dd1881c2896ab2970a0d149048a36d1aee9c9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145243
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-01-12 06:52:55 +00:00
committed by Noel Grandin
parent 21734247d5
commit c68606ca09
3 changed files with 8 additions and 18 deletions
+2 -2
View File
@@ -67,7 +67,7 @@ public:
const Bitmap& GetBitmap() const;
bool IsAlpha() const;
AlphaMask GetAlphaMask() const;
const AlphaMask & GetAlphaMask() const { return maAlphaMask; }
const Size& GetSizePixel() const { return maBitmapSize; }
void SetSizePixel(const Size& rNewSize);
@@ -462,7 +462,7 @@ private:
void loadFromIconTheme( const OUString& rIconName );
Bitmap maBitmap;
Bitmap maAlphaMask;
AlphaMask maAlphaMask;
Size maBitmapSize;
};
+3 -2
View File
@@ -758,7 +758,8 @@ void CanvasBitmapTest::runTest()
{
Bitmap aBitmap = aBmp.GetBitmap();
BitmapReadAccess* pBmpAcc = aBitmap.AcquireReadAccess();
BitmapReadAccess* pAlphaAcc = aBmp.GetAlphaMask().AcquireReadAccess();
AlphaMask aBitmapAlpha = aBmp.GetAlphaMask();
BitmapReadAccess* pAlphaAcc = aBitmapAlpha.AcquireReadAccess();
CPPUNIT_ASSERT_MESSAGE( "Bitmap has invalid BitmapReadAccess",
pBmpAcc);
@@ -778,7 +779,7 @@ void CanvasBitmapTest::runTest()
CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) correct alpha content",
BitmapColor(253), pAlphaAcc->GetPixel(2,9));
aBmp.GetAlphaMask().ReleaseAccess(pAlphaAcc);
aBitmapAlpha.ReleaseAccess(pAlphaAcc);
Bitmap::ReleaseAccess(pBmpAcc);
}
}
+3 -14
View File
@@ -210,11 +210,6 @@ Bitmap BitmapEx::GetBitmap( Color aTransparentReplaceColor ) const
return aRetBmp;
}
AlphaMask BitmapEx::GetAlphaMask() const
{
return AlphaMask(maAlphaMask);
}
sal_Int64 BitmapEx::GetSizeBytes() const
{
sal_Int64 nSizeBytes = maBitmap.GetSizeBytes();
@@ -326,7 +321,7 @@ bool BitmapEx::Rotate( Degree10 nAngle10, const Color& rFillColor )
if( maAlphaMask.IsEmpty() )
{
maAlphaMask = Bitmap(GetSizePixel(), vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256));
maAlphaMask.Erase( COL_BLACK );
maAlphaMask.Erase( 0 );
}
if( bRet && !maAlphaMask.IsEmpty() )
@@ -459,15 +454,9 @@ bool BitmapEx::Erase( const Color& rFillColor )
{
// Respect transparency on fill color
if( rFillColor.IsTransparent() )
{
const Color aFill( 255 - rFillColor.GetAlpha(), 255 - rFillColor.GetAlpha(), 255 - rFillColor.GetAlpha() );
maAlphaMask.Erase( aFill );
}
maAlphaMask.Erase( 255 - rFillColor.GetAlpha() );
else
{
const Color aBlack( COL_BLACK );
maAlphaMask.Erase( aBlack );
}
maAlphaMask.Erase( 0 );
}
}