summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wei <markwei@google.com>2013-11-06 15:15:01 -0800
committerMark Wei <markwei@google.com>2013-11-06 15:15:01 -0800
commit7be91f8fe3c6d9af037b36918ea5bd86a10bbb44 (patch)
treebd13ea5ea2dc70adff9bbf8ba18e6bfd8e28ead4
parent41af50eb1ac488572b066629c3954b23c21dfa76 (diff)
downloadbitmap-7be91f8fe3c6d9af037b36918ea5bd86a10bbb44.tar.gz
Fix bitmap drawing bug.
The bitmap's bounds is not the true bounds, since the bitmaps are being reused. The true bounds are the decode bounds, or logical bounds of the ReusableBitmap. Bug: 11534712 Change-Id: I8fd5c35feacccbbfe6b625591cd56dec9ff3d716
-rw-r--r--src/com/android/bitmap/drawable/BasicBitmapDrawable.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
index eaadf63..13c89d9 100644
--- a/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
+++ b/src/com/android/bitmap/drawable/BasicBitmapDrawable.java
@@ -312,7 +312,7 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
// Rotate the canvas.
canvas.save();
canvas.rotate(orientation, bounds.centerX(), bounds.centerY());
- onDrawBitmap(canvas, rotatedBounds);
+ onDrawBitmap(canvas, sRect, rotatedBounds);
canvas.restore();
}
}
@@ -321,8 +321,8 @@ public class BasicBitmapDrawable extends Drawable implements DecodeCallback,
* Override this method to customize how to draw the bitmap to the canvas for the given bounds.
* The bitmap to be drawn can be found at {@link #getBitmap()}.
*/
- protected void onDrawBitmap(final Canvas canvas, final Rect bounds) {
- canvas.drawBitmap(mBitmap.bmp, sRect, bounds, mPaint);
+ protected void onDrawBitmap(final Canvas canvas, final Rect src, final Rect dst) {
+ canvas.drawBitmap(mBitmap.bmp, src, dst, mPaint);
}
@Override