OSDN Git Service

Fix a UI bug in rendering a rotated image.
authorOwen Lin <owenlin@google.com>
Thu, 19 Apr 2012 07:09:12 +0000 (15:09 +0800)
committerOwen Lin <owenlin@google.com>
Thu, 19 Apr 2012 07:09:12 +0000 (15:09 +0800)
Change-Id: I14f9f74c5d810dfbb56151722c7f604522fea938

src/com/android/gallery3d/ui/AbstractSlotRenderer.java

index 0b880b1..fecb70f 100644 (file)
@@ -42,7 +42,9 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer {
         canvas.save(GLCanvas.SAVE_FLAG_MATRIX);
 
         if (rotation != 0) {
+            canvas.translate(width / 2, height / 2);
             canvas.rotate(rotation, 0, 0, 1);
+            canvas.translate(-width / 2, -height / 2);
             if (((rotation % 90) & 1) != 0) {
                 int temp = height;
                 height = width;