summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2017-08-29 16:33:49 -0400
committerDerek Sollenberger <djsollen@google.com>2017-08-30 12:47:08 -0400
commit579317d4eb9648845f6f45bfbea2a98fa7813de4 (patch)
tree337ee0b9714502fef23f6d1451acd0ff5f5775a7 /libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp
parentfbedb22745b1a6ca74990fa8e10dbbd62318c0a5 (diff)
Avoid performing the pathOp for clipped shadows if possible.
Bug: 64487466 Test: SystemUiJankTests#testRecentAppsFling Change-Id: I2ca96bd6adba299cd31e12f005b2529c559740d2
Diffstat (limited to 'libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp')
-rw-r--r--libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp
index 374d364787de..c8207bc70dd4 100644
--- a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp
+++ b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp
@@ -163,28 +163,22 @@ void EndReorderBarrierDrawable::drawShadow(SkCanvas* canvas, RenderNodeDrawable*
hwuiMatrix.copyTo(shadowMatrix);
canvas->concat(shadowMatrix);
- const SkPath* casterOutlinePath = casterProperties.getOutline().getPath();
- // holds temporary SkPath to store the result of intersections
- SkPath tmpPath;
- const SkPath* casterPath = casterOutlinePath;
+ // default the shadow-casting path to the outline of the caster
+ const SkPath* casterPath = casterProperties.getOutline().getPath();
+
+ // intersect the shadow-casting path with the clipBounds, if present
+ if (clippedToBounds && !casterClipRect.contains(casterPath->getBounds())) {
+ casterPath = caster->getRenderNode()->getClippedOutline(casterClipRect);
+ }
- // TODO: In to following course of code that calculates the final shape, is there an optimal
- // of doing the Op calculations?
// intersect the shadow-casting path with the reveal, if present
+ SkPath tmpPath; // holds temporary SkPath to store the result of intersections
if (revealClipPath) {
Op(*casterPath, *revealClipPath, kIntersect_SkPathOp, &tmpPath);
tmpPath.setIsVolatile(true);
casterPath = &tmpPath;
}
- // intersect the shadow-casting path with the clipBounds, if present
- if (clippedToBounds) {
- SkPath clipBoundsPath;
- clipBoundsPath.addRect(casterClipRect);
- Op(*casterPath, clipBoundsPath, kIntersect_SkPathOp, &tmpPath);
- tmpPath.setIsVolatile(true);
- casterPath = &tmpPath;
- }
const Vector3 lightPos = SkiaPipeline::getLightCenter();
SkPoint3 skiaLightPos = SkPoint3::Make(lightPos.x, lightPos.y, lightPos.z);
SkPoint3 zParams;