summaryrefslogtreecommitdiffstats
path: root/src
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
commit6826dc9b0358431159008c512bad320b657f0cc6 (patch)
tree77b2f1092adcb84b231a9c157f54fff4d43f3587 /src
parent45d791d5271e7283550140cfaca5b4bdfa0c0d14 (diff)
downloadandroid_packages_apps_Snap-6826dc9b0358431159008c512bad320b657f0cc6.tar.gz
android_packages_apps_Snap-6826dc9b0358431159008c512bad320b657f0cc6.tar.bz2
android_packages_apps_Snap-6826dc9b0358431159008c512bad320b657f0cc6.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
Diffstat (limited to 'src')
-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