diff options
author | Noel Grandin <noel@peralex.com> | 2021-02-27 15:50:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-26 12:51:58 +0200 |
commit | ddd2639a482befb4a3bf1f75a88e66c21a691b67 (patch) | |
tree | 2d2a2a0695dce2b8b065f107368ef0412807fa73 /vcl/qa/cppunit | |
parent | 9c4e0c35d70659097b235028047efcb80dcfb10d (diff) |
drop mask from BitmapEx
So that we have fewer cases to deal with when we transition to
32-bit bitmaps.
(*) rename maMask to maAlphaMask, since now it is only being used
for alpha duties.
(*) drop mbAlpha and mbTransparent to simplify state management,
the only thing we need to check for alpha is if maAlphaMask is
non-empty.
Change-Id: I06252e38e950e846a94b4c2ba8ea763be17801fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111679
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/qa/cppunit')
-rw-r--r-- | vcl/qa/cppunit/canvasbitmaptest.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index a1185ab1f7ad..d77599e7b8a4 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -102,7 +102,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, sal_Int32(200), xBmp->getSize().Height); CPPUNIT_ASSERT_EQUAL_MESSAGE( "alpha state mismatch", - aContainedBmpEx.IsTransparent(), bool(xBmp->hasAlpha())); + aContainedBmpEx.IsAlpha(), bool(xBmp->hasAlpha())); CPPUNIT_ASSERT_MESSAGE( "getScaledBitmap() failed", xBmp->getScaledBitmap( geometry::RealSize2D(500,500), false ).is()); @@ -111,7 +111,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, uno::Sequence<sal_Int8> aPixelData = xBmp->getData(aLayout, geometry::IntegerRectangle2D(0,0,1,1)); const sal_Int32 nExpectedBitsPerPixel( - (aContainedBmpEx.IsTransparent() ? std::max(8,nDepth)+8 : nDepth) + extraBpp); + (aContainedBmpEx.IsAlpha() ? std::max(8,nDepth)+8 : nDepth) + extraBpp); CPPUNIT_ASSERT_EQUAL_MESSAGE( "# scanlines not 1", static_cast<sal_Int32>(1), aLayout.ScanLines); CPPUNIT_ASSERT_EQUAL_MESSAGE( "# scanline bytes mismatch", @@ -164,7 +164,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, "First pixel is not white", 1.0, pRGBStart[0].Blue, 1E-12); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Second pixel is not opaque", 1.0, pARGBStart[1].Alpha, 1E-12); - if( aContainedBmpEx.IsTransparent() ) + if( aContainedBmpEx.IsAlpha() ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( "First pixel is not fully transparent", 0.0, pARGBStart[0].Alpha); @@ -235,7 +235,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually converted green pixel", bool(aPixel3 == aPixel4)); - if( !aContainedBmpEx.IsTransparent() ) + if( !aContainedBmpEx.IsAlpha() ) { aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor ); CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually RGB-converted green pixel", @@ -675,7 +675,7 @@ void CanvasBitmapTest::runTest() checkCanvasBitmap( xBmp, "single bitmap", nDepth ); - Bitmap aMask(Size(200,200), vcl::PixelFormat::N1_BPP); + Bitmap aMask(Size(200,200), vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256)); aMask.Erase(COL_WHITE); { BitmapScopedWriteAccess pAcc(aMask); @@ -683,9 +683,9 @@ void CanvasBitmapTest::runTest() { pAcc->SetFillColor(COL_BLACK); pAcc->FillRect(tools::Rectangle(0,0,100,100)); - pAcc->SetPixel(0,0,BitmapColor(1)); + pAcc->SetPixel(0,0,BitmapColor(255)); pAcc->SetPixel(0,1,BitmapColor(0)); - pAcc->SetPixel(0,2,BitmapColor(1)); + pAcc->SetPixel(0,2,BitmapColor(255)); } } @@ -719,8 +719,8 @@ void CanvasBitmapTest::runTest() new TestBitmap( geometry::IntegerSize2D(10,10), true )); BitmapEx aBmp = vcl::unotools::bitmapExFromXBitmap(xTestBmp); - CPPUNIT_ASSERT_MESSAGE( "Palette bitmap is transparent", - !aBmp.IsTransparent()); + CPPUNIT_ASSERT_MESSAGE( "Palette bitmap is alpha", + !aBmp.IsAlpha()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bitmap does not have size (10,10)", Size(10,10), aBmp.GetSizePixel()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bitmap does not have the expected pixel format", @@ -745,8 +745,6 @@ void CanvasBitmapTest::runTest() xTestBmp.set( new TestBitmap( geometry::IntegerSize2D(10,10), false )); aBmp = vcl::unotools::bitmapExFromXBitmap(xTestBmp); - CPPUNIT_ASSERT_MESSAGE( "Palette bitmap is not transparent", - aBmp.IsTransparent()); CPPUNIT_ASSERT_MESSAGE( "Palette bitmap has no alpha", aBmp.IsAlpha()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bitmap does not have size (10,10)", |