summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r--src/com/android/gallery3d/ui/GLRoot.java2
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java24
2 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/ui/GLRoot.java b/src/com/android/gallery3d/ui/GLRoot.java
index 313d81a5f..5ed323a88 100644
--- a/src/com/android/gallery3d/ui/GLRoot.java
+++ b/src/com/android/gallery3d/ui/GLRoot.java
@@ -41,4 +41,6 @@ public interface GLRoot {
public int getDisplayRotation();
public int getCompensation();
public Matrix getCompensationMatrix();
+ public void freeze();
+ public void unfreeze();
}
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index 7f8f1f4ff..1f25b9085 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -33,6 +33,7 @@ import com.android.gallery3d.util.Profile;
import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import javax.microedition.khronos.egl.EGLConfig;
@@ -97,6 +98,9 @@ public class GLRootView extends GLSurfaceView
private final IdleRunner mIdleRunner = new IdleRunner();
private final ReentrantLock mRenderLock = new ReentrantLock();
+ private final Condition mFreezeCondition =
+ mRenderLock.newCondition();
+ private boolean mFreeze;
private long mLastDrawFinishTime;
private boolean mInDownState = false;
@@ -301,6 +305,11 @@ public class GLRootView extends GLSurfaceView
t0 = System.nanoTime();
}
mRenderLock.lock();
+
+ while (mFreeze) {
+ mFreezeCondition.awaitUninterruptibly();
+ }
+
try {
onDrawFrameLocked(gl);
} finally {
@@ -486,4 +495,19 @@ public class GLRootView extends GLSurfaceView
public Matrix getCompensationMatrix() {
return mCompensationMatrix;
}
+
+ @Override
+ public void freeze() {
+ mRenderLock.lock();
+ mFreeze = true;
+ mRenderLock.unlock();
+ }
+
+ @Override
+ public void unfreeze() {
+ mRenderLock.lock();
+ mFreeze = false;
+ mFreezeCondition.signalAll();
+ mRenderLock.unlock();
+ }
}