OSDN Git Service

Support rotation
authorJohn Reck <jreck@google.com>
Fri, 8 Mar 2013 02:07:05 +0000 (18:07 -0800)
committerJohn Reck <jreck@google.com>
Fri, 8 Mar 2013 02:10:36 +0000 (18:10 -0800)
Change-Id: Ic93bed50851f788803124ea2453128fd0497a746

src/com/android/photos/shims/BitmapJobDrawable.java

index e13e636..9d3c7e9 100644 (file)
@@ -24,6 +24,7 @@ public class BitmapJobDrawable extends Drawable implements Runnable {
     private Bitmap mBitmap;
     private Paint mPaint = new Paint();
     private Matrix mDrawMatrix = new Matrix();
+    private int mRotation = 0;
 
     public BitmapJobDrawable() {
     }
@@ -43,6 +44,7 @@ public class BitmapJobDrawable extends Drawable implements Runnable {
             // TODO: Figure out why ThumbnailLoader doesn't like to be re-used
             mLoader = new ThumbnailLoader(this);
             mLoader.startLoad();
+            mRotation = mItem.getRotation();
         }
         invalidateSelf();
     }
@@ -69,6 +71,7 @@ public class BitmapJobDrawable extends Drawable implements Runnable {
             canvas.save();
             canvas.clipRect(bounds);
             canvas.concat(mDrawMatrix);
+            canvas.rotate(mRotation, bounds.centerX(), bounds.centerY());
             canvas.drawBitmap(mBitmap, 0, 0, mPaint);
             canvas.restore();
         } else {