summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-12-02 01:27:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-02 01:27:26 +0000
commitef124887c616d03cf0a689d2b7d5b1894405d12e (patch)
treeeda6c9f10b7d7391b3e4e73075de480067373675 /libs/hwui
parent93b429247673bb8e019fe9d39b46700fc86c3313 (diff)
parentfaa79ff9d964de940660d2226d5b06ded9294597 (diff)
downloadframeworks_base-ef124887c616d03cf0a689d2b7d5b1894405d12e.zip
frameworks_base-ef124887c616d03cf0a689d2b7d5b1894405d12e.tar.gz
frameworks_base-ef124887c616d03cf0a689d2b7d5b1894405d12e.tar.bz2
Merge "Clip outline to View clip bounds for shadow computation" into lmp-mr1-dev
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/RenderNode.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index bbba2dd..810e487 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -680,13 +680,32 @@ void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T&
float casterAlpha = properties().getAlpha() * properties().getOutline().getAlpha();
+
+ // holds temporary SkPath to store the result of intersections
+ SkPath* frameAllocatedPath = NULL;
const SkPath* outlinePath = casterOutlinePath;
+
+ // intersect the outline with the reveal clip, if present
if (revealClipPath) {
- // if we can't simply use the caster's path directly, create a temporary one
- SkPath* frameAllocatedPath = handler.allocPathForFrame();
+ frameAllocatedPath = handler.allocPathForFrame();
+
+ Op(*outlinePath, *revealClipPath, kIntersect_PathOp, frameAllocatedPath);
+ outlinePath = frameAllocatedPath;
+ }
+
+ // intersect the outline with the clipBounds, if present
+ if (properties().getClippingFlags() & CLIP_TO_CLIP_BOUNDS) {
+ if (!frameAllocatedPath) {
+ frameAllocatedPath = handler.allocPathForFrame();
+ }
+
+ Rect clipBounds;
+ properties().getClippingRectForFlags(CLIP_TO_CLIP_BOUNDS, &clipBounds);
+ SkPath clipBoundsPath;
+ clipBoundsPath.addRect(clipBounds.left, clipBounds.top,
+ clipBounds.right, clipBounds.bottom);
- // intersect the outline with the convex reveal clip
- Op(*casterOutlinePath, *revealClipPath, kIntersect_PathOp, frameAllocatedPath);
+ Op(*outlinePath, clipBoundsPath, kIntersect_PathOp, frameAllocatedPath);
outlinePath = frameAllocatedPath;
}