diff options
author | Leon Scroggins III <scroggo@google.com> | 2020-01-23 12:55:53 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2020-01-23 20:43:34 +0000 |
commit | 2410b90e066b75b14798b2c60c77e00865654496 (patch) | |
tree | 76a684c90c05a0067ef1de07399d757712cd0a39 /graphics | |
parent | 6e62dbb263eace8451d3acb1964ee6b1dbd6ace9 (diff) |
Deprecate Canvas.EdgeType
Bug: 129694386
Test: No change in behavior, no new tests
EdgeType is only used as a parameter to quickReject, but it is always
ignored. Deprecate it and the existing quickReject methods. Add new
versions of quickReject without EdgeType parameters. Switch clients to
the new versions.
Change-Id: Id932f10915a8c4959fe0e85f507ce7fd2da8a576
Diffstat (limited to 'graphics')
-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 |