diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-08 13:45:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-08 17:20:48 +0100 |
commit | 6911375ab66df6fd4cb2b922ea1c9e57b4fcd3b2 (patch) | |
tree | ebe9d2610d30eda9d18b94370792e67cde6111ab /vcl | |
parent | 9cc41b9ad52e3da734ce72223946bd00bfc92d14 (diff) |
Remove BitmapColor::GetAlpha
since its implementation is completely wrong - alpha and transparency
are not the same thing, they are inverses of each other.
Change-Id: Id9e00b8296391befd471345b6c86e0493a9e3f3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108964
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/BitmapScaleTest.cxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/BitmapTest.cxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/bitmapcolor.cxx | 31 | ||||
-rw-r--r-- | vcl/source/bitmap/BitmapDisabledImageFilter.cxx | 2 | ||||
-rw-r--r-- | vcl/source/bitmap/BitmapReadAccess.cxx | 8 | ||||
-rw-r--r-- | vcl/source/bitmap/BitmapTools.cxx | 2 |
6 files changed, 24 insertions, 23 deletions
diff --git a/vcl/qa/cppunit/BitmapScaleTest.cxx b/vcl/qa/cppunit/BitmapScaleTest.cxx index 09ec8f9a3728..285799e2da52 100644 --- a/vcl/qa/cppunit/BitmapScaleTest.cxx +++ b/vcl/qa/cppunit/BitmapScaleTest.cxx @@ -64,7 +64,7 @@ void assertColorsAreSimilar(int maxDifference, const std::string& message, if (abs(expected.GetRed() - actual.GetRed()) <= maxDifference && abs(expected.GetGreen() - actual.GetGreen()) <= maxDifference && abs(expected.GetBlue() - actual.GetBlue()) <= maxDifference - && abs(expected.GetAlpha() - actual.GetAlpha()) <= maxDifference) + && abs(expected.GetTransparency() - actual.GetTransparency()) <= maxDifference) { return; } diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx index 56395358863b..c2f2b592309f 100644 --- a/vcl/qa/cppunit/BitmapTest.cxx +++ b/vcl/qa/cppunit/BitmapTest.cxx @@ -73,7 +73,7 @@ void assertColorsAreSimilar(int maxDifference, const std::string& message, if (abs(expected.GetRed() - actual.GetRed()) <= maxDifference && abs(expected.GetGreen() - actual.GetGreen()) <= maxDifference && abs(expected.GetBlue() - actual.GetBlue()) <= maxDifference - && abs(expected.GetAlpha() - actual.GetAlpha()) <= maxDifference) + && abs(expected.GetTransparency() - actual.GetTransparency()) <= maxDifference) { return; } diff --git a/vcl/qa/cppunit/bitmapcolor.cxx b/vcl/qa/cppunit/bitmapcolor.cxx index eafa4d13805c..58d889a3d8a5 100644 --- a/vcl/qa/cppunit/bitmapcolor.cxx +++ b/vcl/qa/cppunit/bitmapcolor.cxx @@ -56,7 +56,8 @@ void BitmapColorTest::defaultConstructor() CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", static_cast<sal_uInt8>(0), aBmpColor.GetRed()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(0), aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(0), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } void BitmapColorTest::colorValueConstructor() @@ -68,8 +69,8 @@ void BitmapColorTest::colorValueConstructor() CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(0), aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(0), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } { @@ -80,8 +81,8 @@ void BitmapColorTest::colorValueConstructor() aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(128), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } { @@ -92,8 +93,8 @@ void BitmapColorTest::colorValueConstructor() aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(255), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } } @@ -106,8 +107,8 @@ void BitmapColorTest::colorClassConstructor() CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(0), aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(0), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } { @@ -118,8 +119,8 @@ void BitmapColorTest::colorClassConstructor() aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(127), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } { @@ -130,8 +131,8 @@ void BitmapColorTest::colorClassConstructor() aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(255), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(0), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(0), + aBmpColor.GetTransparency()); } // Transparency / Alpha @@ -142,8 +143,8 @@ void BitmapColorTest::colorClassConstructor() CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(64), aBmpColor.GetGreen()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", static_cast<sal_uInt8>(0), aBmpColor.GetBlue()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Alpha wrong", static_cast<sal_uInt8>(255), - aBmpColor.GetAlpha()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", static_cast<sal_uInt8>(255), + aBmpColor.GetTransparency()); } } diff --git a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx index 25f32d69f0c6..47e6527953ed 100644 --- a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx +++ b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx @@ -40,7 +40,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const // Get the luminance from RGB color and remap the value from 0-255 to 160-224 const BitmapColor aColor = pRead->GetPixelFromData(pReadScan, nX); sal_uInt8 nLum(aColor.GetLuminance() / 4 + 160); - BitmapColor aGreyValue(nLum, nLum, nLum, aColor.GetAlpha()); + BitmapColor aGreyValue(nLum, nLum, nLum, aColor.GetTransparency()); pGrey->SetPixelOnData(pGreyScan, nX, aGreyValue); } } diff --git a/vcl/source/bitmap/BitmapReadAccess.cxx b/vcl/source/bitmap/BitmapReadAccess.cxx index 9b5218065a3c..29df1f28c3b6 100644 --- a/vcl/source/bitmap/BitmapReadAccess.cxx +++ b/vcl/source/bitmap/BitmapReadAccess.cxx @@ -427,7 +427,7 @@ void BitmapReadAccess::SetPixelForN32BitTcAbgr(Scanline pScanline, tools::Long n { pScanline = pScanline + nX * 4; - sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha(); + sal_uInt8 alpha = 0xFF - rBitmapColor.GetTransparency(); *pScanline++ = alpha; *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetBlue(), alpha); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetGreen(), alpha); @@ -476,7 +476,7 @@ void BitmapReadAccess::SetPixelForN32BitTcArgb(Scanline pScanline, tools::Long n { pScanline = pScanline + nX * 4; - sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha(); + sal_uInt8 alpha = 0xFF - rBitmapColor.GetTransparency(); *pScanline++ = alpha; *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetRed(), alpha); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetGreen(), alpha); @@ -525,7 +525,7 @@ void BitmapReadAccess::SetPixelForN32BitTcBgra(Scanline pScanline, tools::Long n { pScanline = pScanline + nX * 4; - sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha(); + sal_uInt8 alpha = 0xFF - rBitmapColor.GetTransparency(); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetBlue(), alpha); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetGreen(), alpha); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetRed(), alpha); @@ -574,7 +574,7 @@ void BitmapReadAccess::SetPixelForN32BitTcRgba(Scanline pScanline, tools::Long n { pScanline = pScanline + nX * 4; - sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha(); + sal_uInt8 alpha = 0xFF - rBitmapColor.GetTransparency(); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetRed(), alpha); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetGreen(), alpha); *pScanline++ = vcl::bitmap::premultiply(rBitmapColor.GetBlue(), alpha); diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 3d2ee474554f..3c654aaf6980 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -1101,7 +1101,7 @@ bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult) { const BitmapColor aColor = pReadAccess->GetPixelFromData(aReadScan, nX); BitmapColor aResultColor(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue()); - BitmapColor aResultColorAlpha(aColor.GetAlpha(), aColor.GetAlpha(), aColor.GetAlpha()); + BitmapColor aResultColorAlpha(aColor.GetTransparency(), aColor.GetTransparency(), aColor.GetTransparency()); pResultBitmapAccess->SetPixelOnData(aResultScan, nX, aResultColor); pResultAlphaAccess->SetPixelOnData(aResultScanAlpha, nX, aResultColorAlpha); |