aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/ruesga/android/wallpapers/photophase/TextureManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/ruesga/android/wallpapers/photophase/TextureManager.java')
-rw-r--r--src/com/ruesga/android/wallpapers/photophase/TextureManager.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/com/ruesga/android/wallpapers/photophase/TextureManager.java b/src/com/ruesga/android/wallpapers/photophase/TextureManager.java
index a21051a..45c14ca 100644
--- a/src/com/ruesga/android/wallpapers/photophase/TextureManager.java
+++ b/src/com/ruesga/android/wallpapers/photophase/TextureManager.java
@@ -52,7 +52,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
final Context mContext;
final Handler mHandler;
- final Effects mEffects;
+ Effects mEffects;
final Object mSync;
final List<TextureRequestor> mPendingRequests;
final FixedQueue<GLESTextureInfo> mQueue = new FixedQueue<GLESTextureInfo>(QUEUE_SIZE);
@@ -84,7 +84,10 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
@Override
public void run() {
try {
- Effect effect = mEffects.getNextEffect();
+ Effect effect = null;
+ synchronized (mEffects) {
+ effect = mEffects.getNextEffect();
+ }
// Load and bind to the GLES context. The effect is applied when the image
// is associated to the destination target (only if aspect ratio will be applied)
@@ -160,6 +163,22 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
}
/**
+ * Method that update the effect context if the EGL context change
+ *
+ * @param effectCtx The new effect context
+ */
+ protected void updateEffectContext(final EffectContext effectCtx) {
+ synchronized (mEffects) {
+ if (mEffects != null) {
+ mEffects.release();
+ mEffects = null;
+ }
+ mEffects = new Effects(effectCtx);
+ }
+ emptyTextureQueue(true);
+ }
+
+ /**
* Method that allow to change the preferred dimensions of the bitmaps loaded
*
* @param dimensions The new dimensions