Loading api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -10029,6 +10029,8 @@ package android.graphics { method public boolean isValid(); method public void set(android.graphics.Outline); method public void setConvexPath(android.graphics.Path); method public void setOval(int, int, int, int); method public void setOval(android.graphics.Rect); method public void setRect(int, int, int, int); method public void setRect(android.graphics.Rect); method public void setRoundRect(int, int, int, int, float); Loading Loading @@ -10201,6 +10203,7 @@ package android.graphics { method public void addArc(android.graphics.RectF, float, float); method public void addCircle(float, float, float, android.graphics.Path.Direction); method public void addOval(android.graphics.RectF, android.graphics.Path.Direction); method public void addOval(float, float, float, float, android.graphics.Path.Direction); method public void addPath(android.graphics.Path, float, float); method public void addPath(android.graphics.Path); method public void addPath(android.graphics.Path, android.graphics.Matrix); Loading Loading @@ -11128,6 +11131,7 @@ package android.graphics.drawable.shapes { method public android.graphics.drawable.shapes.Shape clone() throws java.lang.CloneNotSupportedException; method public abstract void draw(android.graphics.Canvas, android.graphics.Paint); method public final float getHeight(); method public boolean getOutline(android.graphics.Outline); method public final float getWidth(); method public boolean hasAlpha(); method protected void onResize(float, float); core/java/android/view/View.java +2 −1 Original line number Diff line number Diff line Loading @@ -10601,7 +10601,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (mOutline == null) { mOutline = new Outline(); } else { mOutline.markInvalid(); //invalidate outline, to ensure background calculates it mOutline.set(null); } if (mBackground.getOutline(mOutline)) { if (!mOutline.isValid()) { Loading core/jni/android/graphics/Path.cpp +13 −21 Original line number Diff line number Diff line Loading @@ -164,26 +164,19 @@ public: obj->close(); } static void addRect__RectFI(JNIEnv* env, jobject clazz, jlong objHandle, jobject jrect, jint dirHandle) { SkRect rect; SkPath* obj = reinterpret_cast<SkPath*>(objHandle); SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle); GraphicsJNI::jrectf_to_rect(env, jrect, &rect); obj->addRect(rect, dir); } static void addRect__FFFFI(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) { static void addRect(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) { SkPath* obj = reinterpret_cast<SkPath*>(objHandle); SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle); obj->addRect(left, top, right, bottom, dir); } static void addOval(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jint dirHandle) { static void addOval(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) { SkPath* obj = reinterpret_cast<SkPath*>(objHandle); SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle); SkRect oval_; GraphicsJNI::jrectf_to_rect(env, oval, &oval_); obj->addOval(oval_, dir); SkRect oval = SkRect::MakeLTRB(left, top, right, bottom); obj->addOval(oval, dir); } static void addCircle(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y, jfloat radius, jint dirHandle) { Loading Loading @@ -496,9 +489,8 @@ static JNINativeMethod methods[] = { {"native_rCubicTo","(JFFFFFF)V", (void*) SkPathGlue::rCubicTo}, {"native_arcTo","(JLandroid/graphics/RectF;FFZ)V", (void*) SkPathGlue::arcTo}, {"native_close","(J)V", (void*) SkPathGlue::close}, {"native_addRect","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addRect__RectFI}, {"native_addRect","(JFFFFI)V", (void*) SkPathGlue::addRect__FFFFI}, {"native_addOval","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addOval}, {"native_addRect","(JFFFFI)V", (void*) SkPathGlue::addRect}, {"native_addOval","(JFFFFI)V", (void*) SkPathGlue::addOval}, {"native_addCircle","(JFFFI)V", (void*) SkPathGlue::addCircle}, {"native_addArc","(JLandroid/graphics/RectF;FF)V", (void*) SkPathGlue::addArc}, {"native_addRoundRect","(JLandroid/graphics/RectF;FFI)V", (void*) SkPathGlue::addRoundRectXY}, Loading graphics/java/android/graphics/Outline.java +47 −20 Original line number Diff line number Diff line Loading @@ -16,14 +16,16 @@ package android.graphics; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.drawable.Drawable; import android.view.View; /** * Defines an area of content. * Defines a simple shape, used for bounding graphical regions. * * Can be used with a View, or computed by a Drawable, to drive the shape of shadows cast by a * View, and allowing Views to clip inner content. * View. * * @see View#setOutline(Outline) * @see Drawable#getOutline(Outline) Loading @@ -47,7 +49,7 @@ public final class Outline { /** * Constructs an Outline with a copy of the data in src. */ public Outline(Outline src) { public Outline(@Nullable Outline src) { set(src); } Loading @@ -69,8 +71,15 @@ public final class Outline { /** * Replace the contents of this Outline with the contents of src. * * @param src Source outline to copy from. */ public void set(Outline src) { public void set(@Nullable Outline src) { if (src == null) { mRadius = 0; mRect = null; mPath = null; } else { if (src.mPath != null) { if (mPath == null) { mPath = new Path(); Loading @@ -86,6 +95,7 @@ public final class Outline { } mRadius = src.mRadius; } } /** * Sets the Outline to the rounded rect defined by the input rect, and corner radius. Loading @@ -97,12 +107,14 @@ public final class Outline { /** * Convenience for {@link #setRect(int, int, int, int)} */ public void setRect(Rect rect) { public void setRect(@NonNull Rect rect) { setRect(rect.left, rect.top, rect.right, rect.bottom); } /** * Sets the Outline to the rounded rect defined by the input rect, and corner radius. * * Passing a zero radius is equivalent to calling {@link #setRect(int, int, int, int)} */ public void setRoundRect(int left, int top, int right, int bottom, float radius) { if (mRect == null) mRect = new Rect(); Loading @@ -113,17 +125,32 @@ public final class Outline { /** * Convenience for {@link #setRoundRect(int, int, int, int, float)} * @param rect * @param radius */ public void setRoundRect(Rect rect, float radius) { public void setRoundRect(@NonNull Rect rect, float radius) { setRoundRect(rect.left, rect.top, rect.right, rect.bottom, radius); } /** * Sets the outline to the oval defined by input rect. */ public void setOval(int left, int top, int right, int bottom) { mRect = null; if (mPath == null) mPath = new Path(); mPath.reset(); mPath.addOval(left, top, right, bottom, Path.Direction.CW); } /** * Convenience for {@link #setOval(int, int, int, int)} */ public void setOval(@NonNull Rect rect) { setOval(rect.left, rect.top, rect.right, rect.bottom); } /** * Sets the Constructs an Outline from a {@link android.graphics.Path#isConvex() convex path}. */ public void setConvexPath(Path convexPath) { public void setConvexPath(@NonNull Path convexPath) { if (!convexPath.isConvex()) { throw new IllegalArgumentException("path must be convex"); } Loading graphics/java/android/graphics/Path.java +13 −11 Original line number Diff line number Diff line Loading @@ -499,11 +499,7 @@ public class Path { * @param dir The direction to wind the rectangle's contour */ public void addRect(RectF rect, Direction dir) { if (rect == null) { throw new NullPointerException("need rect parameter"); } detectSimplePath(rect.left, rect.top, rect.right, rect.bottom, dir); native_addRect(mNativePath, rect, dir.nativeInt); addRect(rect.left, rect.top, rect.right, rect.bottom, dir); } /** Loading @@ -527,11 +523,17 @@ public class Path { * @param dir The direction to wind the oval's contour */ public void addOval(RectF oval, Direction dir) { if (oval == null) { throw new NullPointerException("need oval parameter"); addOval(oval.left, oval.top, oval.right, oval.bottom, dir); } /** * Add a closed oval contour to the path * * @param dir The direction to wind the oval's contour */ public void addOval(float left, float top, float right, float bottom, Direction dir) { isSimplePath = false; native_addOval(mNativePath, oval, dir.nativeInt); native_addOval(mNativePath, left, top, right, bottom, dir.nativeInt); } /** Loading Loading @@ -756,10 +758,10 @@ public class Path { private static native void native_arcTo(long nPath, RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo); private static native void native_close(long nPath); private static native void native_addRect(long nPath, RectF rect, int dir); private static native void native_addRect(long nPath, float left, float top, float right, float bottom, int dir); private static native void native_addOval(long nPath, RectF oval, int dir); private static native void native_addOval(long nPath, float left, float top, float right, float bottom, int dir); private static native void native_addCircle(long nPath, float x, float y, float radius, int dir); private static native void native_addArc(long nPath, RectF oval, float startAngle, float sweepAngle); Loading Loading
api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -10029,6 +10029,8 @@ package android.graphics { method public boolean isValid(); method public void set(android.graphics.Outline); method public void setConvexPath(android.graphics.Path); method public void setOval(int, int, int, int); method public void setOval(android.graphics.Rect); method public void setRect(int, int, int, int); method public void setRect(android.graphics.Rect); method public void setRoundRect(int, int, int, int, float); Loading Loading @@ -10201,6 +10203,7 @@ package android.graphics { method public void addArc(android.graphics.RectF, float, float); method public void addCircle(float, float, float, android.graphics.Path.Direction); method public void addOval(android.graphics.RectF, android.graphics.Path.Direction); method public void addOval(float, float, float, float, android.graphics.Path.Direction); method public void addPath(android.graphics.Path, float, float); method public void addPath(android.graphics.Path); method public void addPath(android.graphics.Path, android.graphics.Matrix); Loading Loading @@ -11128,6 +11131,7 @@ package android.graphics.drawable.shapes { method public android.graphics.drawable.shapes.Shape clone() throws java.lang.CloneNotSupportedException; method public abstract void draw(android.graphics.Canvas, android.graphics.Paint); method public final float getHeight(); method public boolean getOutline(android.graphics.Outline); method public final float getWidth(); method public boolean hasAlpha(); method protected void onResize(float, float);
core/java/android/view/View.java +2 −1 Original line number Diff line number Diff line Loading @@ -10601,7 +10601,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (mOutline == null) { mOutline = new Outline(); } else { mOutline.markInvalid(); //invalidate outline, to ensure background calculates it mOutline.set(null); } if (mBackground.getOutline(mOutline)) { if (!mOutline.isValid()) { Loading
core/jni/android/graphics/Path.cpp +13 −21 Original line number Diff line number Diff line Loading @@ -164,26 +164,19 @@ public: obj->close(); } static void addRect__RectFI(JNIEnv* env, jobject clazz, jlong objHandle, jobject jrect, jint dirHandle) { SkRect rect; SkPath* obj = reinterpret_cast<SkPath*>(objHandle); SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle); GraphicsJNI::jrectf_to_rect(env, jrect, &rect); obj->addRect(rect, dir); } static void addRect__FFFFI(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) { static void addRect(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) { SkPath* obj = reinterpret_cast<SkPath*>(objHandle); SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle); obj->addRect(left, top, right, bottom, dir); } static void addOval(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jint dirHandle) { static void addOval(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) { SkPath* obj = reinterpret_cast<SkPath*>(objHandle); SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle); SkRect oval_; GraphicsJNI::jrectf_to_rect(env, oval, &oval_); obj->addOval(oval_, dir); SkRect oval = SkRect::MakeLTRB(left, top, right, bottom); obj->addOval(oval, dir); } static void addCircle(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y, jfloat radius, jint dirHandle) { Loading Loading @@ -496,9 +489,8 @@ static JNINativeMethod methods[] = { {"native_rCubicTo","(JFFFFFF)V", (void*) SkPathGlue::rCubicTo}, {"native_arcTo","(JLandroid/graphics/RectF;FFZ)V", (void*) SkPathGlue::arcTo}, {"native_close","(J)V", (void*) SkPathGlue::close}, {"native_addRect","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addRect__RectFI}, {"native_addRect","(JFFFFI)V", (void*) SkPathGlue::addRect__FFFFI}, {"native_addOval","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addOval}, {"native_addRect","(JFFFFI)V", (void*) SkPathGlue::addRect}, {"native_addOval","(JFFFFI)V", (void*) SkPathGlue::addOval}, {"native_addCircle","(JFFFI)V", (void*) SkPathGlue::addCircle}, {"native_addArc","(JLandroid/graphics/RectF;FF)V", (void*) SkPathGlue::addArc}, {"native_addRoundRect","(JLandroid/graphics/RectF;FFI)V", (void*) SkPathGlue::addRoundRectXY}, Loading
graphics/java/android/graphics/Outline.java +47 −20 Original line number Diff line number Diff line Loading @@ -16,14 +16,16 @@ package android.graphics; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.drawable.Drawable; import android.view.View; /** * Defines an area of content. * Defines a simple shape, used for bounding graphical regions. * * Can be used with a View, or computed by a Drawable, to drive the shape of shadows cast by a * View, and allowing Views to clip inner content. * View. * * @see View#setOutline(Outline) * @see Drawable#getOutline(Outline) Loading @@ -47,7 +49,7 @@ public final class Outline { /** * Constructs an Outline with a copy of the data in src. */ public Outline(Outline src) { public Outline(@Nullable Outline src) { set(src); } Loading @@ -69,8 +71,15 @@ public final class Outline { /** * Replace the contents of this Outline with the contents of src. * * @param src Source outline to copy from. */ public void set(Outline src) { public void set(@Nullable Outline src) { if (src == null) { mRadius = 0; mRect = null; mPath = null; } else { if (src.mPath != null) { if (mPath == null) { mPath = new Path(); Loading @@ -86,6 +95,7 @@ public final class Outline { } mRadius = src.mRadius; } } /** * Sets the Outline to the rounded rect defined by the input rect, and corner radius. Loading @@ -97,12 +107,14 @@ public final class Outline { /** * Convenience for {@link #setRect(int, int, int, int)} */ public void setRect(Rect rect) { public void setRect(@NonNull Rect rect) { setRect(rect.left, rect.top, rect.right, rect.bottom); } /** * Sets the Outline to the rounded rect defined by the input rect, and corner radius. * * Passing a zero radius is equivalent to calling {@link #setRect(int, int, int, int)} */ public void setRoundRect(int left, int top, int right, int bottom, float radius) { if (mRect == null) mRect = new Rect(); Loading @@ -113,17 +125,32 @@ public final class Outline { /** * Convenience for {@link #setRoundRect(int, int, int, int, float)} * @param rect * @param radius */ public void setRoundRect(Rect rect, float radius) { public void setRoundRect(@NonNull Rect rect, float radius) { setRoundRect(rect.left, rect.top, rect.right, rect.bottom, radius); } /** * Sets the outline to the oval defined by input rect. */ public void setOval(int left, int top, int right, int bottom) { mRect = null; if (mPath == null) mPath = new Path(); mPath.reset(); mPath.addOval(left, top, right, bottom, Path.Direction.CW); } /** * Convenience for {@link #setOval(int, int, int, int)} */ public void setOval(@NonNull Rect rect) { setOval(rect.left, rect.top, rect.right, rect.bottom); } /** * Sets the Constructs an Outline from a {@link android.graphics.Path#isConvex() convex path}. */ public void setConvexPath(Path convexPath) { public void setConvexPath(@NonNull Path convexPath) { if (!convexPath.isConvex()) { throw new IllegalArgumentException("path must be convex"); } Loading
graphics/java/android/graphics/Path.java +13 −11 Original line number Diff line number Diff line Loading @@ -499,11 +499,7 @@ public class Path { * @param dir The direction to wind the rectangle's contour */ public void addRect(RectF rect, Direction dir) { if (rect == null) { throw new NullPointerException("need rect parameter"); } detectSimplePath(rect.left, rect.top, rect.right, rect.bottom, dir); native_addRect(mNativePath, rect, dir.nativeInt); addRect(rect.left, rect.top, rect.right, rect.bottom, dir); } /** Loading @@ -527,11 +523,17 @@ public class Path { * @param dir The direction to wind the oval's contour */ public void addOval(RectF oval, Direction dir) { if (oval == null) { throw new NullPointerException("need oval parameter"); addOval(oval.left, oval.top, oval.right, oval.bottom, dir); } /** * Add a closed oval contour to the path * * @param dir The direction to wind the oval's contour */ public void addOval(float left, float top, float right, float bottom, Direction dir) { isSimplePath = false; native_addOval(mNativePath, oval, dir.nativeInt); native_addOval(mNativePath, left, top, right, bottom, dir.nativeInt); } /** Loading Loading @@ -756,10 +758,10 @@ public class Path { private static native void native_arcTo(long nPath, RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo); private static native void native_close(long nPath); private static native void native_addRect(long nPath, RectF rect, int dir); private static native void native_addRect(long nPath, float left, float top, float right, float bottom, int dir); private static native void native_addOval(long nPath, RectF oval, int dir); private static native void native_addOval(long nPath, float left, float top, float right, float bottom, int dir); private static native void native_addCircle(long nPath, float x, float y, float radius, int dir); private static native void native_addArc(long nPath, RectF oval, float startAngle, float sweepAngle); Loading