Index: Source/platform/image-decoders/ImageDecoder.h |
diff --git a/Source/platform/image-decoders/ImageDecoder.h b/Source/platform/image-decoders/ImageDecoder.h |
index 178b6f57dc590c456945b12db5bef28459c9c99e..72d3edae2f6c68b6351c2f709c0791670bd8a9e2 100644 |
--- a/Source/platform/image-decoders/ImageDecoder.h |
+++ b/Source/platform/image-decoders/ImageDecoder.h |
@@ -47,6 +47,24 @@ typedef Vector<char> ColorProfile; |
namespace blink { |
+// GIF and WebP support animation. The explanation below is in terms of GIF, |
+// but the same constants are used for WebP, too. |
+// GIFs have an optional 16-bit unsigned loop count that describes how an |
+// animated GIF should be cycled. If the loop count is absent, the animation |
+// cycles once; if it is 0, the animation cycles infinitely; otherwise the |
+// animation plays n + 1 cycles (where n is the specified loop count). If the |
+// GIF decoder defaults to cAnimationLoopOnce in the absence of any loop count |
+// and translates an explicit "0" loop count to cAnimationLoopInfinite, then we |
+// get a couple of nice side effects: |
+// * By making cAnimationLoopOnce be 0, we allow the animation cycling code in |
+// BitmapImage.cpp to avoid special-casing it, and simply treat all |
+// non-negative loop counts identically. |
+// * By making the other two constants negative, we avoid conflicts with any |
+// real loop count values. |
+const int cAnimationLoopOnce = 0; |
+const int cAnimationLoopInfinite = -1; |
+const int cAnimationNone = -2; |
+ |
// ImagePlanes can be used to decode color components into provided buffers instead of using an ImageFrame. |
class PLATFORM_EXPORT ImagePlanes { |
public: |