diff options
author | Bobby Georgescu <georgescu@google.com> | 2012-10-24 14:25:38 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-24 14:25:39 -0700 |
commit | 68a664431ea1ffdfca53411e8c70ced00bf8dcbc (patch) | |
tree | d1a53a307be88c3fb1dd2b6a458a8460789ce386 /src/com | |
parent | 80a35b17989ee57b706cd18cfe8c5d928f08eeda (diff) | |
parent | eab224a54a9b8d1a87ce23036402a234518c1109 (diff) | |
download | android_packages_apps_Snap-68a664431ea1ffdfca53411e8c70ced00bf8dcbc.tar.gz android_packages_apps_Snap-68a664431ea1ffdfca53411e8c70ced00bf8dcbc.tar.bz2 android_packages_apps_Snap-68a664431ea1ffdfca53411e8c70ced00bf8dcbc.zip |
Merge "Fix attempted uploading of recycled tiles" into gb-ub-photos-arches
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/gallery3d/ui/TiledTexture.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/ui/TiledTexture.java b/src/com/android/gallery3d/ui/TiledTexture.java index 8598a3fff..2c685bd0f 100644 --- a/src/com/android/gallery3d/ui/TiledTexture.java +++ b/src/com/android/gallery3d/ui/TiledTexture.java @@ -164,14 +164,19 @@ public class TiledTexture implements Texture { if (mUploadIndex == mTiles.length) return true; Tile next = mTiles[mUploadIndex++]; - boolean hasBeenLoad = next.isLoaded(); - next.updateContent(canvas); - - // It will take some time for a texture to be drawn for the first - // time. When scrolling, we need to draw several tiles on the screen - // at the same time. It may cause a UI jank even these textures has - // been uploaded. - if (!hasBeenLoad) next.draw(canvas, 0, 0); + + // Make sure tile has not already been recycled by the time + // this is called (race condition in onGLIdle) + if (next.bitmap != null) { + boolean hasBeenLoad = next.isLoaded(); + next.updateContent(canvas); + + // It will take some time for a texture to be drawn for the first + // time. When scrolling, we need to draw several tiles on the screen + // at the same time. It may cause a UI jank even these textures has + // been uploaded. + if (!hasBeenLoad) next.draw(canvas, 0, 0); + } return mUploadIndex == mTiles.length; } |