diff options
author | Owen Lin <owenlin@google.com> | 2012-05-09 13:38:21 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2012-05-09 13:38:21 +0800 |
commit | 5bde7b562ec039f392e31a0cf39787a3e466be93 (patch) | |
tree | 51803e099c203a393a5b42c571114e37da090364 /src/com/android/gallery3d/ui/TextureUploader.java | |
parent | ebf0f78490f851766f643d3d45fa351f4e92e091 (diff) | |
download | android_packages_apps_Snap-5bde7b562ec039f392e31a0cf39787a3e466be93.tar.gz android_packages_apps_Snap-5bde7b562ec039f392e31a0cf39787a3e466be93.tar.bz2 android_packages_apps_Snap-5bde7b562ec039f392e31a0cf39787a3e466be93.zip |
Make sure we won't upload recycled bitmap.
bug: 6465117
Change-Id: I97553ba9da0256cfedde3a5752224380b1a3ee6f
Diffstat (limited to 'src/com/android/gallery3d/ui/TextureUploader.java')
-rw-r--r-- | src/com/android/gallery3d/ui/TextureUploader.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/ui/TextureUploader.java b/src/com/android/gallery3d/ui/TextureUploader.java index b651c69a4..ff7830fa2 100644 --- a/src/com/android/gallery3d/ui/TextureUploader.java +++ b/src/com/android/gallery3d/ui/TextureUploader.java @@ -64,17 +64,18 @@ public class TextureUploader implements OnGLIdleListener { synchronized (this) { if (deque.isEmpty()) break; t = deque.removeFirst(); - } - if (!t.isContentValid(canvas)) { + if (t.isContentValid(canvas)) continue; + // this has to be protected by the synchronized block + // to prevent the inner bitmap get recycled t.updateContent(canvas); - - // It will took some more time for a texture to be drawn for - // the first time. - // Thus, when scrolling, if a new column appears on screen, - // it may cause a UI jank even these textures are uploaded. - if (isBackground) t.draw(canvas, 0, 0); - --uploadQuota; } + + // It will took some more time for a texture to be drawn for + // the first time. + // Thus, when scrolling, if a new column appears on screen, + // it may cause a UI jank even these textures are uploaded. + if (isBackground) t.draw(canvas, 0, 0); + --uploadQuota; } return uploadQuota; } |