summaryrefslogtreecommitdiff
path: root/graphics/java
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/BaseCanvas.java31
-rw-r--r--graphics/java/android/graphics/Bitmap.java69
-rw-r--r--graphics/java/android/graphics/ColorSpace.java46
-rw-r--r--graphics/java/android/graphics/Insets.java1
-rw-r--r--graphics/java/android/graphics/Path.java47
-rw-r--r--graphics/java/android/graphics/Picture.java2
-rw-r--r--graphics/java/android/graphics/PorterDuffColorFilter.java41
-rw-r--r--graphics/java/android/graphics/Rect.java39
-rw-r--r--graphics/java/android/graphics/RectF.java42
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java1
-rw-r--r--graphics/java/android/graphics/drawable/BitmapDrawable.java4
-rw-r--r--graphics/java/android/graphics/drawable/ColorDrawable.java21
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java16
-rw-r--r--graphics/java/android/graphics/drawable/DrawableContainer.java3
-rw-r--r--graphics/java/android/graphics/drawable/DrawableWrapper.java22
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java13
-rw-r--r--graphics/java/android/graphics/drawable/InsetDrawable.java11
-rw-r--r--graphics/java/android/graphics/drawable/NinePatchDrawable.java3
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java5
-rw-r--r--graphics/java/android/graphics/drawable/ShapeDrawable.java4
-rw-r--r--graphics/java/android/graphics/drawable/StateListDrawable.java26
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java7
-rw-r--r--graphics/java/android/graphics/drawable/shapes/ArcShape.java23
-rw-r--r--graphics/java/android/graphics/drawable/shapes/PathShape.java27
-rw-r--r--graphics/java/android/graphics/drawable/shapes/RectShape.java22
-rw-r--r--graphics/java/android/graphics/drawable/shapes/RoundRectShape.java30
-rw-r--r--graphics/java/android/graphics/drawable/shapes/Shape.java20
27 files changed, 357 insertions, 219 deletions
diff --git a/graphics/java/android/graphics/BaseCanvas.java b/graphics/java/android/graphics/BaseCanvas.java
index 71ee6c2b4421..97130f166eb2 100644
--- a/graphics/java/android/graphics/BaseCanvas.java
+++ b/graphics/java/android/graphics/BaseCanvas.java
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.annotation.Size;
import android.graphics.Canvas.VertexMode;
import android.text.GraphicsOperations;
+import android.text.MeasuredParagraph;
import android.text.PrecomputedText;
import android.text.SpannableString;
import android.text.SpannedString;
@@ -486,21 +487,31 @@ public abstract class BaseCanvas {
((GraphicsOperations) text).drawTextRun(this, start, end,
contextStart, contextEnd, x, y, isRtl, paint);
} else {
+ if (text instanceof PrecomputedText) {
+ final PrecomputedText pt = (PrecomputedText) text;
+ final int paraIndex = pt.findParaIndex(start);
+ if (end <= pt.getParagraphEnd(paraIndex)) {
+ final int paraStart = pt.getParagraphStart(paraIndex);
+ final MeasuredParagraph mp = pt.getMeasuredParagraph(paraIndex);
+ // Only support the text in the same paragraph.
+ nDrawTextRun(mNativeCanvasWrapper,
+ mp.getChars(),
+ start - paraStart,
+ end - start,
+ contextStart - paraStart,
+ contextEnd - contextStart,
+ x, y, isRtl, paint.getNativeInstance(),
+ mp.getNativePtr());
+ return;
+ }
+ }
int contextLen = contextEnd - contextStart;
int len = end - start;
char[] buf = TemporaryBuffer.obtain(contextLen);
TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
- long measuredTextPtr = 0;
- if (text instanceof PrecomputedText) {
- PrecomputedText mt = (PrecomputedText) text;
- int paraIndex = mt.findParaIndex(start);
- if (end <= mt.getParagraphEnd(paraIndex)) {
- // Only suppor the text in the same paragraph.
- measuredTextPtr = mt.getMeasuredParagraph(paraIndex).getNativePtr();
- }
- }
nDrawTextRun(mNativeCanvasWrapper, buf, start - contextStart, len,
- 0, contextLen, x, y, isRtl, paint.getNativeInstance(), measuredTextPtr);
+ 0, contextLen, x, y, isRtl, paint.getNativeInstance(),
+ 0 /* measured paragraph pointer */);
TemporaryBuffer.recycle(buf);
}
}
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 95a0c56905c0..c6f841505e03 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -33,6 +33,8 @@ import android.view.DisplayListCanvas;
import android.view.RenderNode;
import android.view.ThreadedRenderer;
+import dalvik.annotation.optimization.CriticalNative;
+
import libcore.util.NativeAllocationRegistry;
import java.io.OutputStream;
@@ -59,8 +61,6 @@ public final class Bitmap implements Parcelable {
// Convenience for JNI access
private final long mNativePtr;
- private final boolean mIsMutable;
-
/**
* Represents whether the Bitmap's content is requested to be pre-multiplied.
* Note that isPremultiplied() does not directly return this value, because
@@ -117,8 +117,7 @@ public final class Bitmap implements Parcelable {
* int (pointer).
*/
// called from JNI
- Bitmap(long nativeBitmap, int width, int height, int density,
- boolean isMutable, boolean requestPremultiplied,
+ Bitmap(long nativeBitmap, int width, int height, int density, boolean requestPremultiplied,
byte[] ninePatchChunk, NinePatch.InsetStruct ninePatchInsets) {
if (nativeBitmap == 0) {
throw new RuntimeException("internal error: native bitmap is 0");
@@ -126,7 +125,6 @@ public final class Bitmap implements Parcelable {
mWidth = width;
mHeight = height;
- mIsMutable = isMutable;
mRequestPremultiplied = requestPremultiplied;
mNinePatchChunk = ninePatchChunk;
@@ -346,14 +344,9 @@ public final class Bitmap implements Parcelable {
* there are no more references to this bitmap.
*/
public void recycle() {
- if (!mRecycled && mNativePtr != 0) {
- if (nativeRecycle(mNativePtr)) {
- // return value indicates whether native pixel object was actually recycled.
- // false indicates that it is still in use at the native level and these
- // objects should not be collected now. They will be collected later when the
- // Bitmap itself is collected.
- mNinePatchChunk = null;
- }
+ if (!mRecycled) {
+ nativeRecycle(mNativePtr);
+ mNinePatchChunk = null;
mRecycled = true;
}
}
@@ -742,7 +735,7 @@ public final class Bitmap implements Parcelable {
}
/**
- * Returns an immutable bitmap from the source bitmap. The new bitmap may
+ * Returns a bitmap from the source bitmap. The new bitmap may
* be the same object as source, or a copy may have been made. It is
* initialized with the same density and color space as the original bitmap.
*/
@@ -751,7 +744,7 @@ public final class Bitmap implements Parcelable {
}
/**
- * Returns an immutable bitmap from the specified subset of the source
+ * Returns a bitmap from the specified subset of the source
* bitmap. The new bitmap may be the same object as source, or a copy may
* have been made. It is initialized with the same density and color space
* as the original bitmap.
@@ -771,7 +764,7 @@ public final class Bitmap implements Parcelable {
}
/**
- * Returns an immutable bitmap from subset of the source bitmap,
+ * Returns a bitmap from subset of the source bitmap,
* transformed by the optional matrix. The new bitmap may be the
* same object as source, or a copy may have been made. It is
* initialized with the same density and color space as the original
@@ -781,6 +774,12 @@ public final class Bitmap implements Parcelable {
* same as the source bitmap itself, then the source bitmap is
* returned and no new bitmap is created.
*
+ * The returned bitmap will always be mutable except in the following scenarios:
+ * (1) In situations where the source bitmap is returned and the source bitmap is immutable
+ *
+ * (2) The source bitmap is a hardware bitmap. That is {@link #getConfig()} is equivalent to
+ * {@link Config#HARDWARE}
+ *
* @param source The bitmap we are subsetting
* @param x The x coordinate of the first pixel in source
* @param y The y coordinate of the first pixel in source
@@ -1218,11 +1217,9 @@ public final class Bitmap implements Parcelable {
* scaled to match if necessary.
* @param height The height of the bitmap to create. The picture's height will be
* scaled to match if necessary.
- * @param config The {@link Config} of the created bitmap. If this is null then
- * the bitmap will be {@link Config#HARDWARE}.
+ * @param config The {@link Config} of the created bitmap.
*
- * @return An immutable bitmap with a HARDWARE config whose contents are created
- * from the recorded drawing commands in the Picture source.
+ * @return An immutable bitmap with a configuration specified by the config parameter
*/
public static @NonNull Bitmap createBitmap(@NonNull Picture source, int width, int height,
@NonNull Config config) {
@@ -1261,7 +1258,7 @@ public final class Bitmap implements Parcelable {
}
canvas.drawPicture(source);
canvas.setBitmap(null);
- bitmap.makeImmutable();
+ bitmap.setImmutable();
return bitmap;
}
}
@@ -1352,13 +1349,22 @@ public final class Bitmap implements Parcelable {
* Returns true if the bitmap is marked as mutable (i.e.&nbsp;can be drawn into)
*/
public final boolean isMutable() {
- return mIsMutable;
+ return !nativeIsImmutable(mNativePtr);
}
- /** @hide */
- public final void makeImmutable() {
- // todo mIsMutable = false;
- // todo nMakeImmutable();
+ /**
+ * Marks the Bitmap as immutable. Further modifications to this Bitmap are disallowed.
+ * After this method is called, this Bitmap cannot be made mutable again and subsequent calls
+ * to {@link #reconfigure(int, int, Config)}, {@link #setPixel(int, int, int)},
+ * {@link #setPixels(int[], int, int, int, int, int, int)} and {@link #eraseColor(int)} will
+ * fail and throw an IllegalStateException.
+ *
+ * @hide
+ */
+ public void setImmutable() {
+ if (isMutable()) {
+ nativeSetImmutable(mNativePtr);
+ }
}
/**
@@ -1924,7 +1930,7 @@ public final class Bitmap implements Parcelable {
public void writeToParcel(Parcel p, int flags) {
checkRecycled("Can't parcel a recycled bitmap");
noteHardwareBitmapSlowCall();
- if (!nativeWriteToParcel(mNativePtr, mIsMutable, mDensity, p)) {
+ if (!nativeWriteToParcel(mNativePtr, isMutable(), mDensity, p)) {
throw new RuntimeException("native writeToParcel failed");
}
}
@@ -2042,7 +2048,7 @@ public final class Bitmap implements Parcelable {
private static native Bitmap nativeCopyAshmem(long nativeSrcBitmap);
private static native Bitmap nativeCopyAshmemConfig(long nativeSrcBitmap, int nativeConfig);
private static native long nativeGetNativeFinalizer();
- private static native boolean nativeRecycle(long nativeBitmap);
+ private static native void nativeRecycle(long nativeBitmap);
private static native void nativeReconfigure(long nativeBitmap, int width, int height,
int config, boolean isPremultiplied);
@@ -2097,4 +2103,11 @@ public final class Bitmap implements Parcelable {
private static native boolean nativeIsSRGB(long nativePtr);
private static native boolean nativeIsSRGBLinear(long nativePtr);
private static native void nativeCopyColorSpace(long srcBitmap, long dstBitmap);
+
+ private static native void nativeSetImmutable(long nativePtr);
+
+ // ---------------- @CriticalNative -------------------
+
+ @CriticalNative
+ private static native boolean nativeIsImmutable(long nativePtr);
}
diff --git a/graphics/java/android/graphics/ColorSpace.java b/graphics/java/android/graphics/ColorSpace.java
index 5814df5b5cc0..8414d6a6b866 100644
--- a/graphics/java/android/graphics/ColorSpace.java
+++ b/graphics/java/android/graphics/ColorSpace.java
@@ -239,7 +239,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{sRGB} = \begin{cases} 12.92 \times C_{linear} & C_{linear} \lt 0.0031308 \\
+ * C_{sRGB} = \begin{cases} 12.92 \times C_{linear} & C_{linear} \lt 0.0031308 \\\
* 1.055 \times C_{linear}^{\frac{1}{2.4}} - 0.055 & C_{linear} \ge 0.0031308 \end{cases}
* \end{equation}\)
* </td>
@@ -247,7 +247,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{sRGB}}{12.92} & C_{sRGB} \lt 0.04045 \\
+ * C_{linear} = \begin{cases}\frac{C_{sRGB}}{12.92} & C_{sRGB} \lt 0.04045 \\\
* \left( \frac{C_{sRGB} + 0.055}{1.055} \right) ^{2.4} & C_{sRGB} \ge 0.04045 \end{cases}
* \end{equation}\)
* </td>
@@ -302,7 +302,7 @@ public abstract class ColorSpace {
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
* C_{scRGB} = \begin{cases} sign(C_{linear}) 12.92 \times \left| C_{linear} \right| &
- * \left| C_{linear} \right| \lt 0.0031308 \\
+ * \left| C_{linear} \right| \lt 0.0031308 \\\
* sign(C_{linear}) 1.055 \times \left| C_{linear} \right| ^{\frac{1}{2.4}} - 0.055 &
* \left| C_{linear} \right| \ge 0.0031308 \end{cases}
* \end{equation}\)
@@ -312,7 +312,7 @@ public abstract class ColorSpace {
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
* C_{linear} = \begin{cases}sign(C_{scRGB}) \frac{\left| C_{scRGB} \right|}{12.92} &
- * \left| C_{scRGB} \right| \lt 0.04045 \\
+ * \left| C_{scRGB} \right| \lt 0.04045 \\\
* sign(C_{scRGB}) \left( \frac{\left| C_{scRGB} \right| + 0.055}{1.055} \right) ^{2.4} &
* \left| C_{scRGB} \right| \ge 0.04045 \end{cases}
* \end{equation}\)
@@ -367,7 +367,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{BT709} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.018 \\
+ * C_{BT709} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.018 \\\
* 1.099 \times C_{linear}^{\frac{1}{2.2}} - 0.099 & C_{linear} \ge 0.018 \end{cases}
* \end{equation}\)
* </td>
@@ -375,7 +375,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{BT709}}{4.5} & C_{BT709} \lt 0.081 \\
+ * C_{linear} = \begin{cases}\frac{C_{BT709}}{4.5} & C_{BT709} \lt 0.081 \\\
* \left( \frac{C_{BT709} + 0.099}{1.099} \right) ^{2.2} & C_{BT709} \ge 0.081 \end{cases}
* \end{equation}\)
* </td>
@@ -402,7 +402,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{BT2020} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.0181 \\
+ * C_{BT2020} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.0181 \\\
* 1.0993 \times C_{linear}^{\frac{1}{2.2}} - 0.0993 & C_{linear} \ge 0.0181 \end{cases}
* \end{equation}\)
* </td>
@@ -410,7 +410,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{BT2020}}{4.5} & C_{BT2020} \lt 0.08145 \\
+ * C_{linear} = \begin{cases}\frac{C_{BT2020}}{4.5} & C_{BT2020} \lt 0.08145 \\\
* \left( \frac{C_{BT2020} + 0.0993}{1.0993} \right) ^{2.2} & C_{BT2020} \ge 0.08145 \end{cases}
* \end{equation}\)
* </td>
@@ -464,7 +464,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{DisplayP3} = \begin{cases} 12.92 \times C_{linear} & C_{linear} \lt 0.0030186 \\
+ * C_{DisplayP3} = \begin{cases} 12.92 \times C_{linear} & C_{linear} \lt 0.0030186 \\\
* 1.055 \times C_{linear}^{\frac{1}{2.4}} - 0.055 & C_{linear} \ge 0.0030186 \end{cases}
* \end{equation}\)
* </td>
@@ -472,7 +472,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{DisplayP3}}{12.92} & C_{sRGB} \lt 0.039 \\
+ * C_{linear} = \begin{cases}\frac{C_{DisplayP3}}{12.92} & C_{sRGB} \lt 0.039 \\\
* \left( \frac{C_{DisplayP3} + 0.055}{1.055} \right) ^{2.4} & C_{sRGB} \ge 0.039 \end{cases}
* \end{equation}\)
* </td>
@@ -499,7 +499,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{BT709} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.018 \\
+ * C_{BT709} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.018 \\\
* 1.099 \times C_{linear}^{\frac{1}{2.2}} - 0.099 & C_{linear} \ge 0.018 \end{cases}
* \end{equation}\)
* </td>
@@ -507,7 +507,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{BT709}}{4.5} & C_{BT709} \lt 0.081 \\
+ * C_{linear} = \begin{cases}\frac{C_{BT709}}{4.5} & C_{BT709} \lt 0.081 \\\
* \left( \frac{C_{BT709} + 0.099}{1.099} \right) ^{2.2} & C_{BT709} \ge 0.081 \end{cases}
* \end{equation}\)
* </td>
@@ -534,7 +534,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{BT709} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.018 \\
+ * C_{BT709} = \begin{cases} 4.5 \times C_{linear} & C_{linear} \lt 0.018 \\\
* 1.099 \times C_{linear}^{\frac{1}{2.2}} - 0.099 & C_{linear} \ge 0.018 \end{cases}
* \end{equation}\)
* </td>
@@ -542,7 +542,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{BT709}}{4.5} & C_{BT709} \lt 0.081 \\
+ * C_{linear} = \begin{cases}\frac{C_{BT709}}{4.5} & C_{BT709} \lt 0.081 \\\
* \left( \frac{C_{BT709} + 0.099}{1.099} \right) ^{2.2} & C_{BT709} \ge 0.081 \end{cases}
* \end{equation}\)
* </td>
@@ -596,7 +596,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Opto-electronic transfer function (OETF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{ROMM} = \begin{cases} 16 \times C_{linear} & C_{linear} \lt 0.001953 \\
+ * C_{ROMM} = \begin{cases} 16 \times C_{linear} & C_{linear} \lt 0.001953 \\\
* C_{linear}^{\frac{1}{1.8}} & C_{linear} \ge 0.001953 \end{cases}
* \end{equation}\)
* </td>
@@ -604,7 +604,7 @@ public abstract class ColorSpace {
* <tr>
* <td>Electro-optical transfer function (EOTF)</td>
* <td colspan="4">\(\begin{equation}
- * C_{linear} = \begin{cases}\frac{C_{ROMM}}{16} & C_{ROMM} \lt 0.031248 \\
+ * C_{linear} = \begin{cases}\frac{C_{ROMM}}{16} & C_{ROMM} \lt 0.031248 \\\
* C_{ROMM}^{1.8} & C_{ROMM} \ge 0.031248 \end{cases}
* \end{equation}\)
* </td>
@@ -759,12 +759,12 @@ public abstract class ColorSpace {
*
* $$\begin{align*}
* \left[ \begin{array}{c} L_1\\ M_1\\ S_1 \end{array} \right] &=
- * A \left[ \begin{array}{c} W1_X\\ W1_Y\\ W1_Z \end{array} \right] \\
+ * A \left[ \begin{array}{c} W1_X\\ W1_Y\\ W1_Z \end{array} \right] \\\
* \left[ \begin{array}{c} L_2\\ M_2\\ S_2 \end{array} \right] &=
- * A \left[ \begin{array}{c} W2_X\\ W2_Y\\ W2_Z \end{array} \right] \\
- * D &= \left[ \begin{matrix} \frac{L_2}{L_1} & 0 & 0 \\
- * 0 & \frac{M_2}{M_1} & 0 \\
- * 0 & 0 & \frac{S_2}{S_1} \end{matrix} \right] \\
+ * A \left[ \begin{array}{c} W2_X\\ W2_Y\\ W2_Z \end{array} \right] \\\
+ * D &= \left[ \begin{matrix} \frac{L_2}{L_1} & 0 & 0 \\\
+ * 0 & \frac{M_2}{M_1} & 0 \\\
+ * 0 & 0 & \frac{S_2}{S_1} \end{matrix} \right] \\\
* T &= A^{-1}.D.A
* \end{align*}$$
*
@@ -2028,7 +2028,7 @@ public abstract class ColorSpace {
* <p>The EOTF is of the form:</p>
*
* \(\begin{equation}
- * Y = \begin{cases}c X + f & X \lt d \\
+ * Y = \begin{cases}c X + f & X \lt d \\\
* \left( a X + b \right) ^{g} + e & X \ge d \end{cases}
* \end{equation}\)
*
@@ -2066,7 +2066,7 @@ public abstract class ColorSpace {
* <p>The EOTF is of the form:</p>
*
* \(\begin{equation}
- * Y = \begin{cases}c X & X \lt d \\
+ * Y = \begin{cases}c X & X \lt d \\\
* \left( a X + b \right) ^{g} & X \ge d \end{cases}
* \end{equation}\)
*
diff --git a/graphics/java/android/graphics/Insets.java b/graphics/java/android/graphics/Insets.java
index 156f9903a632..5a78530852c7 100644
--- a/graphics/java/android/graphics/Insets.java
+++ b/graphics/java/android/graphics/Insets.java
@@ -23,7 +23,6 @@ package android.graphics;
* <p>
* Insets are immutable so may be treated as values.
*
- * @hide
*/
public class Insets {
public static final Insets NONE = new Insets(0, 0, 0, 0);
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index cd0862cd13fe..1652f6459f0d 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -66,7 +66,7 @@ public class Path {
*
* @param src The path to copy from when initializing the new path
*/
- public Path(Path src) {
+ public Path(@Nullable Path src) {
long valNative = 0;
if (src != null) {
valNative = src.mNativePath;
@@ -168,7 +168,7 @@ public class Path {
* @see Op
* @see #op(Path, Path, android.graphics.Path.Op)
*/
- public boolean op(Path path, Op op) {
+ public boolean op(@NonNull Path path, @NonNull Op op) {
return op(this, path, op);
}
@@ -186,7 +186,7 @@ public class Path {
* @see Op
* @see #op(Path, android.graphics.Path.Op)
*/
- public boolean op(Path path1, Path path2, Op op) {
+ public boolean op(@NonNull Path path1, @NonNull Path path2, @NonNull Op op) {
if (nOp(path1.mNativePath, path2.mNativePath, op.ordinal(), this.mNativePath)) {
isSimplePath = false;
rects = null;
@@ -255,6 +255,7 @@ public class Path {
*
* @return the path's fill type
*/
+ @NonNull
public FillType getFillType() {
return sFillTypeArray[nGetFillType(mNativePath)];
}
@@ -264,7 +265,7 @@ public class Path {
*
* @param ft The new fill type for this path
*/
- public void setFillType(FillType ft) {
+ public void setFillType(@NonNull FillType ft) {
nSetFillType(mNativePath, ft.nativeInt);
}
@@ -318,7 +319,7 @@ public class Path {
* @param exact This parameter is no longer used.
*/
@SuppressWarnings({"UnusedDeclaration"})
- public void computeBounds(RectF bounds, boolean exact) {
+ public void computeBounds(@NonNull RectF bounds, boolean exact) {
nComputeBounds(mNativePath, bounds);
}
@@ -461,7 +462,7 @@ public class Path {
* mod 360.
* @param forceMoveTo If true, always begin a new contour with the arc
*/
- public void arcTo(RectF oval, float startAngle, float sweepAngle,
+ public void arcTo(@NonNull RectF oval, float startAngle, float sweepAngle,
boolean forceMoveTo) {
arcTo(oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle, forceMoveTo);
}
@@ -477,7 +478,7 @@ public class Path {
* @param startAngle Starting angle (in degrees) where the arc begins
* @param sweepAngle Sweep angle (in degrees) measured clockwise
*/
- public void arcTo(RectF oval, float startAngle, float sweepAngle) {
+ public void arcTo(@NonNull RectF oval, float startAngle, float sweepAngle) {
arcTo(oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle, false);
}
@@ -542,7 +543,7 @@ public class Path {
* @param rect The rectangle to add as a closed contour to the path
* @param dir The direction to wind the rectangle's contour
*/
- public void addRect(RectF rect, Direction dir) {
+ public void addRect(@NonNull RectF rect, @NonNull Direction dir) {
addRect(rect.left, rect.top, rect.right, rect.bottom, dir);
}
@@ -555,7 +556,7 @@ public class Path {
* @param bottom The bottom of a rectangle to add to the path
* @param dir The direction to wind the rectangle's contour
*/
- public void addRect(float left, float top, float right, float bottom, Direction dir) {
+ public void addRect(float left, float top, float right, float bottom, @NonNull Direction dir) {
detectSimplePath(left, top, right, bottom, dir);
nAddRect(mNativePath, left, top, right, bottom, dir.nativeInt);
}
@@ -566,7 +567,7 @@ public class Path {
* @param oval The bounds of the oval to add as a closed contour to the path
* @param dir The direction to wind the oval's contour
*/
- public void addOval(RectF oval, Direction dir) {
+ public void addOval(@NonNull RectF oval, @NonNull Direction dir) {
addOval(oval.left, oval.top, oval.right, oval.bottom, dir);
}
@@ -575,7 +576,7 @@ public class Path {
*
* @param dir The direction to wind the oval's contour
*/
- public void addOval(float left, float top, float right, float bottom, Direction dir) {
+ public void addOval(float left, float top, float right, float bottom, @NonNull Direction dir) {
isSimplePath = false;
nAddOval(mNativePath, left, top, right, bottom, dir.nativeInt);
}
@@ -588,7 +589,7 @@ public class Path {
* @param radius The radius of a circle to add to the path
* @param dir The direction to wind the circle's contour
*/
- public void addCircle(float x, float y, float radius, Direction dir) {
+ public void addCircle(float x, float y, float radius, @NonNull Direction dir) {
isSimplePath = false;
nAddCircle(mNativePath, x, y, radius, dir.nativeInt);
}
@@ -600,7 +601,7 @@ public class Path {
* @param startAngle Starting angle (in degrees) where the arc begins
* @param sweepAngle Sweep angle (in degrees) measured clockwise
*/
- public void addArc(RectF oval, float startAngle, float sweepAngle) {
+ public void addArc(@NonNull RectF oval, float startAngle, float sweepAngle) {
addArc(oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle);
}
@@ -624,7 +625,7 @@ public class Path {
* @param ry The y-radius of the rounded corners on the round-rectangle
* @param dir The direction to wind the round-rectangle's contour
*/
- public void addRoundRect(RectF rect, float rx, float ry, Direction dir) {
+ public void addRoundRect(@NonNull RectF rect, float rx, float ry, @NonNull Direction dir) {
addRoundRect(rect.left, rect.top, rect.right, rect.bottom, rx, ry, dir);
}
@@ -636,7 +637,7 @@ public class Path {
* @param dir The direction to wind the round-rectangle's contour
*/
public void addRoundRect(float left, float top, float right, float bottom, float rx, float ry,
- Direction dir) {
+ @NonNull Direction dir) {
isSimplePath = false;
nAddRoundRect(mNativePath, left, top, right, bottom, rx, ry, dir.nativeInt);
}
@@ -650,7 +651,7 @@ public class Path {
* @param radii Array of 8 values, 4 pairs of [X,Y] radii
* @param dir The direction to wind the round-rectangle's contour
*/
- public void addRoundRect(RectF rect, float[] radii, Direction dir) {
+ public void addRoundRect(@NonNull RectF rect, @NonNull float[] radii, @NonNull Direction dir) {
if (rect == null) {
throw new NullPointerException("need rect parameter");
}
@@ -665,8 +666,8 @@ public class Path {
* @param radii Array of 8 values, 4 pairs of [X,Y] radii
* @param dir The direction to wind the round-rectangle's contour
*/
- public void addRoundRect(float left, float top, float right, float bottom, float[] radii,
- Direction dir) {
+ public void addRoundRect(float left, float top, float right, float bottom,
+ @NonNull float[] radii, @NonNull Direction dir) {
if (radii.length < 8) {
throw new ArrayIndexOutOfBoundsException("radii[] needs 8 values");
}
@@ -680,7 +681,7 @@ public class Path {
* @param src The path to add as a new contour
* @param dx The amount to translate the path in X as it is added
*/
- public void addPath(Path src, float dx, float dy) {
+ public void addPath(@NonNull Path src, float dx, float dy) {
isSimplePath = false;
nAddPath(mNativePath, src.mNativePath, dx, dy);
}
@@ -690,7 +691,7 @@ public class Path {
*
* @param src The path that is appended to the current path
*/
- public void addPath(Path src) {
+ public void addPath(@NonNull Path src) {
isSimplePath = false;
nAddPath(mNativePath, src.mNativePath);
}
@@ -700,7 +701,7 @@ public class Path {
*
* @param src The path to add as a new contour
*/
- public void addPath(Path src, Matrix matrix) {
+ public void addPath(@NonNull Path src, @NonNull Matrix matrix) {
if (!src.isSimplePath) isSimplePath = false;
nAddPath(mNativePath, src.mNativePath, matrix.native_instance);
}
@@ -760,7 +761,7 @@ public class Path {
* @param dst The transformed path is written here. If dst is null,
* then the the original path is modified
*/
- public void transform(Matrix matrix, Path dst) {
+ public void transform(@NonNull Matrix matrix, @Nullable Path dst) {
long dstNative = 0;
if (dst != null) {
dst.isSimplePath = false;
@@ -774,7 +775,7 @@ public class Path {
*
* @param matrix The matrix to apply to the path
*/
- public void transform(Matrix matrix) {
+ public void transform(@NonNull Matrix matrix) {
isSimplePath = false;
nTransform(mNativePath, matrix.native_instance);
}
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index ac386979ff5b..f2d0227645a9 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -163,6 +163,7 @@ public class Picture {
* properly and are highly discouraged.
*
* @see #writeToStream(java.io.OutputStream)
+ * @removed
* @deprecated The recommended alternative is to not use writeToStream and
* instead draw the picture into a Bitmap from which you can persist it as
* raw or compressed pixels.
@@ -179,6 +180,7 @@ public class Picture {
* there is no guarantee that the Picture can be successfully reconstructed.
*
* @see #createFromStream(java.io.InputStream)
+ * @removed
* @deprecated The recommended alternative is to draw the picture into a
* Bitmap from which you can persist it as raw or compressed pixels.
*/
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index 01d5825dd1e0..88a63223ea40 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -35,8 +35,6 @@ public class PorterDuffColorFilter extends ColorFilter {
* @param mode The porter-duff mode that is applied
*
* @see Color
- * @see #setColor(int)
- * @see #setMode(android.graphics.PorterDuff.Mode)
*/
public PorterDuffColorFilter(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
mColor = color;
@@ -48,7 +46,6 @@ public class PorterDuffColorFilter extends ColorFilter {
* is applied.
*
* @see Color
- * @see #setColor(int)
*
* @hide
*/
@@ -58,30 +55,10 @@ public class PorterDuffColorFilter extends ColorFilter {
}
/**
- * Specifies the color to tint the source pixels with when this color
- * filter is applied.
- *
- * @param color An ARGB {@link Color color}
- *
- * @see Color
- * @see #getColor()
- * @see #getMode()
- *
- * @hide
- */
- public void setColor(@ColorInt int color) {
- if (mColor != color) {
- mColor = color;
- discardNativeInstance();
- }
- }
-
- /**
* Returns the Porter-Duff mode used to composite this color filter's
* color with the source pixel when this filter is applied.
*
* @see PorterDuff
- * @see #setMode(android.graphics.PorterDuff.Mode)
*
* @hide
*/
@@ -89,24 +66,6 @@ public class PorterDuffColorFilter extends ColorFilter {
return mMode;
}
- /**
- * Specifies the Porter-Duff mode to use when compositing this color
- * filter's color with the source pixel at draw time.
- *
- * @see PorterDuff
- * @see #getMode()
- * @see #getColor()
- *
- * @hide
- */
- public void setMode(@NonNull PorterDuff.Mode mode) {
- if (mode == null) {
- throw new IllegalArgumentException("mode must be non-null");
- }
- mMode = mode;
- discardNativeInstance();
- }
-
@Override
long createNativeInstance() {
return native_CreatePorterDuffFilter(mColor, mMode.nativeInt);
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index 3843cb91154c..56a6820f4749 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -17,12 +17,13 @@
package android.graphics;
import android.annotation.CheckResult;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
-
import android.text.TextUtils;
import android.util.proto.ProtoOutputStream;
+
import java.io.PrintWriter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -89,7 +90,7 @@ public final class Rect implements Parcelable {
* @param r The rectangle whose coordinates are copied into the new
* rectangle.
*/
- public Rect(Rect r) {
+ public Rect(@Nullable Rect r) {
if (r == null) {
left = top = right = bottom = 0;
} else {
@@ -140,6 +141,7 @@ public final class Rect implements Parcelable {
/**
* Return a string representation of the rectangle in a compact form.
*/
+ @NonNull
public String toShortString() {
return toShortString(new StringBuilder(32));
}
@@ -148,7 +150,8 @@ public final class Rect implements Parcelable {
* Return a string representation of the rectangle in a compact form.
* @hide
*/
- public String toShortString(StringBuilder sb) {
+ @NonNull
+ public String toShortString(@NonNull StringBuilder sb) {
sb.setLength(0);
sb.append('['); sb.append(left); sb.append(',');
sb.append(top); sb.append("]["); sb.append(right);
@@ -164,6 +167,7 @@ public final class Rect implements Parcelable {
*
* @return Returns a new String of the form "left top right bottom"
*/
+ @NonNull
public String flattenToString() {
StringBuilder sb = new StringBuilder(32);
// WARNING: Do not change the format of this string, it must be
@@ -182,7 +186,8 @@ public final class Rect implements Parcelable {
* Returns a Rect from a string of the form returned by {@link #flattenToString},
* or null if the string is not of that form.
*/
- public static Rect unflattenFromString(String str) {
+ @Nullable
+ public static Rect unflattenFromString(@Nullable String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
@@ -201,7 +206,7 @@ public final class Rect implements Parcelable {
* Print short representation to given writer.
* @hide
*/
- public void printShortString(PrintWriter pw) {
+ public void printShortString(@NonNull PrintWriter pw) {
pw.print('['); pw.print(left); pw.print(',');
pw.print(top); pw.print("]["); pw.print(right);
pw.print(','); pw.print(bottom); pw.print(']');
@@ -215,7 +220,7 @@ public final class Rect implements Parcelable {
* @param fieldId Field Id of the Rect as defined in the parent message
* @hide
*/
- public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
+ public void writeToProto(@NonNull ProtoOutputStream protoOutputStream, long fieldId) {
final long token = protoOutputStream.start(fieldId);
protoOutputStream.write(RectProto.LEFT, left);
protoOutputStream.write(RectProto.TOP, top);
@@ -309,7 +314,7 @@ public final class Rect implements Parcelable {
* @param src The rectangle whose coordinates are copied into this
* rectangle.
*/
- public void set(Rect src) {
+ public void set(@NonNull Rect src) {
this.left = src.left;
this.top = src.top;
this.right = src.right;
@@ -366,7 +371,7 @@ public final class Rect implements Parcelable {
* @hide
* @param insets The rectangle specifying the insets on all side.
*/
- public void inset(Rect insets) {
+ public void inset(@NonNull Rect insets) {
left += insets.left;
top += insets.top;
right -= insets.right;
@@ -432,7 +437,7 @@ public final class Rect implements Parcelable {
* @return true iff the specified rectangle r is inside or equal to this
* rectangle
*/
- public boolean contains(Rect r) {
+ public boolean contains(@NonNull Rect r) {
// check for empty first
return this.left < this.right && this.top < this.bottom
// now check for containment
@@ -481,7 +486,7 @@ public final class Rect implements Parcelable {
* return false and do not change this rectangle.
*/
@CheckResult
- public boolean intersect(Rect r) {
+ public boolean intersect(@NonNull Rect r) {
return intersect(r.left, r.top, r.right, r.bottom);
}
@@ -491,7 +496,7 @@ public final class Rect implements Parcelable {
* @see #inset(int, int, int, int) but without checking if the rects overlap.
* @hide
*/
- public void intersectUnchecked(Rect other) {
+ public void intersectUnchecked(@NonNull Rect other) {
left = Math.max(left, other.left);
top = Math.max(top, other.top);
right = Math.min(right, other.right);
@@ -511,7 +516,7 @@ public final class Rect implements Parcelable {
* false and do not change this rectangle.
*/
@CheckResult
- public boolean setIntersect(Rect a, Rect b) {
+ public boolean setIntersect(@NonNull Rect a, @NonNull Rect b) {
if (a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom) {
left = Math.max(a.left, b.left);
top = Math.max(a.top, b.top);
@@ -550,7 +555,7 @@ public final class Rect implements Parcelable {
* @return true iff the two specified rectangles intersect. In no event are
* either of the rectangles modified.
*/
- public static boolean intersects(Rect a, Rect b) {
+ public static boolean intersects(@NonNull Rect a, @NonNull Rect b) {
return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
}
@@ -587,7 +592,7 @@ public final class Rect implements Parcelable {
*
* @param r The rectangle being unioned with this rectangle
*/
- public void union(Rect r) {
+ public void union(@NonNull Rect r) {
union(r.left, r.top, r.right, r.bottom);
}
@@ -634,6 +639,7 @@ public final class Rect implements Parcelable {
/**
* Parcelable interface methods
*/
+ @Override
public int describeContents() {
return 0;
}
@@ -643,6 +649,7 @@ public final class Rect implements Parcelable {
* a parcel, use readFromParcel()
* @param out The parcel to write the rectangle's coordinates into
*/
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(left);
out.writeInt(top);
@@ -654,6 +661,7 @@ public final class Rect implements Parcelable {
/**
* Return a new rectangle from the data in the specified parcel.
*/
+ @Override
public Rect createFromParcel(Parcel in) {
Rect r = new Rect();
r.readFromParcel(in);
@@ -663,6 +671,7 @@ public final class Rect implements Parcelable {
/**
* Return an array of rectangles of the specified size.
*/
+ @Override
public Rect[] newArray(int size) {
return new Rect[size];
}
@@ -674,7 +683,7 @@ public final class Rect implements Parcelable {
*
* @param in The parcel to read the rectangle's coordinates from
*/
- public void readFromParcel(Parcel in) {
+ public void readFromParcel(@NonNull Parcel in) {
left = in.readInt();
top = in.readInt();
right = in.readInt();
diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java
index b49054550956..d6447ac237ab 100644
--- a/graphics/java/android/graphics/RectF.java
+++ b/graphics/java/android/graphics/RectF.java
@@ -16,12 +16,15 @@
package android.graphics;
-import java.io.PrintWriter;
-
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
+
import com.android.internal.util.FastMath;
+import java.io.PrintWriter;
+
/**
* RectF holds four float coordinates for a rectangle. The rectangle is
* represented by the coordinates of its 4 edges (left, top, right bottom).
@@ -64,7 +67,7 @@ public class RectF implements Parcelable {
* @param r The rectangle whose coordinates are copied into the new
* rectangle.
*/
- public RectF(RectF r) {
+ public RectF(@Nullable RectF r) {
if (r == null) {
left = top = right = bottom = 0.0f;
} else {
@@ -75,7 +78,7 @@ public class RectF implements Parcelable {
}
}
- public RectF(Rect r) {
+ public RectF(@Nullable Rect r) {
if (r == null) {
left = top = right = bottom = 0.0f;
} else {
@@ -104,6 +107,7 @@ public class RectF implements Parcelable {
return result;
}
+ @Override
public String toString() {
return "RectF(" + left + ", " + top + ", "
+ right + ", " + bottom + ")";
@@ -112,6 +116,7 @@ public class RectF implements Parcelable {
/**
* Return a string representation of the rectangle in a compact form.
*/
+ @NonNull
public String toShortString() {
return toShortString(new StringBuilder(32));
}
@@ -120,7 +125,8 @@ public class RectF implements Parcelable {
* Return a string representation of the rectangle in a compact form.
* @hide
*/
- public String toShortString(StringBuilder sb) {
+ @NonNull
+ public String toShortString(@NonNull StringBuilder sb) {
sb.setLength(0);
sb.append('['); sb.append(left); sb.append(',');
sb.append(top); sb.append("]["); sb.append(right);
@@ -132,7 +138,7 @@ public class RectF implements Parcelable {
* Print short representation to given writer.
* @hide
*/
- public void printShortString(PrintWriter pw) {
+ public void printShortString(@NonNull PrintWriter pw) {
pw.print('['); pw.print(left); pw.print(',');
pw.print(top); pw.print("]["); pw.print(right);
pw.print(','); pw.print(bottom); pw.print(']');
@@ -207,7 +213,7 @@ public class RectF implements Parcelable {
* @param src The rectangle whose coordinates are copied into this
* rectangle.
*/
- public void set(RectF src) {
+ public void set(@NonNull RectF src) {
this.left = src.left;
this.top = src.top;
this.right = src.right;
@@ -220,7 +226,7 @@ public class RectF implements Parcelable {
* @param src The rectangle whose coordinates are copied into this
* rectangle.
*/
- public void set(Rect src) {
+ public void set(@NonNull Rect src) {
this.left = src.left;
this.top = src.top;
this.right = src.right;
@@ -315,7 +321,7 @@ public class RectF implements Parcelable {
* @return true iff the specified rectangle r is inside or equal to this
* rectangle
*/
- public boolean contains(RectF r) {
+ public boolean contains(@NonNull RectF r) {
// check for empty first
return this.left < this.right && this.top < this.bottom
// now check for containment
@@ -372,7 +378,7 @@ public class RectF implements Parcelable {
* (and this rectangle is then set to that intersection) else
* return false and do not change this rectangle.
*/
- public boolean intersect(RectF r) {
+ public boolean intersect(@NonNull RectF r) {
return intersect(r.left, r.top, r.right, r.bottom);
}
@@ -388,7 +394,7 @@ public class RectF implements Parcelable {
* this rectangle to that intersection. If they do not, return
* false and do not change this rectangle.
*/
- public boolean setIntersect(RectF a, RectF b) {
+ public boolean setIntersect(@NonNull RectF a, @NonNull RectF b) {
if (a.left < b.right && b.left < a.right
&& a.top < b.bottom && b.top < a.bottom) {
left = Math.max(a.left, b.left);
@@ -430,7 +436,7 @@ public class RectF implements Parcelable {
* @return true iff the two specified rectangles intersect. In no event are
* either of the rectangles modified.
*/
- public static boolean intersects(RectF a, RectF b) {
+ public static boolean intersects(@NonNull RectF a, @NonNull RectF b) {
return a.left < b.right && b.left < a.right
&& a.top < b.bottom && b.top < a.bottom;
}
@@ -439,7 +445,7 @@ public class RectF implements Parcelable {
* Set the dst integer Rect by rounding this rectangle's coordinates
* to their nearest integer values.
*/
- public void round(Rect dst) {
+ public void round(@NonNull Rect dst) {
dst.set(FastMath.round(left), FastMath.round(top),
FastMath.round(right), FastMath.round(bottom));
}
@@ -448,7 +454,7 @@ public class RectF implements Parcelable {
* Set the dst integer Rect by rounding "out" this rectangle, choosing the
* floor of top and left, and the ceiling of right and bottom.
*/
- public void roundOut(Rect dst) {
+ public void roundOut(@NonNull Rect dst) {
dst.set((int) Math.floor(left), (int) Math.floor(top),
(int) Math.ceil(right), (int) Math.ceil(bottom));
}
@@ -490,7 +496,7 @@ public class RectF implements Parcelable {
*
* @param r The rectangle being unioned with this rectangle
*/
- public void union(RectF r) {
+ public void union(@NonNull RectF r) {
union(r.left, r.top, r.right, r.bottom);
}
@@ -537,6 +543,7 @@ public class RectF implements Parcelable {
/**
* Parcelable interface methods
*/
+ @Override
public int describeContents() {
return 0;
}
@@ -546,6 +553,7 @@ public class RectF implements Parcelable {
* a parcel, use readFromParcel()
* @param out The parcel to write the rectangle's coordinates into
*/
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeFloat(left);
out.writeFloat(top);
@@ -557,6 +565,7 @@ public class RectF implements Parcelable {
/**
* Return a new rectangle from the data in the specified parcel.
*/
+ @Override
public RectF createFromParcel(Parcel in) {
RectF r = new RectF();
r.readFromParcel(in);
@@ -566,6 +575,7 @@ public class RectF implements Parcelable {
/**
* Return an array of rectangles of the specified size.
*/
+ @Override
public RectF[] newArray(int size) {
return new RectF[size];
}
@@ -577,7 +587,7 @@ public class RectF implements Parcelable {
*
* @param in The parcel to read the rectangle's coordinates from
*/
- public void readFromParcel(Parcel in) {
+ public void readFromParcel(@NonNull Parcel in) {
left = in.readFloat();
top = in.readFloat();
right = in.readFloat();
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index e397ed90c2e2..8e9862c39af0 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -516,7 +516,6 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
mAnimatedVectorState.mVectorDrawable.getOutline(outline);
}
- /** @hide */
@Override
public Insets getOpticalInsets() {
return mAnimatedVectorState.mVectorDrawable.getOpticalInsets();
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index 44b783bb6e63..99bed60afbfe 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -23,7 +23,6 @@ import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
@@ -627,9 +626,6 @@ public class BitmapDrawable extends Drawable {
mDstRectAndInsetsDirty = false;
}
- /**
- * @hide
- */
@Override
public Insets getOpticalInsets() {
updateDstRectAndInsetsIfDirty();
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index 9ae747de2f82..a601d6d6feba 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -21,12 +21,18 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.content.pm.ActivityInfo.Config;
-import android.graphics.*;
-import android.graphics.PorterDuff.Mode;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.Outline;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.PorterDuff.Mode;
+import android.graphics.PorterDuffColorFilter;
+import android.graphics.Xfermode;
import android.util.AttributeSet;
import android.view.ViewDebug;
@@ -180,6 +186,17 @@ public class ColorDrawable extends Drawable {
mPaint.setColorFilter(colorFilter);
}
+ /**
+ * Returns the color filter applied to this color configured by
+ * {@link #setColorFilter(ColorFilter)}
+ *
+ * @see android.graphics.drawable.Drawable#getColorFilter()
+ */
+ @Override
+ public @Nullable ColorFilter getColorFilter() {
+ return mPaint.getColorFilter();
+ }
+
@Override
public void setTintList(ColorStateList tint) {
mColorState.mTint = tint;
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 8af2fd8bbb5e..986d0c1c1da7 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -16,11 +16,6 @@
package android.graphics.drawable;
-import com.android.internal.R;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.annotation.AttrRes;
import android.annotation.ColorInt;
import android.annotation.IntRange;
@@ -57,6 +52,11 @@ import android.util.TypedValue;
import android.util.Xml;
import android.view.View;
+import com.android.internal.R;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -1088,7 +1088,6 @@ public abstract class Drawable {
* Return in insets the layout insets suggested by this Drawable for use with alignment
* operations during layout.
*
- * @hide
*/
public @NonNull Insets getOpticalInsets() {
return Insets.NONE;
@@ -1516,12 +1515,11 @@ public abstract class Drawable {
}
final int color = tint.getColorForState(getState(), Color.TRANSPARENT);
- if (tintFilter == null) {
+ if (tintFilter == null || tintFilter.getColor() != color
+ || tintFilter.getMode() != tintMode) {
return new PorterDuffColorFilter(color, tintMode);
}
- tintFilter.setColor(color);
- tintFilter.setMode(tintMode);
return tintFilter;
}
diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java
index aa4cd9cba4a7..e7b383a2f9c8 100644
--- a/graphics/java/android/graphics/drawable/DrawableContainer.java
+++ b/graphics/java/android/graphics/drawable/DrawableContainer.java
@@ -120,9 +120,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
return result;
}
- /**
- * @hide
- */
@Override
public Insets getOpticalInsets() {
if (mCurrDrawable != null) {
diff --git a/graphics/java/android/graphics/drawable/DrawableWrapper.java b/graphics/java/android/graphics/drawable/DrawableWrapper.java
index b71f3ef594a9..a907ca5928f5 100644
--- a/graphics/java/android/graphics/drawable/DrawableWrapper.java
+++ b/graphics/java/android/graphics/drawable/DrawableWrapper.java
@@ -16,11 +16,6 @@
package android.graphics.drawable;
-import com.android.internal.R;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.pm.ActivityInfo.Config;
@@ -35,10 +30,16 @@ import android.graphics.Outline;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.Rect;
+import android.graphics.Xfermode;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.View;
+import com.android.internal.R;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
/**
@@ -78,6 +79,16 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
}
/**
+ * @hide
+ */
+ @Override
+ public void setXfermode(Xfermode mode) {
+ if (mDrawable != null) {
+ mDrawable.setXfermode(mode);
+ }
+ }
+
+ /**
* Sets the wrapped drawable.
*
* @param dr the wrapped drawable
@@ -240,7 +251,6 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
return mDrawable != null && mDrawable.getPadding(padding);
}
- /** @hide */
@Override
public Insets getOpticalInsets() {
return mDrawable != null ? mDrawable.getOpticalInsets() : Insets.NONE;
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index dfdddb2a599a..5629389aaa42 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -392,6 +392,7 @@ public class GradientDrawable extends Drawable {
e = new DashPathEffect(new float[] { dashWidth, dashGap }, 0);
}
mStrokePaint.setPathEffect(e);
+ mGradientIsDirty = true;
invalidateSelf();
}
@@ -930,16 +931,15 @@ public class GradientDrawable extends Drawable {
* @see #getColor
*/
public void setColor(@Nullable ColorStateList colorStateList) {
- mGradientState.setSolidColors(colorStateList);
- final int color;
if (colorStateList == null) {
- color = Color.TRANSPARENT;
+ setColor(Color.TRANSPARENT);
} else {
final int[] stateSet = getState();
- color = colorStateList.getColorForState(stateSet, 0);
+ final int color = colorStateList.getColorForState(stateSet, 0);
+ mGradientState.setSolidColors(colorStateList);
+ mFillPaint.setColor(color);
+ invalidateSelf();
}
- mFillPaint.setColor(color);
- invalidateSelf();
}
/**
@@ -1698,7 +1698,6 @@ public class GradientDrawable extends Drawable {
return mGradientState.mHeight;
}
- /** @hide */
@Override
public Insets getOpticalInsets() {
return mGradientState.mOpticalInsets;
diff --git a/graphics/java/android/graphics/drawable/InsetDrawable.java b/graphics/java/android/graphics/drawable/InsetDrawable.java
index 443aa4931ee3..ade42949cdaf 100644
--- a/graphics/java/android/graphics/drawable/InsetDrawable.java
+++ b/graphics/java/android/graphics/drawable/InsetDrawable.java
@@ -16,11 +16,6 @@
package android.graphics.drawable;
-import com.android.internal.R;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.res.Resources;
@@ -35,6 +30,11 @@ import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
+import com.android.internal.R;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
/**
@@ -240,7 +240,6 @@ public class InsetDrawable extends DrawableWrapper {
| mTmpInsetRect.top | mTmpInsetRect.bottom) != 0;
}
- /** @hide */
@Override
public Insets getOpticalInsets() {
final Insets contentInsets = super.getOpticalInsets();
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index 5ff49aba88ae..7f23cea6a806 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -299,9 +299,6 @@ public class NinePatchDrawable extends Drawable {
super.getOutline(outline);
}
- /**
- * @hide
- */
@Override
public Insets getOpticalInsets() {
final Insets opticalInsets = mOpticalInsets;
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index 0da61c29bd8d..266a6ac87d53 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -888,7 +888,10 @@ public class RippleDrawable extends LayerDrawable {
// The ripple timing depends on the paint's alpha value, so we need
// to push just the alpha channel into the paint and let the filter
// handle the full-alpha color.
- mMaskColorFilter.setColor(color | 0xFF000000);
+ int maskColor = color | 0xFF000000;
+ if (mMaskColorFilter.getColor() != maskColor) {
+ mMaskColorFilter = new PorterDuffColorFilter(maskColor, mMaskColorFilter.getMode());
+ }
p.setColor(color & 0xFF000000);
p.setColorFilter(mMaskColorFilter);
p.setShader(mMaskShader);
diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java
index 34da928bb6f1..7bfb4c38d6c8 100644
--- a/graphics/java/android/graphics/drawable/ShapeDrawable.java
+++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java
@@ -594,12 +594,12 @@ public class ShapeDrawable extends Drawable {
@Override
public Drawable newDrawable() {
- return new ShapeDrawable(this, null);
+ return new ShapeDrawable(new ShapeState(this), null);
}
@Override
public Drawable newDrawable(Resources res) {
- return new ShapeDrawable(this, res);
+ return new ShapeDrawable(new ShapeState(this), res);
}
@Override
diff --git a/graphics/java/android/graphics/drawable/StateListDrawable.java b/graphics/java/android/graphics/drawable/StateListDrawable.java
index c98f1608c665..67c341287095 100644
--- a/graphics/java/android/graphics/drawable/StateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/StateListDrawable.java
@@ -16,6 +16,14 @@
package android.graphics.drawable;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.res.Resources;
+import android.content.res.Resources.Theme;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.util.StateSet;
+
import com.android.internal.R;
import org.xmlpull.v1.XmlPullParser;
@@ -24,14 +32,6 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.Arrays;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.content.res.Resources.Theme;
-import android.util.AttributeSet;
-import android.util.StateSet;
-
/**
* Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string
* ID value.
@@ -73,9 +73,11 @@ public class StateListDrawable extends DrawableContainer {
/**
* Add a new image/string ID to the set of images.
*
- * @param stateSet - An array of resource Ids to associate with the image.
+ * @param stateSet An array of resource Ids to associate with the image.
* Switch to this image by calling setState().
- * @param drawable -The image to show.
+ * @param drawable The image to show. Note this must be a unique Drawable that is not shared
+ * between any other View or Drawable otherwise the results are
+ * undefined and can lead to unexpected rendering behavior
*/
public void addState(int[] stateSet, Drawable drawable) {
if (drawable != null) {
@@ -235,7 +237,6 @@ public class StateListDrawable extends DrawableContainer {
* Gets the number of states contained in this drawable.
*
* @return The number of states contained in this drawable.
- * @hide pending API council
* @see #getStateSet(int)
* @see #getStateDrawable(int)
*/
@@ -248,7 +249,6 @@ public class StateListDrawable extends DrawableContainer {
*
* @param index The index of the state set.
* @return The state set at the index.
- * @hide pending API council
* @see #getStateCount()
* @see #getStateDrawable(int)
*/
@@ -261,7 +261,6 @@ public class StateListDrawable extends DrawableContainer {
*
* @param index The index of the drawable.
* @return The drawable at the index.
- * @hide pending API council
* @see #getStateCount()
* @see #getStateSet(int)
*/
@@ -274,7 +273,6 @@ public class StateListDrawable extends DrawableContainer {
*
* @param stateSet the state set to look up
* @return the index of the provided state set, or -1 if not found
- * @hide pending API council
* @see #getStateDrawable(int)
* @see #getStateSet(int)
*/
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index c71585f32155..b5bd97f74d84 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -46,6 +46,9 @@ import android.util.Xml;
import com.android.internal.R;
import com.android.internal.util.VirtualRefBasePtr;
+import dalvik.annotation.optimization.FastNative;
+import dalvik.system.VMRuntime;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -56,9 +59,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Stack;
-import dalvik.annotation.optimization.FastNative;
-import dalvik.system.VMRuntime;
-
/**
* This lets you create a drawable based on an XML vector graphic.
* <p/>
@@ -543,7 +543,6 @@ public class VectorDrawable extends Drawable {
return mDpiScaledHeight;
}
- /** @hide */
@Override
public Insets getOpticalInsets() {
if (mDpiScaledDirty) {
diff --git a/graphics/java/android/graphics/drawable/shapes/ArcShape.java b/graphics/java/android/graphics/drawable/shapes/ArcShape.java
index 85ba0a9e9f6f..90d07bce2617 100644
--- a/graphics/java/android/graphics/drawable/shapes/ArcShape.java
+++ b/graphics/java/android/graphics/drawable/shapes/ArcShape.java
@@ -20,6 +20,8 @@ import android.graphics.Canvas;
import android.graphics.Outline;
import android.graphics.Paint;
+import java.util.Objects;
+
/**
* Creates an arc shape. The arc shape starts at a specified angle and sweeps
* clockwise, drawing slices of pie.
@@ -74,5 +76,26 @@ public class ArcShape extends RectShape {
public ArcShape clone() throws CloneNotSupportedException {
return (ArcShape) super.clone();
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ ArcShape arcShape = (ArcShape) o;
+ return Float.compare(arcShape.mStartAngle, mStartAngle) == 0
+ && Float.compare(arcShape.mSweepAngle, mSweepAngle) == 0;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), mStartAngle, mSweepAngle);
+ }
}
diff --git a/graphics/java/android/graphics/drawable/shapes/PathShape.java b/graphics/java/android/graphics/drawable/shapes/PathShape.java
index ce5552b7a1bb..393fdee87bb8 100644
--- a/graphics/java/android/graphics/drawable/shapes/PathShape.java
+++ b/graphics/java/android/graphics/drawable/shapes/PathShape.java
@@ -21,6 +21,8 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
+import java.util.Objects;
+
/**
* Creates geometric paths, utilizing the {@link android.graphics.Path} class.
* <p>
@@ -74,5 +76,30 @@ public class PathShape extends Shape {
shape.mPath = new Path(mPath);
return shape;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ PathShape pathShape = (PathShape) o;
+ return Float.compare(pathShape.mStdWidth, mStdWidth) == 0
+ && Float.compare(pathShape.mStdHeight, mStdHeight) == 0
+ && Float.compare(pathShape.mScaleX, mScaleX) == 0
+ && Float.compare(pathShape.mScaleY, mScaleY) == 0
+ // Path does not have equals implementation but incase it gains one, use it here
+ && Objects.equals(mPath, pathShape.mPath);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), mStdWidth, mStdHeight, mPath, mScaleX, mScaleY);
+ }
}
diff --git a/graphics/java/android/graphics/drawable/shapes/RectShape.java b/graphics/java/android/graphics/drawable/shapes/RectShape.java
index e339a212a794..1bbd1d7236d9 100644
--- a/graphics/java/android/graphics/drawable/shapes/RectShape.java
+++ b/graphics/java/android/graphics/drawable/shapes/RectShape.java
@@ -21,6 +21,8 @@ import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.RectF;
+import java.util.Objects;
+
/**
* Defines a rectangle shape.
* <p>
@@ -63,4 +65,24 @@ public class RectShape extends Shape {
shape.mRect = new RectF(mRect);
return shape;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ RectShape rectShape = (RectShape) o;
+ return Objects.equals(mRect, rectShape.mRect);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), mRect);
+ }
}
diff --git a/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java b/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java
index f5cbb24a53ef..475e0bb70f2b 100644
--- a/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java
+++ b/graphics/java/android/graphics/drawable/shapes/RoundRectShape.java
@@ -23,6 +23,9 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
+import java.util.Arrays;
+import java.util.Objects;
+
/**
* Creates a rounded-corner rectangle. Optionally, an inset (rounded) rectangle
* can be included (to make a sort of "O" shape).
@@ -137,4 +140,31 @@ public class RoundRectShape extends RectShape {
shape.mPath = new Path(mPath);
return shape;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ RoundRectShape that = (RoundRectShape) o;
+ return Arrays.equals(mOuterRadii, that.mOuterRadii)
+ && Objects.equals(mInset, that.mInset)
+ && Arrays.equals(mInnerRadii, that.mInnerRadii)
+ && Objects.equals(mInnerRect, that.mInnerRect)
+ && Objects.equals(mPath, that.mPath);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(super.hashCode(), mInset, mInnerRect, mPath);
+ result = 31 * result + Arrays.hashCode(mOuterRadii);
+ result = 31 * result + Arrays.hashCode(mInnerRadii);
+ return result;
+ }
}
diff --git a/graphics/java/android/graphics/drawable/shapes/Shape.java b/graphics/java/android/graphics/drawable/shapes/Shape.java
index 30b28f3c2242..3b044ec631a2 100644
--- a/graphics/java/android/graphics/drawable/shapes/Shape.java
+++ b/graphics/java/android/graphics/drawable/shapes/Shape.java
@@ -21,6 +21,8 @@ import android.graphics.Canvas;
import android.graphics.Outline;
import android.graphics.Paint;
+import java.util.Objects;
+
/**
* Defines a generic graphical "shape."
* <p>
@@ -115,4 +117,22 @@ public abstract class Shape implements Cloneable {
public Shape clone() throws CloneNotSupportedException {
return (Shape) super.clone();
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Shape shape = (Shape) o;
+ return Float.compare(shape.mWidth, mWidth) == 0
+ && Float.compare(shape.mHeight, mHeight) == 0;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mWidth, mHeight);
+ }
}