diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-09-01 21:59:50 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-09-02 12:43:25 +0200 |
commit | 2e3111838b7fc27065138850cafbb0f0e606d6f3 (patch) | |
tree | fe834de069e6b46c988cf9bad4c1ee92b6793e85 /vcl/qa | |
parent | 44fd4f1aacdd9a77fd4f5d2d1d300d3c73c35861 (diff) |
handle properly cleared bitmap used as alpha for Skia (tdf#136171)
Change-Id: I2c9e5d58247d5fd85aac539728fa857462785090
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101895
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/BackendTest.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx index 7a9cf89fceaf..45793434dd1b 100644 --- a/vcl/qa/cppunit/BackendTest.cxx +++ b/vcl/qa/cppunit/BackendTest.cxx @@ -549,6 +549,31 @@ public: CPPUNIT_ASSERT_EQUAL(COL_WHITE, device->GetPixel(Point(51, 20))); } + void testTdf136171() + { + // Create virtual device with alpha. + ScopedVclPtr<VirtualDevice> device + = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); + device->SetOutputSizePixel(Size(10, 10)); + device->SetBackground(Wallpaper(COL_WHITE)); + device->Erase(); + Bitmap bitmap(Size(10, 10), 24); + bitmap.Erase(COL_BLUE); + basegfx::B2DHomMatrix matrix; + matrix.scale(bitmap.GetSizePixel().Width(), + bitmap.GetSizePixel().Height()); // draw as 10x10 + // Draw a blue bitmap to the device. The bug was that there was no alpha, but OutputDevice::DrawTransformBitmapExDirect() + // supplied a fully opaque alpha done with Erase() on the alpha bitmap, and Skia backend didn't handle such alpha correctly. + device->DrawTransformedBitmapEx(matrix, BitmapEx(bitmap)); + exportDevice("/tmp/tdf136171.png", device); + // The whole virtual device content now should be blue. + CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(0, 0))); + CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(9, 0))); + CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(0, 9))); + CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(9, 9))); + CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(4, 4))); + } + CPPUNIT_TEST_SUITE(BackendTest); CPPUNIT_TEST(testDrawRectWithRectangle); CPPUNIT_TEST(testDrawRectWithPixel); @@ -602,6 +627,7 @@ public: CPPUNIT_TEST(testDashedLine); CPPUNIT_TEST(testTdf124848); + CPPUNIT_TEST(testTdf136171); CPPUNIT_TEST_SUITE_END(); }; |