diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-09-29 09:42:14 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-09-30 11:38:37 +0200 |
commit | 6b709ad5d46dc33f29ec28183cea40cf9e77e2af (patch) | |
tree | 5d43b248f42543c88862a84c5283969dc63e3f59 /vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | |
parent | 09c24681a3414092fde50ec0f617c9f7c79e8a61 (diff) |
fix DrawDeviceAlphaBitmap() with mirroring (tdf#136223)
It turns out even the slow path was broken, so make it work (a hack,
but it's already slow anyway, and apparently not used often).
Also make the fast paths work directly, even with manual mirroring
it should be still faster.
Change-Id: Id798351f349e9906e85c1685f269df98a1b833b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103595
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx')
-rw-r--r-- | vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index d13696571a9e..b6bd724910b8 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -101,6 +101,22 @@ void BitmapRenderTest::testTdf113918() CPPUNIT_ASSERT(aColor.GetGreen() > 100); } +#if defined(_WIN32) || defined(MACOSX) || defined(IOS) + +namespace +{ +int deltaColor(BitmapColor aColor1, BitmapColor aColor2) +{ + int deltaR = std::abs(aColor1.GetRed() - aColor2.GetRed()); + int deltaG = std::abs(aColor1.GetGreen() - aColor2.GetGreen()); + int deltaB = std::abs(aColor1.GetBlue() - aColor2.GetBlue()); + + return std::max(std::max(deltaR, deltaG), deltaB); +} +} + +#endif + void BitmapRenderTest::testDrawAlphaBitmapEx() { ScopedVclPtrInstance<VirtualDevice> pVDev; @@ -141,28 +157,14 @@ void BitmapRenderTest::testDrawAlphaBitmapEx() CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0xFF, 0xFF), pVDev->GetPixel(Point(0, 0))); CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0xFF, 0x00), pVDev->GetPixel(Point(1, 1))); -// sometimes on Windows we get rounding error in blending so let's ignore this on Windows for now. -#if !defined(_WIN32) +#if defined(_WIN32) || defined(MACOSX) || defined(IOS) + // sometimes on Windows we get rounding error in blending so let's ignore this on Windows for now. + CPPUNIT_ASSERT_LESS(2, deltaColor(Color(0x00, 0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2)))); +#else CPPUNIT_ASSERT_EQUAL(Color(0x00, 0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2))); #endif } -#ifdef _WIN32 - -namespace -{ -int deltaColor(BitmapColor aColor1, BitmapColor aColor2) -{ - int deltaR = std::abs(aColor1.GetRed() - aColor2.GetRed()); - int deltaG = std::abs(aColor1.GetGreen() - aColor2.GetGreen()); - int deltaB = std::abs(aColor1.GetBlue() - aColor2.GetBlue()); - - return std::max(std::max(deltaR, deltaG), deltaB); -} -} - -#endif - void BitmapRenderTest::testAlphaVirtualDevice() { // Create an alpha virtual device |