Skip to content

Commit

Permalink
maAlphaMask in BitmapEx should be AlphaMask
Browse files Browse the repository at this point in the history
Change-Id: I12dd1881c2896ab2970a0d149048a36d1aee9c9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145243
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
  • Loading branch information
grandinj authored and Noel Grandin committed Jan 12, 2023
1 parent 2173424 commit c68606c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
4 changes: 2 additions & 2 deletions include/vcl/bitmapex.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -462,7 +462,7 @@ private:
void loadFromIconTheme( const OUString& rIconName );

Bitmap maBitmap;
Bitmap maAlphaMask;
AlphaMask maAlphaMask;
Size maBitmapSize;
};

Expand Down
5 changes: 3 additions & 2 deletions vcl/qa/cppunit/canvasbitmaptest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand Down
17 changes: 3 additions & 14 deletions vcl/source/bitmap/BitmapEx.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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() )
Expand Down Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit c68606c

Please sign in to comment.