Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -10214,7 +10214,9 @@ package android.graphics { public final class Outline { ctor public Outline(); ctor public Outline(android.graphics.Outline); method public boolean canClip(); method public boolean isValid(); method public void reset(); method public void set(android.graphics.Outline); method public void setConvexPath(android.graphics.Path); method public void setOval(int, int, int, int); core/java/android/view/RenderNode.java +5 −0 Original line number Diff line number Diff line Loading @@ -387,6 +387,10 @@ public class RenderNode { nSetClipToOutline(mNativeRenderNode, clipToOutline); } public boolean getClipToOutline() { return nGetClipToOutline(mNativeRenderNode); } /** * Controls the RenderNode's circular reveal clip. */ Loading Loading @@ -919,6 +923,7 @@ public class RenderNode { private static native void nSetAnimationMatrix(long renderNode, long animationMatrix); private static native boolean nHasOverlappingRendering(long renderNode); private static native boolean nGetClipToOutline(long renderNode); private static native float nGetAlpha(long renderNode); private static native float nGetLeft(long renderNode); private static native float nGetTop(long renderNode); Loading core/java/android/view/View.java +11 −4 Original line number Diff line number Diff line Loading @@ -10696,9 +10696,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mRenderNode.setOutline(mOutline); } // TODO: remove public final boolean getClipToOutline() { return false; } public void setClipToOutline(boolean clipToOutline) {} public final boolean getClipToOutline() { return mRenderNode.getClipToOutline(); } public void setClipToOutline(boolean clipToOutline) { // TODO: add a fast invalidation here if (getClipToOutline() != clipToOutline) { mRenderNode.setClipToOutline(clipToOutline); } } private void queryOutlineFromBackgroundIfUndefined() { if ((mPrivateFlags3 & PFLAG3_OUTLINE_DEFINED) == 0) { Loading @@ -10707,7 +10714,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mOutline = new Outline(); } else { //invalidate outline, to ensure background calculates it mOutline.set(null); mOutline.reset(); } if (mBackground.getOutline(mOutline)) { if (!mOutline.isValid()) { Loading core/jni/android_view_RenderNode.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -285,6 +285,12 @@ static jboolean android_view_RenderNode_hasOverlappingRendering(JNIEnv* env, return renderNode->stagingProperties().hasOverlappingRendering(); } static jboolean android_view_RenderNode_getClipToOutline(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getOutline().getShouldClip(); } static jfloat android_view_RenderNode_getAlpha(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); Loading Loading @@ -505,6 +511,7 @@ static JNINativeMethod gMethods[] = { { "nOffsetTopAndBottom", "(JF)V", (void*) android_view_RenderNode_offsetTopAndBottom }, { "nHasOverlappingRendering", "(J)Z", (void*) android_view_RenderNode_hasOverlappingRendering }, { "nGetClipToOutline", "(J)Z", (void*) android_view_RenderNode_getClipToOutline }, { "nGetAlpha", "(J)F", (void*) android_view_RenderNode_getAlpha }, { "nGetLeft", "(J)F", (void*) android_view_RenderNode_getLeft }, { "nGetTop", "(J)F", (void*) android_view_RenderNode_getTop }, Loading graphics/java/android/graphics/Outline.java +30 −20 Original line number Diff line number Diff line Loading @@ -53,8 +53,7 @@ public final class Outline { set(src); } /** @hide */ public void markInvalid() { public void reset() { mRadius = 0; mRect = null; mPath = null; Loading @@ -74,12 +73,7 @@ public final class Outline { * * @param src Source outline to copy from. */ public void set(@Nullable Outline src) { if (src == null) { mRadius = 0; mRect = null; mPath = null; } else { public void set(@NonNull Outline src) { if (src.mPath != null) { if (mPath == null) { mPath = new Path(); Loading @@ -95,7 +89,6 @@ public final class Outline { } mRadius = src.mRadius; } } /** * Sets the Outline to the rounded rect defined by the input rect, and corner radius. Loading Loading @@ -134,6 +127,11 @@ public final class Outline { * Sets the outline to the oval defined by input rect. */ public void setOval(int left, int top, int right, int bottom) { if ((bottom - top) == (right - left)) { // represent circle as round rect, for efficiency, and to enable clipping setRoundRect(left, top, right, bottom, (bottom - top) / 2.0f); return; } mRect = null; if (mPath == null) mPath = new Path(); mPath.reset(); Loading @@ -160,4 +158,16 @@ public final class Outline { mRadius = -1.0f; mPath.set(convexPath); } /** * Returns whether the outline can be used to clip a View. * * Currently, only outlines that can be represented as a rectangle, circle, or round rect * support clipping. * * @see {@link View#setClipToOutline(boolean)} */ public boolean canClip() { return mRect != null; } } Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -10214,7 +10214,9 @@ package android.graphics { public final class Outline { ctor public Outline(); ctor public Outline(android.graphics.Outline); method public boolean canClip(); method public boolean isValid(); method public void reset(); method public void set(android.graphics.Outline); method public void setConvexPath(android.graphics.Path); method public void setOval(int, int, int, int);
core/java/android/view/RenderNode.java +5 −0 Original line number Diff line number Diff line Loading @@ -387,6 +387,10 @@ public class RenderNode { nSetClipToOutline(mNativeRenderNode, clipToOutline); } public boolean getClipToOutline() { return nGetClipToOutline(mNativeRenderNode); } /** * Controls the RenderNode's circular reveal clip. */ Loading Loading @@ -919,6 +923,7 @@ public class RenderNode { private static native void nSetAnimationMatrix(long renderNode, long animationMatrix); private static native boolean nHasOverlappingRendering(long renderNode); private static native boolean nGetClipToOutline(long renderNode); private static native float nGetAlpha(long renderNode); private static native float nGetLeft(long renderNode); private static native float nGetTop(long renderNode); Loading
core/java/android/view/View.java +11 −4 Original line number Diff line number Diff line Loading @@ -10696,9 +10696,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mRenderNode.setOutline(mOutline); } // TODO: remove public final boolean getClipToOutline() { return false; } public void setClipToOutline(boolean clipToOutline) {} public final boolean getClipToOutline() { return mRenderNode.getClipToOutline(); } public void setClipToOutline(boolean clipToOutline) { // TODO: add a fast invalidation here if (getClipToOutline() != clipToOutline) { mRenderNode.setClipToOutline(clipToOutline); } } private void queryOutlineFromBackgroundIfUndefined() { if ((mPrivateFlags3 & PFLAG3_OUTLINE_DEFINED) == 0) { Loading @@ -10707,7 +10714,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mOutline = new Outline(); } else { //invalidate outline, to ensure background calculates it mOutline.set(null); mOutline.reset(); } if (mBackground.getOutline(mOutline)) { if (!mOutline.isValid()) { Loading
core/jni/android_view_RenderNode.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -285,6 +285,12 @@ static jboolean android_view_RenderNode_hasOverlappingRendering(JNIEnv* env, return renderNode->stagingProperties().hasOverlappingRendering(); } static jboolean android_view_RenderNode_getClipToOutline(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getOutline().getShouldClip(); } static jfloat android_view_RenderNode_getAlpha(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); Loading Loading @@ -505,6 +511,7 @@ static JNINativeMethod gMethods[] = { { "nOffsetTopAndBottom", "(JF)V", (void*) android_view_RenderNode_offsetTopAndBottom }, { "nHasOverlappingRendering", "(J)Z", (void*) android_view_RenderNode_hasOverlappingRendering }, { "nGetClipToOutline", "(J)Z", (void*) android_view_RenderNode_getClipToOutline }, { "nGetAlpha", "(J)F", (void*) android_view_RenderNode_getAlpha }, { "nGetLeft", "(J)F", (void*) android_view_RenderNode_getLeft }, { "nGetTop", "(J)F", (void*) android_view_RenderNode_getTop }, Loading
graphics/java/android/graphics/Outline.java +30 −20 Original line number Diff line number Diff line Loading @@ -53,8 +53,7 @@ public final class Outline { set(src); } /** @hide */ public void markInvalid() { public void reset() { mRadius = 0; mRect = null; mPath = null; Loading @@ -74,12 +73,7 @@ public final class Outline { * * @param src Source outline to copy from. */ public void set(@Nullable Outline src) { if (src == null) { mRadius = 0; mRect = null; mPath = null; } else { public void set(@NonNull Outline src) { if (src.mPath != null) { if (mPath == null) { mPath = new Path(); Loading @@ -95,7 +89,6 @@ public final class Outline { } mRadius = src.mRadius; } } /** * Sets the Outline to the rounded rect defined by the input rect, and corner radius. Loading Loading @@ -134,6 +127,11 @@ public final class Outline { * Sets the outline to the oval defined by input rect. */ public void setOval(int left, int top, int right, int bottom) { if ((bottom - top) == (right - left)) { // represent circle as round rect, for efficiency, and to enable clipping setRoundRect(left, top, right, bottom, (bottom - top) / 2.0f); return; } mRect = null; if (mPath == null) mPath = new Path(); mPath.reset(); Loading @@ -160,4 +158,16 @@ public final class Outline { mRadius = -1.0f; mPath.set(convexPath); } /** * Returns whether the outline can be used to clip a View. * * Currently, only outlines that can be represented as a rectangle, circle, or round rect * support clipping. * * @see {@link View#setClipToOutline(boolean)} */ public boolean canClip() { return mRect != null; } }