aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/TextureManager.java')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/TextureManager.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
index 417cfb9..65987c3 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
@@ -89,22 +89,27 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
effect = mEffects.getNextEffect();
}
+ boolean enqueue = false;
+ synchronized (mSync) {
+ enqueue = mPendingRequests.size() == 0;
+ }
+
// 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)
if (!Preferences.General.isFixAspectRatio()) {
ti = GLESUtil.loadTexture(
- mImage, mDimensions, effect, mDimensions, false);
+ mImage, mDimensions, effect, mDimensions, false, enqueue);
} else {
- ti = GLESUtil.loadTexture(mImage, mDimensions, null, null, false);
+ ti = GLESUtil.loadTexture(mImage, mDimensions, null, null, false, enqueue);
ti.effect = effect;
}
synchronized (mSync) {
// Notify the new images to all pending frames
- if (mPendingRequests.size() > 0) {
+ if (!enqueue) {
// Invalid textures are also reported, so requestor can handle it
TextureRequestor requestor = mPendingRequests.remove(0);
- fixAspectRatio(requestor, ti);
+ fixAspectRatio(requestor, ti, false);
requestor.setTextureHandle(ti);
// Clean up memory
@@ -247,7 +252,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
synchronized (mSync) {
try {
GLESTextureInfo ti = mQueue.remove();
- fixAspectRatio(requestor, ti);
+ fixAspectRatio(requestor, ti, true);
requestor.setTextureHandle(ti);
// Clean up memory
@@ -431,8 +436,9 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
* @param request The requestor target
* @param ti The original texture information
* @param effect The effect to apply to the destination picture
+ * @param compress Compress the texture
*/
- void fixAspectRatio(TextureRequestor requestor, GLESTextureInfo ti) {
+ void fixAspectRatio(TextureRequestor requestor, GLESTextureInfo ti, boolean compress) {
// Check if we have to apply any correction to the image
if (Preferences.General.isFixAspectRatio()) {
// Transform requestor dimensions to screen dimensions
@@ -449,7 +455,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
pixels.width(),
pixels.height(),
ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
- GLESTextureInfo dst = GLESUtil.loadTexture(thumb, ti.effect, pixels);
+ GLESTextureInfo dst = GLESUtil.loadTexture(thumb, ti.effect, pixels, compress);
// Destroy references
int[] textures = new int[]{ti.handle};