diff options
author | Owen Lin <owenlin@google.com> | 2012-08-08 19:53:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-08 19:53:31 -0700 |
commit | 9fde84052f44308046067c8f1c7ab9b24320dc70 (patch) | |
tree | ce45491cc15fddaf4aeaa21d7022785233747bd6 | |
parent | 2af39076c256030229f12427b60221b0cbfa85eb (diff) | |
parent | 380414670b541d41216fde770b60a442bc72f642 (diff) | |
download | android_packages_apps_Snap-9fde84052f44308046067c8f1c7ab9b24320dc70.tar.gz android_packages_apps_Snap-9fde84052f44308046067c8f1c7ab9b24320dc70.tar.bz2 android_packages_apps_Snap-9fde84052f44308046067c8f1c7ab9b24320dc70.zip |
Merge "Rotate the texture in building PhotoFallbackEffect" into gb-ub-photos-arches
-rw-r--r-- | src/com/android/gallery3d/ui/PhotoView.java | 21 |
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); } |