diff options
Diffstat (limited to 'WebCore/platform/graphics/ImageSource.h')
-rw-r--r-- | WebCore/platform/graphics/ImageSource.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h index 5c6d75e..d9bfa25 100644 --- a/WebCore/platform/graphics/ImageSource.h +++ b/WebCore/platform/graphics/ImageSource.h @@ -115,7 +115,22 @@ typedef RefPtr<SharedBitmap> NativeImagePtr; #endif #endif -const int cAnimationLoopOnce = -1; +// Right now GIFs are the only recognized image format that supports animation. +// The animation system and the constants below are designed with this in mind. +// 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; class ImageSource : public Noncopyable { |