aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-08-06 01:47:05 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-08-06 01:47:05 +0200
commit6ab3912f76d8886ccfc88def25c18819a0594f07 (patch)
treeb18b0800e82bdf4251c2bee8d892fcdfa9baf553 /src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
parent660adfa9453ada61b8753dcac1adc5b9b0972b62 (diff)
downloadandroid_packages_wallpapers_PhotoPhase-6ab3912f76d8886ccfc88def25c18819a0594f07.tar.gz
android_packages_wallpapers_PhotoPhase-6ab3912f76d8886ccfc88def25c18819a0594f07.tar.bz2
android_packages_wallpapers_PhotoPhase-6ab3912f76d8886ccfc88def25c18819a0594f07.zip
Support fot GPU image effects (#2)
Initial support of android.media.effects. Note: Transitions are broken now, and must be fixed Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/TextureManager.java')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/TextureManager.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
index ac05b77..9c0d3d0 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
@@ -18,6 +18,7 @@ package org.cyanogenmod.wallpapers.photophase;
import android.content.Context;
import android.graphics.Rect;
+import android.media.effect.EffectContext;
import android.opengl.GLES20;
import android.util.Log;
@@ -44,6 +45,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
static final List<GLESTextureInfo> sRecycledBitmaps = new ArrayList<GLESTextureInfo>();
final Context mContext;
+ final EffectContext mEffectContext;
final Object mSync;
final List<TextureRequestor> mPendingRequests;
final FixedQueue<GLESTextureInfo> mQueue = new FixedQueue<GLESTextureInfo>(QUEUE_SIZE);
@@ -74,12 +76,14 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
if (sRecycledBitmaps.size() > 0) {
// Bind to the GLES context
GLESTextureInfo oldTextureInfo = sRecycledBitmaps.remove(0);
- ti = GLESUtil.loadTexture(oldTextureInfo.bitmap);
+ ti = GLESUtil.loadTexture(oldTextureInfo.bitmap,
+ Effects.getNextEffect(mEffectContext), mDimensions);
ti.path = oldTextureInfo.path;
oldTextureInfo.bitmap = null;
} else {
// Load and bind to the GLES context
- ti = GLESUtil.loadTexture(mImage, mDimensions, Effects.getNextEffect(), false);
+ ti = GLESUtil.loadTexture(mImage, mDimensions,
+ Effects.getNextEffect(mEffectContext), mDimensions, false);
}
synchronized (mSync) {
@@ -111,13 +115,16 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
* Constructor of <code>TextureManager</code>
*
* @param ctx The current context
+ * @param effectCtx The current effect context
* @param dispatcher The GLES dispatcher
* @param requestors The number of requestors
* @param dimensions The desired dimensions for the decoded bitmaps
*/
- public TextureManager(final Context ctx, GLESSurfaceDispatcher dispatcher, int requestors, Rect dimensions) {
+ public TextureManager(final Context ctx, final EffectContext effectCtx,
+ GLESSurfaceDispatcher dispatcher, int requestors, Rect dimensions) {
super();
mContext = ctx;
+ mEffectContext = effectCtx;
mDispatcher = dispatcher;
mDimensions = dimensions;
mSync = new Object();