diff options
author | Bobby Georgescu <georgescu@google.com> | 2012-10-24 14:15:38 -0700 |
---|---|---|
committer | Bobby Georgescu <georgescu@google.com> | 2012-10-24 14:15:38 -0700 |
commit | eab224a54a9b8d1a87ce23036402a234518c1109 (patch) | |
tree | 0a4bf1218f09fb14cdd387599372a54a986c1915 | |
parent | 354998d14f170e278339c1a8c0639298c970440c (diff) | |
download | android_packages_apps_Snap-eab224a54a9b8d1a87ce23036402a234518c1109.tar.gz android_packages_apps_Snap-eab224a54a9b8d1a87ce23036402a234518c1109.tar.bz2 android_packages_apps_Snap-eab224a54a9b8d1a87ce23036402a234518c1109.zip |
Fix attempted uploading of recycled tiles
Bug: 7405398
Change-Id: I17711f9c724af216aa22cee6a86d9feba84c1548
-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; } |