diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-10-25 00:38:56 +0200 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-10-25 00:38:56 +0200 |
commit | 5c1404b30cd6a1ff00985137f4912e359c654fef (patch) | |
tree | 84aa9e4ab97ee5f120c9a0ffefa44fde22ea3889 /src/com/ruesga/android/wallpapers/photophase | |
parent | 44e8f594fecd90a18a6ca3107f72da1d23a019e5 (diff) | |
download | android_packages_wallpapers_PhotoPhase-5c1404b30cd6a1ff00985137f4912e359c654fef.tar.gz android_packages_wallpapers_PhotoPhase-5c1404b30cd6a1ff00985137f4912e359c654fef.tar.bz2 android_packages_wallpapers_PhotoPhase-5c1404b30cd6a1ff00985137f4912e359c654fef.zip |
Fix effects FC when device don't supports preserve_egl_context
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/com/ruesga/android/wallpapers/photophase')
-rw-r--r-- | src/com/ruesga/android/wallpapers/photophase/PhotoPhaseRenderer.java | 2 | ||||
-rw-r--r-- | src/com/ruesga/android/wallpapers/photophase/TextureManager.java | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/com/ruesga/android/wallpapers/photophase/PhotoPhaseRenderer.java b/src/com/ruesga/android/wallpapers/photophase/PhotoPhaseRenderer.java index b6e09dd..971bdc4 100644 --- a/src/com/ruesga/android/wallpapers/photophase/PhotoPhaseRenderer.java +++ b/src/com/ruesga/android/wallpapers/photophase/PhotoPhaseRenderer.java @@ -496,6 +496,8 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { recycle(); mTextureManager = new TextureManager( mContext, mHandler, mEffectContext, mDispatcher, cc, dimensions); + } else { + mTextureManager.updateEffectContext(mEffectContext); } } 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 |