summaryrefslogtreecommitdiffstats
path: root/graphics/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/Bitmap.java26
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java18
-rw-r--r--graphics/java/android/graphics/Canvas.java4
3 files changed, 14 insertions, 34 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index e2e93eb..141553e 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -31,8 +31,6 @@ public final class Bitmap implements Parcelable {
*
* @see Bitmap#getDensityScale()
* @see Bitmap#setDensityScale(float)
- *
- * @hide pending API council approval
*/
public static final float DENSITY_SCALE_UNKNOWN = -1.0f;
@@ -84,11 +82,9 @@ public final class Bitmap implements Parcelable {
* @see #setDensityScale(float)
* @see #isAutoScalingEnabled()
* @see #setAutoScalingEnabled(boolean)
- * @see android.util.DisplayMetrics#DEFAULT_DENSITY
+ * @see android.util.DisplayMetrics#DENSITY_DEFAULT
* @see android.util.DisplayMetrics#density
* @see #DENSITY_SCALE_UNKNOWN
- *
- * @hide pending API council approval
*/
public float getDensityScale() {
return mDensityScale;
@@ -106,11 +102,9 @@ public final class Bitmap implements Parcelable {
* @see #getDensityScale()
* @see #isAutoScalingEnabled()
* @see #setAutoScalingEnabled(boolean)
- * @see android.util.DisplayMetrics#DEFAULT_DENSITY
+ * @see android.util.DisplayMetrics#DENSITY_DEFAULT
* @see android.util.DisplayMetrics#density
* @see #DENSITY_SCALE_UNKNOWN
- *
- * @hide pending API council approval
*/
public void setDensityScale(float densityScale) {
mDensityScale = densityScale;
@@ -132,8 +126,6 @@ public final class Bitmap implements Parcelable {
* @see #setAutoScalingEnabled(boolean)
* @see #getDensityScale()
* @see #setDensityScale(float)
- *
- * @hide pending API council approval
*/
public boolean isAutoScalingEnabled() {
return mAutoScaling;
@@ -150,8 +142,6 @@ public final class Bitmap implements Parcelable {
* the bitmap will never be automatically scaled at drawing time.</p>
*
* @param autoScalingEnabled True to scale the bitmap at drawing time, false otherwise.
- *
- * @hide pending API council approval
*/
public void setAutoScalingEnabled(boolean autoScalingEnabled) {
mAutoScaling = autoScalingEnabled;
@@ -465,8 +455,8 @@ public final class Bitmap implements Parcelable {
// The new bitmap was created from a known bitmap source so assume that
// they use the same density scale
- bitmap.setDensityScale(source.getDensityScale());
- bitmap.setAutoScalingEnabled(source.isAutoScalingEnabled());
+ bitmap.mDensityScale = source.mDensityScale;
+ bitmap.mAutoScaling = source.mAutoScaling;
return bitmap;
}
@@ -616,11 +606,9 @@ public final class Bitmap implements Parcelable {
* by the density scale factor.
*
* @return The scaled width of this bitmap, according to the density scale factor.
- *
- * @hide pending API council approval
*/
public int getScaledWidth() {
- final float scale = getDensityScale();
+ final float scale = mDensityScale;
return scale == DENSITY_SCALE_UNKNOWN ? getWidth() : (int) (getWidth() / scale);
}
@@ -629,11 +617,9 @@ public final class Bitmap implements Parcelable {
* by the density scale factor.
*
* @return The scaled height of this bitmap, according to the density scale factor.
- *
- * @hide pending API council approval
*/
public int getScaledHeight() {
- final float scale = getDensityScale();
+ final float scale = mDensityScale;
return scale == DENSITY_SCALE_UNKNOWN ? getWidth() : (int) (getHeight() / scale);
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 33f373d..975bc1a 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -82,10 +82,8 @@ public class BitmapFactory {
/**
* The desired pixel density of the bitmap.
*
- * @see android.util.DisplayMetrics#DEFAULT_DENSITY
+ * @see android.util.DisplayMetrics#DENSITY_DEFAULT
* @see android.util.DisplayMetrics#density
- *
- * @hide pending API council approval
*/
public int inDensity;
@@ -98,8 +96,6 @@ public class BitmapFactory {
* a non-scaled version of the bitmap. In this case,
* {@link android.graphics.Bitmap#setAutoScalingEnabled(boolean)} can be used
* to properly scale the bitmap at drawing time.</p>
- *
- * @hide pending API council approval
*/
public boolean inScaled;
@@ -239,8 +235,6 @@ public class BitmapFactory {
/**
* Decode a new Bitmap from an InputStream. This InputStream was obtained from
* resources, which we pass to be able to scale the bitmap accordingly.
- *
- * @hide
*/
public static Bitmap decodeStream(Resources res, TypedValue value, InputStream is,
Rect pad, Options opts) {
@@ -252,15 +246,19 @@ public class BitmapFactory {
Bitmap bm = decodeStream(is, pad, opts);
if (bm != null && res != null && value != null) {
+ final int density = value.density;
+ if (density == TypedValue.DENSITY_NONE) {
+ return bm;
+ }
+
byte[] np = bm.getNinePatchChunk();
final boolean isNinePatch = np != null && NinePatch.isNinePatchChunk(np);
- final int density = value.density;
if (opts.inDensity == 0) {
opts.inDensity = density == TypedValue.DENSITY_DEFAULT ?
- DisplayMetrics.DEFAULT_DENSITY : density;
+ DisplayMetrics.DENSITY_DEFAULT : density;
}
- float scale = opts.inDensity / (float) DisplayMetrics.DEFAULT_DENSITY;
+ float scale = opts.inDensity / (float) DisplayMetrics.DENSITY_DEFAULT;
if (opts.inScaled || isNinePatch) {
bm.setDensityScale(1.0f);
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 4498e1a..da73597 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -184,8 +184,6 @@ public class Canvas {
*
* @see #setDensityScale(float)
* @see Bitmap#getDensityScale()
- *
- * @hide pending API council approval
*/
public float getDensityScale() {
if (mBitmap != null) {
@@ -205,8 +203,6 @@ public class Canvas {
*
* @see #getDensityScale()
* @see Bitmap#setDensityScale(float)
- *
- * @hide pending API council approval
*/
public void setDensityScale(float densityScale) {
if (mBitmap != null) {