summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-08-08 18:47:33 +0800
committerOwen Lin <owenlin@google.com>2012-08-08 18:50:37 +0800
commit380414670b541d41216fde770b60a442bc72f642 (patch)
treed0d679ad932f647b450f6c49b45745178192135e
parent4bbfbebdfb584a0c3e348f60f7a95476c43b67f6 (diff)
downloadandroid_packages_apps_Snap-380414670b541d41216fde770b60a442bc72f642.tar.gz
android_packages_apps_Snap-380414670b541d41216fde770b60a442bc72f642.tar.bz2
android_packages_apps_Snap-380414670b541d41216fde770b60a442bc72f642.zip
Rotate the texture in building PhotoFallbackEffect
bug: 6525127 Change-Id: Iba348450b62190a1a2149cf0d7f20f19625cb6cf
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index ec042da23..c9fefca28 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -1745,9 +1745,24 @@ public class PhotoView extends GLView {
if (!Rect.intersects(fullRect, rect)) continue;
rect.offset(location.left, location.top);
- RawTexture texture = new RawTexture(sc.getWidth(), sc.getHeight(), true);
- canvas.beginRenderTarget(texture);
- sc.draw(canvas, 0, 0, sc.getWidth(), sc.getHeight());
+ int width = sc.getWidth();
+ int height = sc.getHeight();
+
+ int rotation = mModel.getImageRotation(i);
+ RawTexture texture;
+ if ((rotation % 180) == 0) {
+ texture = new RawTexture(width, height, true);
+ canvas.beginRenderTarget(texture);
+ canvas.translate(width / 2f, height / 2f);
+ } else {
+ texture = new RawTexture(height, width, true);
+ canvas.beginRenderTarget(texture);
+ canvas.translate(height / 2f, width / 2f);
+ }
+
+ canvas.rotate(rotation, 0, 0, 1);
+ canvas.translate(-width / 2f, -height / 2f);
+ sc.draw(canvas, 0, 0, width, height);
canvas.endRenderTarget();
effect.addEntry(item.getPath(), rect, texture);
}