Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 class DeferredImageDecoder; | 38 class DeferredImageDecoder; |
| 39 class ImageOrientation; | 39 class ImageOrientation; |
| 40 class IntPoint; | 40 class IntPoint; |
| 41 class IntSize; | 41 class IntSize; |
| 42 class NativeImageSkia; | 42 class NativeImageSkia; |
| 43 class SharedBuffer; | 43 class SharedBuffer; |
| 44 | 44 |
| 45 // Right now GIFs are the only recognized image format that supports animation. | 45 // Right now GIFs and WebPs are the only recognized image formats that support a nimation. |
| 46 // The animation system and the constants below are designed with this in mind. | 46 // But the animation system and the constants below are designed with GIFs in mi nd. |
|
Peter Kasting
2014/05/14 21:47:04
Nit: How about:
// GIF and WebP support animati
urvang (Google)
2014/05/14 22:19:50
Done.
| |
| 47 // GIFs have an optional 16-bit unsigned loop count that describes how an | 47 // GIFs have an optional 16-bit unsigned loop count that describes how an |
| 48 // animated GIF should be cycled. If the loop count is absent, the animation | 48 // animated GIF should be cycled. If the loop count is absent, the animation |
| 49 // cycles once; if it is 0, the animation cycles infinitely; otherwise the | 49 // cycles once; if it is 0, the animation cycles infinitely; otherwise the |
| 50 // animation plays n + 1 cycles (where n is the specified loop count). If the | 50 // animation plays n + 1 cycles (where n is the specified loop count). If the |
| 51 // GIF decoder defaults to cAnimationLoopOnce in the absence of any loop count | 51 // GIF decoder defaults to cAnimationLoopOnce in the absence of any loop count |
| 52 // and translates an explicit "0" loop count to cAnimationLoopInfinite, then we | 52 // and translates an explicit "0" loop count to cAnimationLoopInfinite, then we |
| 53 // get a couple of nice side effects: | 53 // get a couple of nice side effects: |
| 54 // * By making cAnimationLoopOnce be 0, we allow the animation cycling code in | 54 // * By making cAnimationLoopOnce be 0, we allow the animation cycling code in |
| 55 // BitmapImage.cpp to avoid special-casing it, and simply treat all | 55 // BitmapImage.cpp to avoid special-casing it, and simply treat all |
| 56 // non-negative loop counts identically. | 56 // non-negative loop counts identically. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 void setData(SharedBuffer& data, bool allDataReceived); | 101 void setData(SharedBuffer& data, bool allDataReceived); |
| 102 String filenameExtension() const; | 102 String filenameExtension() const; |
| 103 | 103 |
| 104 bool isSizeAvailable(); | 104 bool isSizeAvailable(); |
| 105 bool hasColorProfile() const; | 105 bool hasColorProfile() const; |
| 106 IntSize size(RespectImageOrientationEnum = DoNotRespectImageOrientation) con st; | 106 IntSize size(RespectImageOrientationEnum = DoNotRespectImageOrientation) con st; |
| 107 IntSize frameSizeAtIndex(size_t, RespectImageOrientationEnum = DoNotRespectI mageOrientation) const; | 107 IntSize frameSizeAtIndex(size_t, RespectImageOrientationEnum = DoNotRespectI mageOrientation) const; |
| 108 | 108 |
| 109 bool getHotSpot(IntPoint&) const; | 109 bool getHotSpot(IntPoint&) const; |
| 110 | 110 |
| 111 // If return value is 'r', then: | |
| 112 // * If r == cAnimationNone, then it is a non-animated image. | |
| 113 // * If r == cAnimationLoopInfinite, then animation play infinitely. | |
| 114 // * Otherwise, animation plays |r + 1| times. | |
|
Peter Kasting
2014/05/14 21:47:04
Nit: How about:
// Returns one of the cAnimat
urvang (Google)
2014/05/14 22:19:50
Done.
| |
| 115 // See comment at the top of this file for more info. | |
| 111 int repetitionCount(); | 116 int repetitionCount(); |
| 112 | 117 |
| 113 size_t frameCount() const; | 118 size_t frameCount() const; |
| 114 | 119 |
| 115 PassRefPtr<NativeImageSkia> createFrameAtIndex(size_t); | 120 PassRefPtr<NativeImageSkia> createFrameAtIndex(size_t); |
| 116 | 121 |
| 117 float frameDurationAtIndex(size_t) const; | 122 float frameDurationAtIndex(size_t) const; |
| 118 bool frameHasAlphaAtIndex(size_t) const; // Whether or not the frame actuall y used any alpha. | 123 bool frameHasAlphaAtIndex(size_t) const; // Whether or not the frame actuall y used any alpha. |
| 119 bool frameIsCompleteAtIndex(size_t) const; // Whether or not the frame is fu lly received. | 124 bool frameIsCompleteAtIndex(size_t) const; // Whether or not the frame is fu lly received. |
| 120 ImageOrientation orientationAtIndex(size_t) const; // EXIF image orientation | 125 ImageOrientation orientationAtIndex(size_t) const; // EXIF image orientation |
| 121 | 126 |
| 122 // Return the number of bytes in the decoded frame. If the frame is not yet | 127 // Return the number of bytes in the decoded frame. If the frame is not yet |
| 123 // decoded then return 0. | 128 // decoded then return 0. |
| 124 unsigned frameBytesAtIndex(size_t) const; | 129 unsigned frameBytesAtIndex(size_t) const; |
| 125 | 130 |
| 126 private: | 131 private: |
| 127 OwnPtr<DeferredImageDecoder> m_decoder; | 132 OwnPtr<DeferredImageDecoder> m_decoder; |
| 128 | 133 |
| 129 AlphaOption m_alphaOption; | 134 AlphaOption m_alphaOption; |
| 130 GammaAndColorProfileOption m_gammaAndColorProfileOption; | 135 GammaAndColorProfileOption m_gammaAndColorProfileOption; |
| 131 }; | 136 }; |
| 132 | 137 |
| 133 } | 138 } |
| 134 | 139 |
| 135 #endif | 140 #endif |
| OLD | NEW |