diff options
| author | 2014-08-07 17:27:30 -0700 | |
|---|---|---|
| committer | 2014-08-08 00:52:54 +0000 | |
| commit | 7466986d2055eb8711f36a85ac539b1572ffe805 (patch) | |
| tree | 6c560d37db0e9f709e8b3114c126423ce99488fc /libs/hwui/RenderNode.cpp | |
| parent | f06009542390472872da986486d385001e91a2a7 (diff) | |
Fix leak of SkPathRefs
bug:15939479
SkPath objects owned by DisplayListOps weren't being torn down, and
thus weren't releasing their SkPathRef innards.
Change-Id: I2581e124600a93a399ef3251f456c02ab52839a8
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
| -rw-r--r-- | libs/hwui/RenderNode.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index f48b774a41fa..23940eea9fea 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -534,6 +534,7 @@ public: inline void endMark() {} inline int level() { return mLevel; } inline int replayFlags() { return mDeferStruct.mReplayFlags; } + inline SkPath* allocPathForFrame() { return mDeferStruct.allocPathForFrame(); } private: DeferStateStruct& mDeferStruct; @@ -564,6 +565,7 @@ public: } inline int level() { return mLevel; } inline int replayFlags() { return mReplayStruct.mReplayFlags; } + inline SkPath* allocPathForFrame() { return mReplayStruct.allocPathForFrame(); } private: ReplayStateStruct& mReplayStruct; @@ -612,14 +614,24 @@ void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& mat4 shadowMatrixZ(transformFromParent); applyViewPropertyTransforms(shadowMatrixZ, true); - const SkPath* outlinePath = properties().getOutline().getPath(); + const SkPath* casterOutlinePath = properties().getOutline().getPath(); const SkPath* revealClipPath = properties().getRevealClip().getPath(); if (revealClipPath && revealClipPath->isEmpty()) return; float casterAlpha = properties().getAlpha() * properties().getOutline().getAlpha(); + + const SkPath* outlinePath = casterOutlinePath; + if (revealClipPath) { + // if we can't simply use the caster's path directly, create a temporary one + SkPath* frameAllocatedPath = handler.allocPathForFrame(); + + // intersect the outline with the convex reveal clip + Op(*casterOutlinePath, *revealClipPath, kIntersect_PathOp, frameAllocatedPath); + outlinePath = frameAllocatedPath; + } + DisplayListOp* shadowOp = new (handler.allocator()) DrawShadowOp( - shadowMatrixXY, shadowMatrixZ, casterAlpha, - outlinePath, revealClipPath); + shadowMatrixXY, shadowMatrixZ, casterAlpha, outlinePath); handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } |