diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-01-28 18:13:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-01-28 18:13:01 +0000 |
commit | e428a2cc043d5a7ea0f86776cfe7a47247908592 (patch) | |
tree | a44c52d45594138355343f3dfdecafbfb6bcb0bd /graphics/java | |
parent | b32b15d146486a92da211f10706a86f9a951dc06 (diff) | |
parent | 2410b90e066b75b14798b2c60c77e00865654496 (diff) |
Merge "Deprecate Canvas.EdgeType"
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/Canvas.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 9a0ca3e4ad9b..d949444d44d6 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -1162,6 +1162,7 @@ public class Canvas extends BaseCanvas { * @see #quickReject(float, float, float, float, EdgeType) * @see #quickReject(Path, EdgeType) * @see #quickReject(RectF, EdgeType) + * @deprecated quickReject no longer uses this. */ public enum EdgeType { @@ -1197,13 +1198,30 @@ public class Canvas extends BaseCanvas { * non-antialiased ({@link Canvas.EdgeType#BW}). * @return true if the rect (transformed by the canvas' matrix) * does not intersect with the canvas' clip + * @deprecated The EdgeType is ignored. Use {@link #quickReject(RectF)} instead. */ + @Deprecated public boolean quickReject(@NonNull RectF rect, @NonNull EdgeType type) { return nQuickReject(mNativeCanvasWrapper, rect.left, rect.top, rect.right, rect.bottom); } /** + * Return true if the specified rectangle, after being transformed by the + * current matrix, would lie completely outside of the current clip. Call + * this to check if an area you intend to draw into is clipped out (and + * therefore you can skip making the draw calls). + * + * @param rect the rect to compare with the current clip + * @return true if the rect (transformed by the canvas' matrix) + * does not intersect with the canvas' clip + */ + public boolean quickReject(@NonNull RectF rect) { + return nQuickReject(mNativeCanvasWrapper, + rect.left, rect.top, rect.right, rect.bottom); + } + + /** * Return true if the specified path, after being transformed by the * current matrix, would lie completely outside of the current clip. Call * this to check if an area you intend to draw into is clipped out (and @@ -1217,12 +1235,30 @@ public class Canvas extends BaseCanvas { * non-antialiased ({@link Canvas.EdgeType#BW}). * @return true if the path (transformed by the canvas' matrix) * does not intersect with the canvas' clip + * @deprecated The EdgeType is ignored. Use {@link #quickReject(Path)} instead. */ + @Deprecated public boolean quickReject(@NonNull Path path, @NonNull EdgeType type) { return nQuickReject(mNativeCanvasWrapper, path.readOnlyNI()); } /** + * Return true if the specified path, after being transformed by the + * current matrix, would lie completely outside of the current clip. Call + * this to check if an area you intend to draw into is clipped out (and + * therefore you can skip making the draw calls). Note: for speed it may + * return false even if the path itself might not intersect the clip + * (i.e. the bounds of the path intersects, but the path does not). + * + * @param path The path to compare with the current clip + * @return true if the path (transformed by the canvas' matrix) + * does not intersect with the canvas' clip + */ + public boolean quickReject(@NonNull Path path) { + return nQuickReject(mNativeCanvasWrapper, path.readOnlyNI()); + } + + /** * Return true if the specified rectangle, after being transformed by the * current matrix, would lie completely outside of the current clip. Call * this to check if an area you intend to draw into is clipped out (and @@ -1241,13 +1277,37 @@ public class Canvas extends BaseCanvas { * non-antialiased ({@link Canvas.EdgeType#BW}). * @return true if the rect (transformed by the canvas' matrix) * does not intersect with the canvas' clip + * @deprecated The EdgeType is ignored. Use {@link #quickReject(float, float, float, float)} + * instead. */ + @Deprecated public boolean quickReject(float left, float top, float right, float bottom, @NonNull EdgeType type) { return nQuickReject(mNativeCanvasWrapper, left, top, right, bottom); } /** + * Return true if the specified rectangle, after being transformed by the + * current matrix, would lie completely outside of the current clip. Call + * this to check if an area you intend to draw into is clipped out (and + * therefore you can skip making the draw calls). + * + * @param left The left side of the rectangle to compare with the + * current clip + * @param top The top of the rectangle to compare with the current + * clip + * @param right The right side of the rectangle to compare with the + * current clip + * @param bottom The bottom of the rectangle to compare with the + * current clip + * @return true if the rect (transformed by the canvas' matrix) + * does not intersect with the canvas' clip + */ + public boolean quickReject(float left, float top, float right, float bottom) { + return nQuickReject(mNativeCanvasWrapper, left, top, right, bottom); + } + + /** * Return the bounds of the current clip (in local coordinates) in the * bounds parameter, and return true if it is non-empty. This can be useful * in a way similar to quickReject, in that it tells you that drawing |