diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 8 | ||||
-rw-r--r-- | graphics/java/android/graphics/Path.java | 8 | ||||
-rw-r--r-- | graphics/java/android/graphics/Point.java | 29 | ||||
-rw-r--r-- | graphics/java/android/graphics/PointF.java | 25 | ||||
-rw-r--r-- | graphics/java/android/graphics/SurfaceTexture.java | 2 | ||||
-rw-r--r-- | graphics/java/android/graphics/drawable/DrawableContainer.java | 2 | ||||
-rw-r--r-- | graphics/java/android/graphics/drawable/GradientDrawable.java | 8 |
7 files changed, 67 insertions, 15 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 688fd7a..89abdef 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -82,6 +82,7 @@ public final class Bitmap implements Parcelable { if (sDefaultDensity >= 0) { return sDefaultDensity; } + //noinspection deprecation sDefaultDensity = DisplayMetrics.DENSITY_DEVICE; return sDefaultDensity; } @@ -360,6 +361,9 @@ public final class Bitmap implements Parcelable { * that if this bitmap stores its pixels pre-multiplied * (see {@link #isPremultiplied()}, the values in the buffer will also be * pre-multiplied.</p> + * <p>After this method returns, the current position of the buffer is + * updated: the position is incremented by the number of elements written + * in the buffer.</p> */ public void copyPixelsToBuffer(Buffer dst) { int elements = dst.remaining(); @@ -394,6 +398,10 @@ public final class Bitmap implements Parcelable { * overwriting the bitmap's pixels. The data in the buffer is not changed * in any way (unlike setPixels(), which converts from unpremultipled 32bit * to whatever the bitmap's native format is.</p> + * <p>After this method returns, the current position of the buffer is + * updated: the position is incremented by the number of elements read from + * the buffer. If you need to read the bitmap from the buffer again you must + * first rewind the buffer.</p> */ public void copyPixelsFromBuffer(Buffer src) { checkRecycled("copyPixelsFromBuffer called on recycled bitmap"); diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java index b4f1e84..f6b5ffc 100644 --- a/graphics/java/android/graphics/Path.java +++ b/graphics/java/android/graphics/Path.java @@ -59,6 +59,10 @@ public class Path { int valNative = 0; if (src != null) { valNative = src.mNativePath; + isSimplePath = src.isSimplePath; + if (src.rects != null) { + rects = new Region(src.rects); + } } mNativePath = init2(valNative); mDetectSimplePaths = HardwareRenderer.isAvailable(); @@ -544,6 +548,7 @@ public class Path { int dstNative = 0; if (dst != null) { dstNative = dst.mNativePath; + dst.isSimplePath = false; } native_offset(mNativePath, dx, dy, dstNative); } @@ -555,6 +560,7 @@ public class Path { * @param dy The amount in the Y direction to offset the entire path */ public void offset(float dx, float dy) { + isSimplePath = false; native_offset(mNativePath, dx, dy); } @@ -580,6 +586,7 @@ public class Path { public void transform(Matrix matrix, Path dst) { int dstNative = 0; if (dst != null) { + dst.isSimplePath = false; dstNative = dst.mNativePath; } native_transform(mNativePath, matrix.native_instance, dstNative); @@ -591,6 +598,7 @@ public class Path { * @param matrix The matrix to apply to the path */ public void transform(Matrix matrix) { + isSimplePath = false; native_transform(mNativePath, matrix.native_instance); } diff --git a/graphics/java/android/graphics/Point.java b/graphics/java/android/graphics/Point.java index 338e880..e0d8ccc 100644 --- a/graphics/java/android/graphics/Point.java +++ b/graphics/java/android/graphics/Point.java @@ -70,20 +70,29 @@ public class Point implements Parcelable { return this.x == x && this.y == y; } - @Override public boolean equals(Object o) { - if (o instanceof Point) { - Point p = (Point) o; - return this.x == p.x && this.y == p.y; - } - return false; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Point point = (Point) o; + + if (x != point.x) return false; + if (y != point.y) return false; + + return true; } - @Override public int hashCode() { - return x * 32713 + y; + @Override + public int hashCode() { + int result = x; + result = 31 * result + y; + return result; } - @Override public String toString() { - return "Point(" + x + ", " + y+ ")"; + @Override + public String toString() { + return "Point(" + x + ", " + y + ")"; } /** diff --git a/graphics/java/android/graphics/PointF.java b/graphics/java/android/graphics/PointF.java index e00271f..ee38dbb 100644 --- a/graphics/java/android/graphics/PointF.java +++ b/graphics/java/android/graphics/PointF.java @@ -73,6 +73,31 @@ public class PointF implements Parcelable { return this.x == x && this.y == y; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + PointF pointF = (PointF) o; + + if (Float.compare(pointF.x, x) != 0) return false; + if (Float.compare(pointF.y, y) != 0) return false; + + return true; + } + + @Override + public int hashCode() { + int result = (x != +0.0f ? Float.floatToIntBits(x) : 0); + result = 31 * result + (y != +0.0f ? Float.floatToIntBits(y) : 0); + return result; + } + + @Override + public String toString() { + return "PointF(" + x + ", " + y + ")"; + } + /** * Return the euclidian distance from (0,0) to the point */ diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index 59f06dd..b919ba4 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -197,7 +197,7 @@ public class SurfaceTexture { public void attachToGLContext(int texName) { int err = nativeAttachToGLContext(texName); if (err != 0) { - throw new RuntimeException("Error during detachFromGLContext (see logcat for details)"); + throw new RuntimeException("Error during attachToGLContext (see logcat for details)"); } } diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java index 3af2969..a0c9701 100644 --- a/graphics/java/android/graphics/drawable/DrawableContainer.java +++ b/graphics/java/android/graphics/drawable/DrawableContainer.java @@ -491,6 +491,8 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { mComputedConstantSize = orig.mComputedConstantSize; mConstantWidth = orig.mConstantWidth; mConstantHeight = orig.mConstantHeight; + mConstantMinimumWidth = orig.mConstantMinimumWidth; + mConstantMinimumHeight = orig.mConstantMinimumHeight; mOpacity = orig.mOpacity; mHaveStateful = orig.mHaveStateful; diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java index 0623a9e..b966bb4 100644 --- a/graphics/java/android/graphics/drawable/GradientDrawable.java +++ b/graphics/java/android/graphics/drawable/GradientDrawable.java @@ -479,7 +479,7 @@ public class GradientDrawable extends Drawable { mFillPaint.setDither(mDither); mFillPaint.setColorFilter(mColorFilter); if (mColorFilter != null && !mGradientState.mHasSolidColor) { - mFillPaint.setColor(0xff000000); + mFillPaint.setColor(mAlpha << 24); } if (haveStroke) { mStrokePaint.setAlpha(currStrokeAlpha); @@ -743,7 +743,7 @@ public class GradientDrawable extends Drawable { mFillPaint.setShader(new LinearGradient(x0, y0, x1, y1, colors, st.mPositions, Shader.TileMode.CLAMP)); if (!mGradientState.mHasSolidColor) { - mFillPaint.setColor(0xff000000); + mFillPaint.setColor(mAlpha << 24); } } else if (st.mGradient == RADIAL_GRADIENT) { x0 = r.left + (r.right - r.left) * st.mCenterX; @@ -755,7 +755,7 @@ public class GradientDrawable extends Drawable { level * st.mGradientRadius, colors, null, Shader.TileMode.CLAMP)); if (!mGradientState.mHasSolidColor) { - mFillPaint.setColor(0xff000000); + mFillPaint.setColor(mAlpha << 24); } } else if (st.mGradient == SWEEP_GRADIENT) { x0 = r.left + (r.right - r.left) * st.mCenterX; @@ -788,7 +788,7 @@ public class GradientDrawable extends Drawable { } mFillPaint.setShader(new SweepGradient(x0, y0, tempColors, tempPositions)); if (!mGradientState.mHasSolidColor) { - mFillPaint.setColor(0xff000000); + mFillPaint.setColor(mAlpha << 24); } } } |