diff options
author | Owen Lin <owenlin@google.com> | 2012-08-08 18:47:33 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2012-08-08 18:50:37 +0800 |
commit | 380414670b541d41216fde770b60a442bc72f642 (patch) | |
tree | d0d679ad932f647b450f6c49b45745178192135e /src/com/android/gallery3d/ui | |
parent | 4bbfbebdfb584a0c3e348f60f7a95476c43b67f6 (diff) | |
download | android_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
Diffstat (limited to 'src/com/android/gallery3d/ui')
-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); } |