summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/android_view_RenderNode.cpp10
-rw-r--r--libs/hwui/Outline.h22
2 files changed, 24 insertions, 8 deletions
diff --git a/core/jni/android_view_RenderNode.cpp b/core/jni/android_view_RenderNode.cpp
index 6e95be9efc3a..a3b370017a8e 100644
--- a/core/jni/android_view_RenderNode.cpp
+++ b/core/jni/android_view_RenderNode.cpp
@@ -484,13 +484,13 @@ static JNINativeMethod gMethods[] = {
{ "nSetProjectBackwards", "!(JZ)Z", (void*) android_view_RenderNode_setProjectBackwards },
{ "nSetProjectionReceiver","!(JZ)Z", (void*) android_view_RenderNode_setProjectionReceiver },
- { "nSetOutlineRoundRect", "(JIIIIFF)Z", (void*) android_view_RenderNode_setOutlineRoundRect },
- { "nSetOutlineConvexPath", "(JJF)Z", (void*) android_view_RenderNode_setOutlineConvexPath },
- { "nSetOutlineEmpty", "(J)Z", (void*) android_view_RenderNode_setOutlineEmpty },
- { "nSetOutlineNone", "(J)Z", (void*) android_view_RenderNode_setOutlineNone },
+ { "nSetOutlineRoundRect", "!(JIIIIFF)Z", (void*) android_view_RenderNode_setOutlineRoundRect },
+ { "nSetOutlineConvexPath", "!(JJF)Z", (void*) android_view_RenderNode_setOutlineConvexPath },
+ { "nSetOutlineEmpty", "!(J)Z", (void*) android_view_RenderNode_setOutlineEmpty },
+ { "nSetOutlineNone", "!(J)Z", (void*) android_view_RenderNode_setOutlineNone },
{ "nHasShadow", "!(J)Z", (void*) android_view_RenderNode_hasShadow },
{ "nSetClipToOutline", "!(JZ)Z", (void*) android_view_RenderNode_setClipToOutline },
- { "nSetRevealClip", "(JZFFF)Z", (void*) android_view_RenderNode_setRevealClip },
+ { "nSetRevealClip", "!(JZFFF)Z", (void*) android_view_RenderNode_setRevealClip },
{ "nSetAlpha", "!(JF)Z", (void*) android_view_RenderNode_setAlpha },
{ "nSetHasOverlappingRendering", "!(JZ)Z",
diff --git a/libs/hwui/Outline.h b/libs/hwui/Outline.h
index c98932cf095e..8d4d4f085f98 100644
--- a/libs/hwui/Outline.h
+++ b/libs/hwui/Outline.h
@@ -33,13 +33,29 @@ public:
, mAlpha(0.0f) {}
void setRoundRect(int left, int top, int right, int bottom, float radius, float alpha) {
+ mAlpha = alpha;
+ if (mType == kOutlineType_RoundRect
+ && left == mBounds.left
+ && right == mBounds.right
+ && top == mBounds.top
+ && bottom == mBounds.bottom
+ && radius == mRadius) {
+ // nothing to change, don't do any work
+ return;
+ }
+
mType = kOutlineType_RoundRect;
mBounds.set(left, top, right, bottom);
mRadius = radius;
+
+ // update mPath to reflect new outline
mPath.reset();
- mPath.addRoundRect(SkRect::MakeLTRB(left, top, right, bottom),
- radius, radius);
- mAlpha = alpha;
+ if (MathUtils::isPositive(radius)) {
+ mPath.addRoundRect(SkRect::MakeLTRB(left, top, right, bottom),
+ radius, radius);
+ } else {
+ mPath.addRect(left, top, right, bottom);
+ }
}
void setConvexPath(const SkPath* outline, float alpha) {