summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit/BitmapExTest.cxx
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-01-15 14:49:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-16 10:07:07 +0100
commit63a68064bb33f180b8a231f7524d99405d910226 (patch)
tree7ecf05b057c5ca4d80a48af045998a4b34484561 /vcl/qa/cppunit/BitmapExTest.cxx
parentd534a4c7b45ff254b339e806c6a11f13d9ff0043 (diff)
make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place, and add a clang plugin to detect when the value passed to the existing constructor may contain transparency/alpha data. i.e. we leave expressions like Color(0xffffff) alone, but warn about any non-constant expression, and any expression like Color(0xff000000) Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/qa/cppunit/BitmapExTest.cxx')
-rw-r--r--vcl/qa/cppunit/BitmapExTest.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/vcl/qa/cppunit/BitmapExTest.cxx b/vcl/qa/cppunit/BitmapExTest.cxx
index 5e18b990f77d..5e0fe1dddfc6 100644
--- a/vcl/qa/cppunit/BitmapExTest.cxx
+++ b/vcl/qa/cppunit/BitmapExTest.cxx
@@ -37,17 +37,18 @@ void BitmapExTest::testGetPixelColor24_8()
Bitmap aBitmap(Size(3, 3), 24);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0x00, 0x00, 0xFF, 0x00));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
}
AlphaMask aMask(Size(3, 3));
{
AlphaScopedWriteAccess pWriteAccess(aMask);
- pWriteAccess->Erase(Color(0x00, 0xAA, 0xAA, 0xAA));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA));
}
BitmapEx aBitmapEx(aBitmap, aMask);
- CPPUNIT_ASSERT_EQUAL(Color(0xAA, 0x00, 0xFF, 0x00), aBitmapEx.GetPixelColor(0, 0));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00),
+ aBitmapEx.GetPixelColor(0, 0));
}
void BitmapExTest::testGetPixelColor32()
@@ -61,12 +62,13 @@ void BitmapExTest::testGetPixelColor32()
Bitmap aBitmap(Size(3, 3), 32);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0xAA, 0x00, 0xFF, 0x00));
+ pWriteAccess->Erase(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00));
}
BitmapEx aBitmapEx(aBitmap);
- CPPUNIT_ASSERT_EQUAL(Color(0xAA, 0x00, 0xFF, 0x00), aBitmapEx.GetPixelColor(0, 0));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00),
+ aBitmapEx.GetPixelColor(0, 0));
}
void BitmapExTest::testTransformBitmapEx()