diff options
author | Chris Craik <ccraik@google.com> | 2014-03-25 10:33:01 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-03-25 16:03:48 -0700 |
commit | 8c271ca63b62061fd22cfee78fd6a574b44476fd (patch) | |
tree | e4b6a9d863aec687273be89373d2fc432cf29c30 /core | |
parent | 5e44cadfd69c210c11f80cfe599718617a0e6676 (diff) | |
download | frameworks_base-8c271ca63b62061fd22cfee78fd6a574b44476fd.zip frameworks_base-8c271ca63b62061fd22cfee78fd6a574b44476fd.tar.gz frameworks_base-8c271ca63b62061fd22cfee78fd6a574b44476fd.tar.bz2 |
Add private circular reveal API on View/RenderNode
Change-Id: I139c8e12b354083149a665f6768f3f6931a8dd15
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/RenderNode.java | 10 | ||||
-rw-r--r-- | core/java/android/view/View.java | 13 | ||||
-rw-r--r-- | core/jni/android_view_RenderNode.cpp | 16 |
3 files changed, 38 insertions, 1 deletions
diff --git a/core/java/android/view/RenderNode.java b/core/java/android/view/RenderNode.java index 60fb7ac..6c8c3c7 100644 --- a/core/java/android/view/RenderNode.java +++ b/core/java/android/view/RenderNode.java @@ -361,6 +361,14 @@ public class RenderNode { } /** + * Controls the RenderNode's circular reveal clip. + */ + public void setRevealClip(boolean shouldClip, boolean inverseClip, + float x, float y, float radius) { + nSetRevealClip(mNativeDisplayList, shouldClip, inverseClip, x, y, radius); + } + + /** * Set the static matrix on the display list. The specified matrix is combined with other * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.) * @@ -856,6 +864,8 @@ public class RenderNode { private static native void nSetOutlineConvexPath(long displayList, long nativePath); private static native void nSetOutlineEmpty(long displayList); private static native void nSetClipToOutline(long displayList, boolean clipToOutline); + private static native void nSetRevealClip(long displayList, + boolean shouldClip, boolean inverseClip, float x, float y, float radius); private static native void nSetAlpha(long displayList, float alpha); private static native void nSetHasOverlappingRendering(long displayList, boolean hasOverlappingRendering); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5e512b6..f911066 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -33,7 +33,6 @@ import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; -import android.graphics.Path; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.PorterDuff; @@ -10883,6 +10882,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * Private API to be used for reveal animation + * + * @hide + */ + public void setRevealClip(boolean shouldClip, boolean inverseClip, + float x, float y, float radius) { + if (mDisplayList != null) { + mDisplayList.setRevealClip(shouldClip, inverseClip, x, y, radius); + } + } + + /** * Hit rectangle in parent's coordinates * * @param outRect The hit rectangle of the view. diff --git a/core/jni/android_view_RenderNode.cpp b/core/jni/android_view_RenderNode.cpp index 5c7e773..3e359d4 100644 --- a/core/jni/android_view_RenderNode.cpp +++ b/core/jni/android_view_RenderNode.cpp @@ -115,23 +115,38 @@ static void android_view_RenderNode_setOutlineRoundRect(JNIEnv* env, jint right, jint bottom, jfloat radius) { RenderNode* displayList = reinterpret_cast<RenderNode*>(displayListPtr); displayList->mutateStagingProperties().mutableOutline().setRoundRect(left, top, right, bottom, radius); + displayList->mutateStagingProperties().updateClipPath(); } + static void android_view_RenderNode_setOutlineConvexPath(JNIEnv* env, jobject clazz, jlong displayListPtr, jlong outlinePathPtr) { RenderNode* displayList = reinterpret_cast<RenderNode*>(displayListPtr); SkPath* outlinePath = reinterpret_cast<SkPath*>(outlinePathPtr); displayList->mutateStagingProperties().mutableOutline().setConvexPath(outlinePath); + displayList->mutateStagingProperties().updateClipPath(); } + static void android_view_RenderNode_setOutlineEmpty(JNIEnv* env, jobject clazz, jlong displayListPtr) { RenderNode* displayList = reinterpret_cast<RenderNode*>(displayListPtr); displayList->mutateStagingProperties().mutableOutline().setEmpty(); + displayList->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setClipToOutline(JNIEnv* env, jobject clazz, jlong displayListPtr, jboolean clipToOutline) { RenderNode* displayList = reinterpret_cast<RenderNode*>(displayListPtr); displayList->mutateStagingProperties().mutableOutline().setShouldClip(clipToOutline); + displayList->mutateStagingProperties().updateClipPath(); +} + +static void android_view_RenderNode_setRevealClip(JNIEnv* env, + jobject clazz, jlong displayListPtr, jboolean shouldClip, jboolean inverseClip, + jfloat x, jfloat y, jfloat radius) { + RenderNode* displayList = reinterpret_cast<RenderNode*>(displayListPtr); + displayList->mutateStagingProperties().mutableRevealClip().set( + shouldClip, inverseClip, x, y, radius); + displayList->mutateStagingProperties().updateClipPath(); } static void android_view_RenderNode_setAlpha(JNIEnv* env, @@ -396,6 +411,7 @@ static JNINativeMethod gMethods[] = { { "nSetOutlineConvexPath", "(JJ)V", (void*) android_view_RenderNode_setOutlineConvexPath }, { "nSetOutlineEmpty", "(J)V", (void*) android_view_RenderNode_setOutlineEmpty }, { "nSetClipToOutline", "(JZ)V", (void*) android_view_RenderNode_setClipToOutline }, + { "nSetRevealClip", "(JZZFFF)V", (void*) android_view_RenderNode_setRevealClip }, { "nSetAlpha", "(JF)V", (void*) android_view_RenderNode_setAlpha }, { "nSetHasOverlappingRendering", "(JZ)V", |