Make Canvas#drawPatch public
Bug: 155422223 Bug: 155661807 Test: NinePatchTest#testDraw Test: NinePatchDrawableTest#testDraw As part of the move to a mainline module, code outside the module cannot access @hidden APIs on Canvas. Although no code outside the module calls these methods, there is a Canvas subclass that overrides it - NopCanvas, which overrides it to do nothing. This is useful, and cannot be achieved another way. (If NopCanvas did not override drawPatch, it would crash when attempting to draw a NinePatchDrawable.) In addition, this method is already public on RecordingCanvas. (This is likely an accident; it contains no documentation for the method.) Lastly, it is somewhat arbitrary that the way to draw a NinePatch directly was to call NinePatch#draw. This is the reverse of how Canvas drawing generally works. The newly public method matches the typical pattern (Canvas#draw<Something>(Something, Paint)) and is already called by NinePatch#draw. Change-Id: I16d7dc7391e3ad5777fdd7023472545c6104af69
This commit is contained in:
committed by
Leon Scroggins
parent
c357f974e4
commit
491ed067dd
@@ -14300,6 +14300,8 @@ package android.graphics {
|
||||
method public void drawOval(@NonNull android.graphics.RectF, @NonNull android.graphics.Paint);
|
||||
method public void drawOval(float, float, float, float, @NonNull android.graphics.Paint);
|
||||
method public void drawPaint(@NonNull android.graphics.Paint);
|
||||
method public void drawPatch(@NonNull android.graphics.NinePatch, @NonNull android.graphics.Rect, @Nullable android.graphics.Paint);
|
||||
method public void drawPatch(@NonNull android.graphics.NinePatch, @NonNull android.graphics.RectF, @Nullable android.graphics.Paint);
|
||||
method public void drawPath(@NonNull android.graphics.Path, @NonNull android.graphics.Paint);
|
||||
method public void drawPicture(@NonNull android.graphics.Picture);
|
||||
method public void drawPicture(@NonNull android.graphics.Picture, @NonNull android.graphics.RectF);
|
||||
@@ -15354,8 +15356,6 @@ package android.graphics {
|
||||
}
|
||||
|
||||
public final class RecordingCanvas extends android.graphics.Canvas {
|
||||
method public final void drawPatch(@NonNull android.graphics.NinePatch, @NonNull android.graphics.Rect, @Nullable android.graphics.Paint);
|
||||
method public final void drawPatch(@NonNull android.graphics.NinePatch, @NonNull android.graphics.RectF, @Nullable android.graphics.Paint);
|
||||
}
|
||||
|
||||
public final class Rect implements android.os.Parcelable {
|
||||
|
||||
@@ -1873,24 +1873,22 @@ public class Canvas extends BaseCanvas {
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the specified bitmap as an N-patch (most often, a 9-patches.)
|
||||
* Draws the specified bitmap as an N-patch (most often, a 9-patch.)
|
||||
*
|
||||
* @param patch The ninepatch object to render
|
||||
* @param dst The destination rectangle.
|
||||
* @param paint The paint to draw the bitmap with. may be null
|
||||
* @hide
|
||||
*/
|
||||
public void drawPatch(@NonNull NinePatch patch, @NonNull Rect dst, @Nullable Paint paint) {
|
||||
super.drawPatch(patch, dst, paint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the specified bitmap as an N-patch (most often, a 9-patches.)
|
||||
* Draws the specified bitmap as an N-patch (most often, a 9-patch.)
|
||||
*
|
||||
* @param patch The ninepatch object to render
|
||||
* @param dst The destination rectangle.
|
||||
* @param paint The paint to draw the bitmap with. may be null
|
||||
* @hide
|
||||
*/
|
||||
public void drawPatch(@NonNull NinePatch patch, @NonNull RectF dst, @Nullable Paint paint) {
|
||||
super.drawPatch(patch, dst, paint);
|
||||
|
||||
Reference in New Issue
Block a user