From 7be91f8fe3c6d9af037b36918ea5bd86a10bbb44 Mon Sep 17 00:00:00 2001 From: Mark Wei Date: Wed, 6 Nov 2013 15:15:01 -0800 Subject: 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 --- src/com/android/bitmap/drawable/BasicBitmapDrawable.java | 6 +++--- 1 file 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 -- cgit v1.2.3