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

Commit c13bf777 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Restore saveLayer APIs back into the public API." into pi-dev...

Merge "Merge "Restore saveLayer APIs back into the public API." into pi-dev am: ffe1c2a2" into pi-dev-plus-aosp
parents 83b2d00f 7e608f8f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -13349,9 +13349,13 @@ package android.graphics {
    method public void rotate(float);
    method public final void rotate(float, float, float);
    method public int save();
    method public deprecated int saveLayer(android.graphics.RectF, android.graphics.Paint, int);
    method public int saveLayer(android.graphics.RectF, android.graphics.Paint);
    method public deprecated int saveLayer(float, float, float, float, android.graphics.Paint, int);
    method public int saveLayer(float, float, float, float, android.graphics.Paint);
    method public deprecated int saveLayerAlpha(android.graphics.RectF, int, int);
    method public int saveLayerAlpha(android.graphics.RectF, int);
    method public deprecated int saveLayerAlpha(float, float, float, float, int, int);
    method public int saveLayerAlpha(float, float, float, float, int);
    method public void scale(float, float);
    method public final void scale(float, float, float, float);
@@ -13361,6 +13365,7 @@ package android.graphics {
    method public void setMatrix(android.graphics.Matrix);
    method public void skew(float, float);
    method public void translate(float, float);
    field public static final int ALL_SAVE_FLAG = 31; // 0x1f
  }
  public static final class Canvas.EdgeType extends java.lang.Enum {
+0 −5
Original line number Diff line number Diff line
@@ -169,11 +169,6 @@ package android.graphics {
    method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
    method public deprecated boolean clipRegion(android.graphics.Region);
    method public deprecated int save(int);
    method public deprecated int saveLayer(android.graphics.RectF, android.graphics.Paint, int);
    method public deprecated int saveLayer(float, float, float, float, android.graphics.Paint, int);
    method public deprecated int saveLayerAlpha(android.graphics.RectF, int, int);
    method public deprecated int saveLayerAlpha(float, float, float, float, int, int);
    field public static final int ALL_SAVE_FLAG = 31; // 0x1f
    field public static final deprecated int CLIP_SAVE_FLAG = 2; // 0x2
    field public static final deprecated int CLIP_TO_LAYER_SAVE_FLAG = 16; // 0x10
    field public static final deprecated int FULL_COLOR_LAYER_SAVE_FLAG = 8; // 0x8
+0 −4
Original line number Diff line number Diff line
@@ -690,10 +690,6 @@ Landroid/graphics/Camera;->native_instance:J
Landroid/graphics/Canvas;-><init>(J)V
Landroid/graphics/Canvas;->release()V
Landroid/graphics/Canvas;->save(I)I
Landroid/graphics/Canvas;->saveLayerAlpha(FFFFII)I
Landroid/graphics/Canvas;->saveLayerAlpha(Landroid/graphics/RectF;II)I
Landroid/graphics/Canvas;->saveLayer(FFFFLandroid/graphics/Paint;I)I
Landroid/graphics/Canvas;->saveLayer(Landroid/graphics/RectF;Landroid/graphics/Paint;I)I
Landroid/graphics/ColorMatrixColorFilter;->setColorMatrix(Landroid/graphics/ColorMatrix;)V
Landroid/graphics/drawable/AnimatedImageDrawable;->onAnimationEnd()V
Landroid/graphics/drawable/AnimatedStateListDrawable$AnimatedStateListState;->mStateIds:Landroid/util/SparseIntArray;
+4 −6
Original line number Diff line number Diff line
@@ -20224,22 +20224,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        int solidColor = getSolidColor();
        if (solidColor == 0) {
            final int flags = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;
            if (drawTop) {
                canvas.saveLayer(left, top, right, top + length, null, flags);
                canvas.saveUnclippedLayer(left, top, right, top + length);
            }
            if (drawBottom) {
                canvas.saveLayer(left, bottom - length, right, bottom, null, flags);
                canvas.saveUnclippedLayer(left, bottom - length, right, bottom);
            }
            if (drawLeft) {
                canvas.saveLayer(left, top, left + length, bottom, null, flags);
                canvas.saveUnclippedLayer(left, top, left + length, bottom);
            }
            if (drawRight) {
                canvas.saveLayer(right - length, top, right, bottom, null, flags);
                canvas.saveUnclippedLayer(right - length, top, right, bottom);
            }
        } else {
            scrollabilityCache.setFadeColor(solidColor);
+41 −19
Original line number Diff line number Diff line
@@ -367,12 +367,19 @@ public class Canvas extends BaseCanvas {
     * call to <code>saveLayer()</code> and <code>saveLayerAlpha()</code>
     * variants.
     *
     * @removed There are no visible methods remaining that use this flag
     * <p class="note"><strong>Note:</strong> all methods that accept this flag
     * have flagless versions that are equivalent to passing this flag.
     */
    public static final int ALL_SAVE_FLAG = 0x1F;

    private static void checkValidSaveFlags(int saveFlags) {
        if (sCompatiblityVersion >= Build.VERSION_CODES.P
                && saveFlags != ALL_SAVE_FLAG) {
            throw new IllegalArgumentException(
                    "Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed");
        }
    }

    /**
     * Saves the current matrix and clip onto a private stack.
     * <p>
@@ -414,10 +421,8 @@ public class Canvas extends BaseCanvas {
     * redirects drawing to an offscreen bitmap.
     * <p class="note"><strong>Note:</strong> this method is very expensive,
     * incurring more than double rendering cost for contained content. Avoid
     * using this method, especially if the bounds provided are large, or if
     * the {@link #CLIP_TO_LAYER_SAVE_FLAG} is omitted from the
     * {@code saveFlags} parameter. It is recommended to use a
     * {@link android.view.View#LAYER_TYPE_HARDWARE hardware layer} on a View
     * using this method, especially if the bounds provided are large. It is
     * recommended to use a {@link android.view.View#LAYER_TYPE_HARDWARE hardware layer} on a View
     * to apply an xfermode, color filter, or alpha, as it will perform much
     * better than this method.
     * <p>
@@ -431,7 +436,9 @@ public class Canvas extends BaseCanvas {
     * {@link Paint#getColorFilter() ColorFilter} are applied when the
     * offscreen bitmap is drawn back when restore() is called.
     *
     * @removed
     * As of API Level API level {@value Build.VERSION_CODES#P} the only valid
     * {@code saveFlags} is {@link #ALL_SAVE_FLAG}.  All other flags are ignored.
     *
     * @deprecated Use {@link #saveLayer(RectF, Paint)} instead.
     * @param bounds May be null. The maximum size the offscreen bitmap
     *               needs to be (in local coordinates)
@@ -445,7 +452,9 @@ public class Canvas extends BaseCanvas {
        if (bounds == null) {
            bounds = new RectF(getClipBounds());
        }
        return saveLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, paint, saveFlags);
        checkValidSaveFlags(saveFlags);
        return saveLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, paint,
                ALL_SAVE_FLAG);
    }

    /**
@@ -478,18 +487,27 @@ public class Canvas extends BaseCanvas {
        return saveLayer(bounds, paint, ALL_SAVE_FLAG);
    }

    /**
     * @hide
     */
    public int saveUnclippedLayer(int left, int top, int right, int bottom) {
        return nSaveLayer(mNativeCanvasWrapper, left, top, right, bottom, 0, 0);
    }

    /**
     * Helper version of saveLayer() that takes 4 values rather than a RectF.
     *
     * @removed
     * As of API Level API level {@value Build.VERSION_CODES#P} the only valid
     * {@code saveFlags} is {@link #ALL_SAVE_FLAG}.  All other flags are ignored.
     *
     * @deprecated Use {@link #saveLayer(float, float, float, float, Paint)} instead.
     */
    @Deprecated
    public int saveLayer(float left, float top, float right, float bottom, @Nullable Paint paint,
            @Saveflags int saveFlags) {
        checkValidSaveFlags(saveFlags);
        return nSaveLayer(mNativeCanvasWrapper, left, top, right, bottom,
                paint != null ? paint.getNativeInstance() : 0,
                saveFlags);
                ALL_SAVE_FLAG);
    }

    /**
@@ -505,10 +523,8 @@ public class Canvas extends BaseCanvas {
     * redirects drawing to an offscreen bitmap.
     * <p class="note"><strong>Note:</strong> this method is very expensive,
     * incurring more than double rendering cost for contained content. Avoid
     * using this method, especially if the bounds provided are large, or if
     * the {@link #CLIP_TO_LAYER_SAVE_FLAG} is omitted from the
     * {@code saveFlags} parameter. It is recommended to use a
     * {@link android.view.View#LAYER_TYPE_HARDWARE hardware layer} on a View
     * using this method, especially if the bounds provided are large. It is
     * recommended to use a {@link android.view.View#LAYER_TYPE_HARDWARE hardware layer} on a View
     * to apply an xfermode, color filter, or alpha, as it will perform much
     * better than this method.
     * <p>
@@ -520,7 +536,9 @@ public class Canvas extends BaseCanvas {
     * The {@code alpha} parameter is applied when the offscreen bitmap is
     * drawn back when restore() is called.
     *
     * @removed
     * As of API Level API level {@value Build.VERSION_CODES#P} the only valid
     * {@code saveFlags} is {@link #ALL_SAVE_FLAG}.  All other flags are ignored.
     *
     * @deprecated Use {@link #saveLayerAlpha(RectF, int)} instead.
     * @param bounds    The maximum size the offscreen bitmap needs to be
     *                  (in local coordinates)
@@ -534,7 +552,9 @@ public class Canvas extends BaseCanvas {
        if (bounds == null) {
            bounds = new RectF(getClipBounds());
        }
        return saveLayerAlpha(bounds.left, bounds.top, bounds.right, bounds.bottom, alpha, saveFlags);
        checkValidSaveFlags(saveFlags);
        return saveLayerAlpha(bounds.left, bounds.top, bounds.right, bounds.bottom, alpha,
                ALL_SAVE_FLAG);
    }

    /**
@@ -553,15 +573,17 @@ public class Canvas extends BaseCanvas {
    /**
     * Helper for saveLayerAlpha() that takes 4 values instead of a RectF.
     *
     * @removed
     * As of API Level API level {@value Build.VERSION_CODES#P} the only valid
     * {@code saveFlags} is {@link #ALL_SAVE_FLAG}.  All other flags are ignored.
     *
     * @deprecated Use {@link #saveLayerAlpha(float, float, float, float, int)} instead.
     */
    @Deprecated
    public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha,
            @Saveflags int saveFlags) {
        checkValidSaveFlags(saveFlags);
        alpha = Math.min(255, Math.max(0, alpha));
        return nSaveLayerAlpha(mNativeCanvasWrapper, left, top, right, bottom,
                                     alpha, saveFlags);
                                     alpha, ALL_SAVE_FLAG);
    }

    /**