Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d181540 authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Cleanup Canvas API by deprecating a few methods.

The clipRegion(Region) API exposed a different semantic than all other clip APIs by not
respecting the current matrix. The same behavior can be achieved by calling clipRect(Rect)
on the Rects within a Region.

bug: 14650725
Change-Id: I7e91813b8e2474f327e070e549fa303d66f8b552
parent 8ff738f8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -10173,8 +10173,8 @@ package android.graphics {
    method public boolean clipRect(float, float, float, float, android.graphics.Region.Op);
    method public boolean clipRect(float, float, float, float);
    method public boolean clipRect(int, int, int, int);
    method public boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
    method public boolean clipRegion(android.graphics.Region);
    method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
    method public deprecated boolean clipRegion(android.graphics.Region);
    method public void concat(android.graphics.Matrix);
    method public void drawARGB(int, int, int, int);
    method public void drawArc(android.graphics.RectF, float, float, boolean, android.graphics.Paint);
+6 −0
Original line number Diff line number Diff line
@@ -713,6 +713,9 @@ public class Canvas {
     * @param region The region to operate on the current clip, based on op
     * @param op How the clip is modified
     * @return true if the resulting is non-empty
     *
     * @deprecated Unlike all other clip calls this API does not respect the
     *             current matrix. Use {@link #clipRect(Rect)} as an alternative.
     */
    public boolean clipRegion(Region region, Region.Op op) {
        return native_clipRegion(mNativeCanvas, region.ni(), op.nativeInt);
@@ -727,6 +730,9 @@ public class Canvas {
     *
     * @param region The region to operate on the current clip, based on op
     * @return true if the resulting is non-empty
     *
     * @deprecated Unlike all other clip calls this API does not respect the
     *             current matrix. Use {@link #clipRect(Rect)} as an alternative.
     */
    public boolean clipRegion(Region region) {
        return clipRegion(region, Region.Op.INTERSECT);