Loading libs/hwui/DisplayListOp.h +10 −24 Original line number Diff line number Diff line Loading @@ -1547,32 +1547,23 @@ class DrawShadowOp : public DrawOp { public: DrawShadowOp(const mat4& transformXY, const mat4& transformZ, float casterAlpha, bool casterUnclipped, float fallbackWidth, float fallbackHeight, const SkPath* outline, const SkPath* revealClip) const SkPath* casterOutline, const SkPath* revealClip) : DrawOp(NULL), mTransformXY(transformXY), mTransformZ(transformZ), mCasterAlpha(casterAlpha), mCasterUnclipped(casterUnclipped), mFallbackWidth(fallbackWidth), mFallbackHeight(fallbackHeight), mOutline(outline), mRevealClip(revealClip) {} virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { SkPath casterPerimeter; if (!mOutline || mOutline->isEmpty()) { casterPerimeter.addRect(0, 0, mFallbackWidth, mFallbackHeight); } else { casterPerimeter = *mOutline; } if (mRevealClip) { mCasterAlpha(casterAlpha), mCasterUnclipped(casterUnclipped) { mOutline = *casterOutline; if (revealClip) { // intersect the outline with the convex reveal clip Op(casterPerimeter, *mRevealClip, kIntersect_PathOp, &casterPerimeter); Op(mOutline, *revealClip, kIntersect_PathOp, &mOutline); } } virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { return renderer.drawShadow(mTransformXY, mTransformZ, mCasterAlpha, mCasterUnclipped, &casterPerimeter); mCasterAlpha, mCasterUnclipped, &mOutline); } virtual void output(int level, uint32_t logFlags) const { OP_LOG("DrawShadow of outline %p", mOutline); OP_LOGS("DrawShadow"); } virtual const char* name() { return "DrawShadow"; } Loading @@ -1582,12 +1573,7 @@ private: const mat4 mTransformZ; const float mCasterAlpha; const bool mCasterUnclipped; const float mFallbackWidth; const float mFallbackHeight; // these point at convex SkPaths owned by RenderProperties, or null const SkPath* mOutline; const SkPath* mRevealClip; SkPath mOutline; }; class DrawLayerOp : public DrawOp { Loading libs/hwui/Outline.h +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ public: mBounds.set(outline->getBounds()); } bool isEmpty() const { return mType == kOutlineType_None; } void setEmpty() { mType = kOutlineType_None; mPath.reset(); Loading libs/hwui/RenderNode.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -473,7 +473,7 @@ void RenderNode::buildZSortedChildList(Vector<ZDrawDisplayListOpPair>& zTranslat template <class T> void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler) { if (properties().getAlpha() <= 0.0f) return; if (properties().getAlpha() <= 0.0f || properties().getOutline().isEmpty()) return; mat4 shadowMatrixXY(transformFromParent); applyViewPropertyTransforms(shadowMatrixXY); Loading @@ -487,6 +487,8 @@ void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& const SkPath* revealClipPath = revealClip.hasConvexClip() ? revealClip.getPath() : NULL; // only pass the reveal clip's path if it's convex if (revealClipPath && revealClipPath->isEmpty()) return; /** * The drawing area of the caster is always the same as the its perimeter (which * the shadow system uses) *except* in the inverse clip case. Inform the shadow Loading @@ -498,7 +500,6 @@ void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& DisplayListOp* shadowOp = new (handler.allocator()) DrawShadowOp( shadowMatrixXY, shadowMatrixZ, properties().getAlpha(), casterUnclipped, properties().getWidth(), properties().getHeight(), outlinePath, revealClipPath); handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } Loading Loading
libs/hwui/DisplayListOp.h +10 −24 Original line number Diff line number Diff line Loading @@ -1547,32 +1547,23 @@ class DrawShadowOp : public DrawOp { public: DrawShadowOp(const mat4& transformXY, const mat4& transformZ, float casterAlpha, bool casterUnclipped, float fallbackWidth, float fallbackHeight, const SkPath* outline, const SkPath* revealClip) const SkPath* casterOutline, const SkPath* revealClip) : DrawOp(NULL), mTransformXY(transformXY), mTransformZ(transformZ), mCasterAlpha(casterAlpha), mCasterUnclipped(casterUnclipped), mFallbackWidth(fallbackWidth), mFallbackHeight(fallbackHeight), mOutline(outline), mRevealClip(revealClip) {} virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { SkPath casterPerimeter; if (!mOutline || mOutline->isEmpty()) { casterPerimeter.addRect(0, 0, mFallbackWidth, mFallbackHeight); } else { casterPerimeter = *mOutline; } if (mRevealClip) { mCasterAlpha(casterAlpha), mCasterUnclipped(casterUnclipped) { mOutline = *casterOutline; if (revealClip) { // intersect the outline with the convex reveal clip Op(casterPerimeter, *mRevealClip, kIntersect_PathOp, &casterPerimeter); Op(mOutline, *revealClip, kIntersect_PathOp, &mOutline); } } virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { return renderer.drawShadow(mTransformXY, mTransformZ, mCasterAlpha, mCasterUnclipped, &casterPerimeter); mCasterAlpha, mCasterUnclipped, &mOutline); } virtual void output(int level, uint32_t logFlags) const { OP_LOG("DrawShadow of outline %p", mOutline); OP_LOGS("DrawShadow"); } virtual const char* name() { return "DrawShadow"; } Loading @@ -1582,12 +1573,7 @@ private: const mat4 mTransformZ; const float mCasterAlpha; const bool mCasterUnclipped; const float mFallbackWidth; const float mFallbackHeight; // these point at convex SkPaths owned by RenderProperties, or null const SkPath* mOutline; const SkPath* mRevealClip; SkPath mOutline; }; class DrawLayerOp : public DrawOp { Loading
libs/hwui/Outline.h +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ public: mBounds.set(outline->getBounds()); } bool isEmpty() const { return mType == kOutlineType_None; } void setEmpty() { mType = kOutlineType_None; mPath.reset(); Loading
libs/hwui/RenderNode.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -473,7 +473,7 @@ void RenderNode::buildZSortedChildList(Vector<ZDrawDisplayListOpPair>& zTranslat template <class T> void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler) { if (properties().getAlpha() <= 0.0f) return; if (properties().getAlpha() <= 0.0f || properties().getOutline().isEmpty()) return; mat4 shadowMatrixXY(transformFromParent); applyViewPropertyTransforms(shadowMatrixXY); Loading @@ -487,6 +487,8 @@ void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& const SkPath* revealClipPath = revealClip.hasConvexClip() ? revealClip.getPath() : NULL; // only pass the reveal clip's path if it's convex if (revealClipPath && revealClipPath->isEmpty()) return; /** * The drawing area of the caster is always the same as the its perimeter (which * the shadow system uses) *except* in the inverse clip case. Inform the shadow Loading @@ -498,7 +500,6 @@ void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& DisplayListOp* shadowOp = new (handler.allocator()) DrawShadowOp( shadowMatrixXY, shadowMatrixZ, properties().getAlpha(), casterUnclipped, properties().getWidth(), properties().getHeight(), outlinePath, revealClipPath); handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } Loading