diff options
author | Chris Craik <ccraik@google.com> | 2014-12-02 01:39:20 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-02 01:39:20 +0000 |
commit | a22ab0da6f72b2e52166cc6e11f4c6d44c0fb714 (patch) | |
tree | 9c93658e1586d303e066fb3bd67b187a5b38cedf /libs | |
parent | 3380f4961814c0aaa23e92dca4d2999ebb254f65 (diff) | |
parent | 9a04480e36c42eb63d1d727221ba3ce6a6d533ef (diff) | |
download | frameworks_base-a22ab0da6f72b2e52166cc6e11f4c6d44c0fb714.zip frameworks_base-a22ab0da6f72b2e52166cc6e11f4c6d44c0fb714.tar.gz frameworks_base-a22ab0da6f72b2e52166cc6e11f4c6d44c0fb714.tar.bz2 |
am 9a04480e: am ef124887: Merge "Clip outline to View clip bounds for shadow computation" into lmp-mr1-dev
* commit '9a04480e36c42eb63d1d727221ba3ce6a6d533ef':
Clip outline to View clip bounds for shadow computation
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 6a27e56..a349ed6 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; } |