aboutsummaryrefslogtreecommitdiff
path: root/third_party/gif_decoder
diff options
context:
space:
mode:
authorSam Judd <judds@google.com>2014-10-21 08:19:48 -0700
committerSam Judd <judds@google.com>2014-10-21 08:29:41 -0700
commit6958330c93825bbfb70aea1aff9aeed76b59af4e (patch)
tree49cc0b1530b1c810bdcaff98e5702ede8aa56e7b /third_party/gif_decoder
parentb4cc7fa5f667e4a56514823cf2ad85d7435b498a (diff)
downloadglide-6958330c93825bbfb70aea1aff9aeed76b59af4e.tar.gz
Clean up GifDrawable resources more reliably.
Each time we call get() on a drawable resource, we get a new Drawable. We call get() repeatedly on resources when they are retrieved from either the set of active resources or the in memory cache. Each time we create a new GifDrawable it holds on to one or two temporary Bitmaps outside it's shared state to render the current frame and obey the dispose_previous method. This change means we more aggressively cleanup those resources when we think each Drawable is no longer being used. The side affect is that we may reset back to the beginning of the Drawable in some circumstances. Cleanup in in memory resources makes it less likely that frames would be retrieved from in memory, so this also works toward #207.
Diffstat (limited to 'third_party/gif_decoder')
-rw-r--r--third_party/gif_decoder/src/main/java/com/bumptech/glide/gifdecoder/GifDecoder.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/third_party/gif_decoder/src/main/java/com/bumptech/glide/gifdecoder/GifDecoder.java b/third_party/gif_decoder/src/main/java/com/bumptech/glide/gifdecoder/GifDecoder.java
index df891af7..92dc3bfc 100644
--- a/third_party/gif_decoder/src/main/java/com/bumptech/glide/gifdecoder/GifDecoder.java
+++ b/third_party/gif_decoder/src/main/java/com/bumptech/glide/gifdecoder/GifDecoder.java
@@ -230,6 +230,10 @@ public class GifDecoder {
return framePointer;
}
+ public void resetFrameIndex() {
+ framePointer = -1;
+ }
+
/**
* Gets the "Netscape" iteration count, if any. A count of 0 means repeat indefinitely.
*