image_animation_count.h 1.3 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef CC_PAINT_IMAGE_ANIMATION_COUNT_H_
  5. #define CC_PAINT_IMAGE_ANIMATION_COUNT_H_
  6. namespace cc {
  7. // GIF and WebP support animation. The explanation below is in terms of GIF,
  8. // but the same constants are used for WebP, too.
  9. // GIFs have an optional 16-bit unsigned loop count that describes how an
  10. // animated GIF should be cycled. If the loop count is absent, the animation
  11. // cycles once; if it is 0, the animation cycles infinitely; otherwise the
  12. // animation plays n + 1 cycles (where n is the specified loop count). If the
  13. // GIF decoder defaults to kAnimationLoopOnce in the absence of any loop count
  14. // and translates an explicit "0" loop count to kAnimationLoopInfinite, then we
  15. // get a couple of nice side effects:
  16. // * By making kAnimationLoopOnce be 0, we allow the animation cycling code in
  17. // BitmapImage.cpp to avoid special-casing it, and simply treat all
  18. // non-negative loop counts identically.
  19. // * By making the other two constants negative, we avoid conflicts with any
  20. // real loop count values.
  21. const int kAnimationLoopOnce = 0;
  22. const int kAnimationLoopInfinite = -1;
  23. const int kAnimationNone = -2;
  24. } // namespace cc
  25. #endif // CC_PAINT_IMAGE_ANIMATION_COUNT_H_