From f507c28f3adbe22bbde2e07df6d094d8abedb44d Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Fri, 11 May 2018 10:48:20 -0400 Subject: Shadow fixes to avoid popping. * Make geometric shadow generation more tolerant of nearly-convex paths. * Ensure analytic and geometric shadow positions match with large blurs. Bug: skia: Change-Id: I8d3ba43b90d1520cb20f89de9f0b13d11a1a08c3 Reviewed-on: https://skia-review.googlesource.com/127045 Reviewed-by: Brian Salomon Commit-Queue: Jim Van Verth --- samplecode/SampleAndroidShadows.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'samplecode/SampleAndroidShadows.cpp') diff --git a/samplecode/SampleAndroidShadows.cpp b/samplecode/SampleAndroidShadows.cpp index a5fb6fcb9f..ee833d7939 100644 --- a/samplecode/SampleAndroidShadows.cpp +++ b/samplecode/SampleAndroidShadows.cpp @@ -281,6 +281,16 @@ protected: this->drawShadowedPath(canvas, tmpPath, zPlaneParams, paint, .1f, lightPos, kLightWidth, .5f); + // path ops bug + SkPath tmpClipPathBug; + tmpClipPathBug.addCircle(88.0344925f, 0, 60); + Op(fSquareRRectPath, tmpClipPathBug, kIntersect_SkPathOp, &tmpPath); + + canvas->translate(250, 0); + zPlaneParams.fZ = SkTMax(1.0f, 32 + fZDelta); + this->drawShadowedPath(canvas, tmpPath, zPlaneParams, paint, .1f, + lightPos, kLightWidth, .5f); + // perspective paths SkPoint pivot = SkPoint::Make(fWideRectPath.getBounds().width()/2, fWideRectPath.getBounds().height()/2); @@ -318,7 +328,7 @@ protected: } bool onAnimate(const SkAnimTimer& timer) override { - fAnimTranslate = timer.pingPong(30, 0, 200, -200); + fAnimTranslate = timer.pingPong(30, 0, 125, -125); fAnimAngle = timer.pingPong(15, 0, 0, 20); if (fDoAlphaAnimation) { fAnimAlpha = timer.pingPong(5, 0, 1, 0); -- cgit v1.2.3