Enable {ANTI_ALIAS,DITHER}_FLAG by default (1/2)
Test: atest android.graphics.cts.PaintTest
Bug: 186644628
Change-Id: I5d5d03e430af380e23016c6deba5eca46067a22b
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index e222570..51bf6d53 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -255,6 +255,12 @@
| FILTER_BITMAP_FLAG;
/**
+ * These flags are always set on a reset paint or a new paint instantiated using
+ * {@link #Paint()}.
+ */
+ private static final int DEFAULT_PAINT_FLAGS = ANTI_ALIAS_FLAG | DITHER_FLAG;
+
+ /**
* Font hinter option that disables font hinting.
*
* @see #setHinting(int)
@@ -570,10 +576,13 @@
* accelerated drawing always acts as if {@link #FILTER_BITMAP_FLAG} is set.
* On devices running {@link Build.VERSION_CODES#Q} and above,
* {@code FILTER_BITMAP_FLAG} is set by this constructor, and it can be
- * cleared with {@link #setFlags} or {@link #setFilterBitmap}.</p>
+ * cleared with {@link #setFlags} or {@link #setFilterBitmap}.
+ * On devices running {@link Build.VERSION_CODES#S} and above, {@code ANTI_ALIAS_FLAG} and
+ * {@code DITHER_FLAG} are set by this constructor, and they can be cleared with
+ * {@link #setFlags} or {@link #setAntiAlias} and {@link #setDither}, respectively.</p>
*/
public Paint() {
- this(0);
+ this(DEFAULT_PAINT_FLAGS);
}
/**
@@ -618,7 +627,7 @@
/** Restores the paint to its default settings. */
public void reset() {
nReset(mNativePaint);
- setFlags(HIDDEN_DEFAULT_PAINT_FLAGS);
+ setFlags(HIDDEN_DEFAULT_PAINT_FLAGS | DEFAULT_PAINT_FLAGS);
// TODO: Turning off hinting has undesirable side effects, we need to
// revisit hinting once we add support for subpixel positioning