Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: Source/platform/graphics/ImageSource.h

Issue 284043003: Looping of animated WebP: Loop count off-by-one (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/image-decoders/webp/WEBPImageDecoder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // GIF and WebP support animation. The explanation below is in terms of GIF,
46 // The animation system and the constants below are designed with this in mind. 46 // but the same constants are used for WebP, too.
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
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 // Returns one of the cAnimationXXX constants at the top of the file, or
112 // a loop count. In the latter case, the actual number of times the animatio n
113 // cycles is one more than the loop count. See comment atop the file.
111 int repetitionCount(); 114 int repetitionCount();
112 115
113 size_t frameCount() const; 116 size_t frameCount() const;
114 117
115 PassRefPtr<NativeImageSkia> createFrameAtIndex(size_t); 118 PassRefPtr<NativeImageSkia> createFrameAtIndex(size_t);
116 119
117 float frameDurationAtIndex(size_t) const; 120 float frameDurationAtIndex(size_t) const;
118 bool frameHasAlphaAtIndex(size_t) const; // Whether or not the frame actuall y used any alpha. 121 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. 122 bool frameIsCompleteAtIndex(size_t) const; // Whether or not the frame is fu lly received.
120 ImageOrientation orientationAtIndex(size_t) const; // EXIF image orientation 123 ImageOrientation orientationAtIndex(size_t) const; // EXIF image orientation
121 124
122 // Return the number of bytes in the decoded frame. If the frame is not yet 125 // Return the number of bytes in the decoded frame. If the frame is not yet
123 // decoded then return 0. 126 // decoded then return 0.
124 unsigned frameBytesAtIndex(size_t) const; 127 unsigned frameBytesAtIndex(size_t) const;
125 128
126 private: 129 private:
127 OwnPtr<DeferredImageDecoder> m_decoder; 130 OwnPtr<DeferredImageDecoder> m_decoder;
128 131
129 AlphaOption m_alphaOption; 132 AlphaOption m_alphaOption;
130 GammaAndColorProfileOption m_gammaAndColorProfileOption; 133 GammaAndColorProfileOption m_gammaAndColorProfileOption;
131 }; 134 };
132 135
133 } 136 }
134 137
135 #endif 138 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/image-decoders/webp/WEBPImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698