diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-11-18 16:30:52 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-11-19 21:45:14 +0100 |
commit | 5b292e878703ebc32e875406f4116cba145a9042 (patch) | |
tree | f8cfaccf81e8a990931be2487c5f612e001892d7 /vcl/qa | |
parent | a6a2855818585740d8291a669c3552a7c4e77480 (diff) |
avoid Skia floating point position fixups for rectangles (tdf#137329)
Avoid to toSkX()/toSkY() tweaks for rectangular areas, so with AA
enabled it leads to fuzzy edges, and rectangles should line up
perfectly with all pixels even without tweaks.
Change-Id: I45bf5a57a9f2d941eb7ec224992fc452481a2f98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106060
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/skia/skia.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/skia/skia.cxx b/vcl/qa/cppunit/skia/skia.cxx index d13e1530f95e..1f04c5825584 100644 --- a/vcl/qa/cppunit/skia/skia.cxx +++ b/vcl/qa/cppunit/skia/skia.cxx @@ -35,6 +35,7 @@ public: void testInterpretAs8Bit(); void testAlphaBlendWith(); void testBitmapCopyOnWrite(); + void testTdf137329(); CPPUNIT_TEST_SUITE(SkiaTest); CPPUNIT_TEST(testBitmapErase); @@ -42,6 +43,7 @@ public: CPPUNIT_TEST(testInterpretAs8Bit); CPPUNIT_TEST(testAlphaBlendWith); CPPUNIT_TEST(testBitmapCopyOnWrite); + CPPUNIT_TEST(testTdf137329); CPPUNIT_TEST_SUITE_END(); private: @@ -303,6 +305,27 @@ void SkiaTest::testBitmapCopyOnWrite() CPPUNIT_ASSERT(bitmap.unittestGetAlphaImage() != oldAlphaImage); } +void SkiaTest::testTdf137329() +{ + // Draw a filled polygon in the entire device, with AA enabled. + // All pixels in the device should be black, even those at edges (i.e. not affected by AA). + ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT); + device->SetOutputSizePixel(Size(10, 10)); + device->SetBackground(Wallpaper(COL_WHITE)); + device->SetAntialiasing(AntialiasingFlags::Enable); + device->Erase(); + device->SetLineColor(); + device->SetFillColor(COL_BLACK); + device->DrawPolyPolygon( + basegfx::B2DPolyPolygon(basegfx::B2DPolygon{ { 0, 0 }, { 10, 0 }, { 10, 10 }, { 0, 10 } })); + // savePNG("/tmp/tdf137329.png", device); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, device->GetPixel(Point(0, 0))); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, device->GetPixel(Point(9, 0))); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, device->GetPixel(Point(9, 9))); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, device->GetPixel(Point(0, 9))); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, device->GetPixel(Point(4, 4))); +} + } // namespace CPPUNIT_TEST_SUITE_REGISTRATION(SkiaTest); |