diff options
Diffstat (limited to 'graphics')
9 files changed, 34 insertions, 56 deletions
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java index 39272b9..0e55089 100644 --- a/graphics/java/android/graphics/Picture.java +++ b/graphics/java/android/graphics/Picture.java @@ -135,8 +135,8 @@ public class Picture { * properly and are highly discouraged. * * <p> - * <strong>Note:</strong> a picture created from an input stream cannot be - * replayed on a hardware accelerated canvas. + * <strong>Note:</strong> Prior to API level 23 a picture created from an + * input stream cannot be replayed on a hardware accelerated canvas. * * @see #writeToStream(java.io.OutputStream) * @deprecated The recommended alternative is to not use writeToStream and @@ -155,8 +155,8 @@ public class Picture { * there is no guarantee that the Picture can be successfully reconstructed. * * <p> - * <strong>Note:</strong> a picture created from an input stream cannot be - * replayed on a hardware accelerated canvas. + * <strong>Note:</strong> Prior to API level 23 a picture created from an + * input stream cannot be replayed on a hardware accelerated canvas. * * @see #createFromStream(java.io.InputStream) * @deprecated The recommended alternative is to draw the picture into a diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java index f059727..fcd7f63 100644 --- a/graphics/java/android/graphics/drawable/BitmapDrawable.java +++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java @@ -362,11 +362,6 @@ public class BitmapDrawable extends Drawable { invalidateSelf(); } - @Override - public boolean isDither() { - return mBitmapState.mPaint.isDither(); - } - /** * Indicates the repeat behavior of this drawable on the X axis. * diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index 5e62aea..32af59a 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -269,30 +269,29 @@ public abstract class Drawable { } /** - * Set to true to have the drawable dither its colors when drawn to a device - * with fewer than 8-bits per color component. This can improve the look on - * those devices, but can also slow down the drawing a little. + * Set to true to have the drawable dither its colors when drawn to a + * device with fewer than 8-bits per color component. + * + * @see android.graphics.Paint#setDither(boolean); + * @deprecated This property is ignored. */ + @Deprecated public void setDither(boolean dither) {} /** - * @return whether this drawable dithers its colors - * @see #setDither(boolean) - */ - public boolean isDither() { - return false; - } - - /** - * Set to true to have the drawable filter its bitmap when scaled or rotated - * (for drawables that use bitmaps). If the drawable does not use bitmaps, - * this call is ignored. This can improve the look when scaled or rotated, - * but also slows down the drawing. + * Set to true to have the drawable filter its bitmaps with bilinear + * sampling when they are scaled or rotated. + * + * <p>This can improve appearance when bitmaps are rotated. If the drawable + * does not use bitmaps, this call is ignored.</p> + * + * @see #isFilterBitmap() + * @see android.graphics.Paint#setFilterBitmap(boolean); */ public void setFilterBitmap(boolean filter) {} /** - * @return whether this drawable filters its bitmap + * @return whether this drawable filters its bitmaps * @see #setFilterBitmap(boolean) */ public boolean isFilterBitmap() { diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java index 1759f53..b344b86 100644 --- a/graphics/java/android/graphics/drawable/DrawableContainer.java +++ b/graphics/java/android/graphics/drawable/DrawableContainer.java @@ -167,11 +167,6 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { } @Override - public boolean isDither() { - return mDrawableContainerState.mDither; - } - - @Override public void setColorFilter(ColorFilter colorFilter) { mDrawableContainerState.mHasColorFilter = true; diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java index 626991d..a11b2cd 100644 --- a/graphics/java/android/graphics/drawable/GradientDrawable.java +++ b/graphics/java/android/graphics/drawable/GradientDrawable.java @@ -826,11 +826,6 @@ public class GradientDrawable extends Drawable { } @Override - public boolean isDither() { - return mGradientState.mDither; - } - - @Override public ColorFilter getColorFilter() { return mColorFilter; } diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java index 425225c..7c9b30b 100644 --- a/graphics/java/android/graphics/drawable/Icon.java +++ b/graphics/java/android/graphics/drawable/Icon.java @@ -116,6 +116,10 @@ public final class Icon implements Parcelable { return (Bitmap) mObj1; } + private void setBitmap(Bitmap b) { + mObj1 = b; + } + /** * @return The length of the compressed bitmap byte array held by this {@link #TYPE_DATA} Icon. * @hide @@ -367,6 +371,16 @@ public final class Icon implements Parcelable { } /** + * Puts the memory used by this instance into Ashmem memory, if possible. + * @hide + */ + public void convertToAshmem() { + if (mType == TYPE_BITMAP && getBitmap().isMutable()) { + setBitmap(getBitmap().createAshmemBitmap()); + } + } + + /** * Writes a serialized version of an Icon to the specified stream. * * @param stream The stream on which to serialize the Icon. @@ -486,7 +500,7 @@ public final class Icon implements Parcelable { throw new IllegalArgumentException("Bitmap must not be null."); } final Icon rep = new Icon(TYPE_BITMAP); - rep.mObj1 = bits; + rep.setBitmap(bits); return rep; } diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index 90891f6..8373c7f 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -1248,16 +1248,6 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { } @Override - public boolean isDither() { - final Drawable dr = getFirstNonNullDrawable(); - if (dr != null) { - return dr.isDither(); - } else { - return super.isDither(); - } - } - - @Override public void setAlpha(int alpha) { final ChildDrawable[] array = mLayerState.mChildren; final int N = mLayerState.mNum; diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java index adf53e3..152fe6a 100644 --- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java +++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java @@ -374,11 +374,6 @@ public class NinePatchDrawable extends Drawable { } @Override - public boolean isDither() { - return mPaint == null ? DEFAULT_DITHER : mPaint.isDither(); - } - - @Override public void setAutoMirrored(boolean mirrored) { mNinePatchState.mAutoMirrored = mirrored; } diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java index a669d3c..30b588e 100644 --- a/graphics/java/android/graphics/drawable/ShapeDrawable.java +++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java @@ -328,11 +328,6 @@ public class ShapeDrawable extends Drawable { } @Override - public boolean isDither() { - return mShapeState.mPaint.isDither(); - } - - @Override protected void onBoundsChange(Rect bounds) { super.onBoundsChange(bounds); updateShape(); |