aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-08-13 17:11:48 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-08-13 17:11:48 +0200
commit9ec2c4522d62b26e3034314e361f255fe044016c (patch)
treefc74d411ea9b35119b153dd59cd28a04520eab96 /src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java
parent675f7c51443e11d6ad89662d9f8124473cc0c148 (diff)
downloadandroid_packages_wallpapers_PhotoPhase-9ec2c4522d62b26e3034314e361f255fe044016c.tar.gz
android_packages_wallpapers_PhotoPhase-9ec2c4522d62b26e3034314e361f255fe044016c.tar.bz2
android_packages_wallpapers_PhotoPhase-9ec2c4522d62b26e3034314e361f255fe044016c.zip
Aspect ratio correction (implementation) (#14)
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java
index 29af55f..e1ddea7 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java
@@ -17,6 +17,7 @@
package org.cyanogenmod.wallpapers.photophase;
import android.content.Context;
+import android.graphics.RectF;
import android.opengl.GLES20;
import org.cyanogenmod.wallpapers.photophase.utils.GLESUtil;
@@ -87,7 +88,7 @@ public class PhotoFrame implements TextureRequestor {
mFrameHeight = frameVertex[1] - frameVertex[5];
mPhotoVertex = photoVertex;
mPhotoWidth = photoVertex[6] - photoVertex[4];
- mPhotoHeight = photoVertex[1] - photoVertex[5];
+ mPhotoHeight = photoVertex[5] - photoVertex[1];
// Initialize vertex byte buffer for shape coordinates
ByteBuffer bb = ByteBuffer.allocateDirect(photoVertex.length * 4); // (# of coordinate values * 4 bytes per float)
@@ -107,6 +108,14 @@ public class PhotoFrame implements TextureRequestor {
* {@inheritDoc}
*/
@Override
+ public RectF getRequestorDimensions() {
+ return new RectF(0, 0, mPhotoWidth, mPhotoHeight);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setTextureHandle(GLESTextureInfo ti) {
// If the picture is invalid request a new texture
if (ti == null || ti.handle <= 0) {
@@ -114,8 +123,6 @@ public class PhotoFrame implements TextureRequestor {
return;
}
- // TODO Apply the texture correction
-
// Full frame picture
setTextureHandle(ti, DEFAULT_TEXTURE_COORDS);
mLoaded = true;