summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/UploadedTexture.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-05-18 11:30:26 -0700
committerOwen Lin <owenlin@google.com>2012-05-22 14:28:35 -0700
commit68386e085d3e2338be74996ff99672ff849467cb (patch)
tree74e1bcd78e4c172ecbd04946f1a5c4c624d265fd /src/com/android/gallery3d/ui/UploadedTexture.java
parentc5c5f2558e9ed3bc46a94c5515481b1dac9ffd77 (diff)
downloadandroid_packages_apps_Snap-68386e085d3e2338be74996ff99672ff849467cb.tar.gz
android_packages_apps_Snap-68386e085d3e2338be74996ff99672ff849467cb.tar.bz2
android_packages_apps_Snap-68386e085d3e2338be74996ff99672ff849467cb.zip
Add a new state uploading to UploadedTexture.
This state means the texture is being uploaded in background and should not be drawn now to prevent janking. Sometimes, we may lose GLContext and we will need to reupload textures again. In this case, we would like to upload these texture in foreground instead of using TextureUploader. (for simplicity since this won't happen too often). bug: 6519344 Change-Id: Ic5d7547c6a0eb4b044b79aa0eb4eb52397faac03
Diffstat (limited to 'src/com/android/gallery3d/ui/UploadedTexture.java')
-rw-r--r--src/com/android/gallery3d/ui/UploadedTexture.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/ui/UploadedTexture.java b/src/com/android/gallery3d/ui/UploadedTexture.java
index 24c8d1db6..0fe506735 100644
--- a/src/com/android/gallery3d/ui/UploadedTexture.java
+++ b/src/com/android/gallery3d/ui/UploadedTexture.java
@@ -52,6 +52,9 @@ abstract class UploadedTexture extends BasicTexture {
@SuppressWarnings("unused")
private static final String TAG = "Texture";
private boolean mContentValid = true;
+
+ // indicate this textures is being uploaded in background
+ private boolean mIsUploading = false;
private boolean mOpaque = true;
private boolean mThrottled = false;
private static int sUploadedCount;
@@ -72,6 +75,14 @@ abstract class UploadedTexture extends BasicTexture {
}
}
+ protected void setIsUploading(boolean uploading) {
+ mIsUploading = uploading;
+ }
+
+ public boolean isUploading() {
+ return mIsUploading;
+ }
+
private static class BorderKey implements Cloneable {
public boolean vertical;
public Config config;
@@ -165,8 +176,8 @@ abstract class UploadedTexture extends BasicTexture {
/**
* Whether the content on GPU is valid.
*/
- public boolean isContentValid(GLCanvas canvas) {
- return isLoaded(canvas) && mContentValid;
+ public boolean isContentValid() {
+ return isLoaded() && mContentValid;
}
/**
@@ -174,7 +185,7 @@ abstract class UploadedTexture extends BasicTexture {
* @param canvas
*/
public void updateContent(GLCanvas canvas) {
- if (!isLoaded(canvas)) {
+ if (!isLoaded()) {
if (mThrottled && ++sUploadedCount > UPLOAD_LIMIT) {
return;
}
@@ -284,7 +295,7 @@ abstract class UploadedTexture extends BasicTexture {
// Update texture state.
setAssociatedCanvas(canvas);
mId = sTextureId[0];
- mState = UploadedTexture.STATE_LOADED;
+ mState = STATE_LOADED;
mContentValid = true;
} else {
mState = STATE_ERROR;
@@ -295,7 +306,7 @@ abstract class UploadedTexture extends BasicTexture {
@Override
protected boolean onBind(GLCanvas canvas) {
updateContent(canvas);
- return isContentValid(canvas);
+ return isContentValid();
}
@Override