forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only overflow the cache for one required frame (flutter#7048)
Previously codec.cc needed all required frames to already be decoded before it could decode any of their dependent frames. To accomplish this it would always cache required frames, regardless of cache limit. However both GIF and WEBP (the only currently supported animated image formats) only allow the image to depend on one decoded frame at a time. This means that there's no reason to cache all the required frames since it's only valid for the image formats to require one previously decoded frame at a time. (For example, frame 10 and frame 11 in a hypothetical animated image could all depend on frame 9. But no subsequent frame after frame 9 could depend on frames 0-8.) Frames are always added to the cache as long as they're under the limit, and never removed. Required frames are always stored as a separate member on `MultiFrameCodec`. Warning: this logic will break if we decide to support more animated formats in the future. Fixes flutter/flutter#24835.
- Loading branch information
Michael Klimushyn
authored
Dec 22, 2018
1 parent
b6880bb
commit 770536a
Showing
2 changed files
with
41 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters