summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-08-28 14:42:57 -0700
committerBobby Georgescu <georgescu@google.com>2012-08-29 16:29:20 -0700
commit39765b30b48c4530e11642a05a582ddf3ad27992 (patch)
treeb06a7a7ab27121d4132b3951744cdab590f0e41c
parent766941ee72831a2c76defb4d826cab24d918e0df (diff)
downloadandroid_packages_apps_Gallery2-39765b30b48c4530e11642a05a582ddf3ad27992.tar.gz
android_packages_apps_Gallery2-39765b30b48c4530e11642a05a582ddf3ad27992.tar.bz2
android_packages_apps_Gallery2-39765b30b48c4530e11642a05a582ddf3ad27992.zip
Reskin: Correctly position rotated thumbs in album listing
Bug: 7067732 Bug: 7050303 Changing the slots to be non-square surfaced a small math error, and also raised the question of where exactly to render the texture. The solution that makes the most sense given the current design is to fit the thumbnail (which is always square in our case) in the largest square that fits inside the slot, and aligned to the top. Change-Id: I98d94ad9255399aa4f1e5c403ff81811674bb264
-rw-r--r--src/com/android/gallery3d/ui/AbstractSlotRenderer.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java
index 98eae568b..c36847d69 100644
--- a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java
+++ b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java
@@ -42,15 +42,13 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer {
Texture content, int width, int height, int rotation) {
canvas.save(GLCanvas.SAVE_FLAG_MATRIX);
+ // The content is always rendered in to the largest square that fits
+ // inside the slot, aligned to the top of the slot.
+ width = height = Math.min(width, height);
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;
- width = height;
- }
}
// Fit the content into the box