You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Because Animated WebP supports dispose method, which means frames can based on previous canvas context. However, if we clear canvas and loop from the 0 index until the request index, it's harm for performance.
800
+
// But when one frame's dispose method is `WEBP_MUX_DISPOSE_BACKGROUND`, the canvas is cleared after the frame decoded. And subsequent frames are not effected by that frame.
801
+
// So, we calculate each frame's `blendFromIndex`. Then directly draw canvas from that index, instead of always from 0 index.
802
+
798
803
if (_currentBlendIndex + 1 == index) {
799
-
// If current blend index is equal to request index, normal serial process
804
+
// If the request index is subsequence of current blend index, it does not matter what dispose method is. The canvas is always ready.
800
805
_currentBlendIndex = index;
806
+
NSUInteger startIndex = index;
801
807
// libwebp's index start with 1
802
-
if (!WebPDemuxGetFrame(_demux, (int)(index + 1), &iter)) {
808
+
if (!WebPDemuxGetFrame(_demux, (int)(startIndex + 1), &iter)) {
// Else, this can happen when one image set to different imageViews or one loop end. So we should clear the shared cavans.
813
+
// Else, this can happen when one image set to different imageViews or one loop end. So we should clear the canvas. Then draw until the canvas is ready.
0 commit comments