summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-11-18 12:10:36 +0100
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:17 +0100
commitc019d96dddaa7abc13cc94299dff6a858c50e58f (patch)
tree1b6a88c49d76566e029fbceef5d9db404fb98dfd
parented270e4755727da81ee16d210d24575885abc6b7 (diff)
make sure Skia invert with TrackFrame doesn't paint outside
According to Tomaž that's a requirement and that is what the test for it tests. This is easy to implement with additional clipping. Change-Id: Ia54489e20ce58ae0624183f2989036e6938cd44f
-rw-r--r--vcl/qa/cppunit/BackendTest.cxx3
-rw-r--r--vcl/skia/gdiimpl.cxx5
2 files changed, 6 insertions, 2 deletions
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 6dfda5d02d35..1090c33b73e0 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -465,8 +465,7 @@ public:
CPPUNIT_TEST(testDrawInvertWithRectangle);
CPPUNIT_TEST(testDrawInvertN50WithRectangle);
- // AFAIK this test (itself) is broken.
- // CPPUNIT_TEST(testDrawInvertTrackFrameWithRectangle);
+ CPPUNIT_TEST(testDrawInvertTrackFrameWithRectangle);
CPPUNIT_TEST(testDrawBezierWithPolylineB2D);
CPPUNIT_TEST(testDrawBezierAAWithPolylineB2D);
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 948c85df72e4..271f1a61321c 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -920,6 +920,11 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl
SkPath aPath;
addPolygonToPath(rPoly, aPath);
aPath.setFillType(SkPath::kEvenOdd_FillType);
+ // TrackFrame is not supposed to paint outside of the polygon (usually rectangle),
+ // but wider stoke width usually results in that, so ensure the requirement
+ // by clipping.
+ SkAutoCanvasRestore autoRestore(mSurface->getCanvas(), true);
+ mSurface->getCanvas()->clipRect(aPath.getBounds(), SkClipOp::kIntersect, false);
SkPaint aPaint;
aPaint.setStrokeWidth(2);
float intervals[] = { 4.0f, 4.0f };