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

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

Issue 15350006: Decode GIF image frames on demand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
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 * Copyright (C) 2007-2008 Torch Mobile, Inc. 3 * Copyright (C) 2007-2008 Torch Mobile, Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 enum GammaAndColorProfileOption { 75 enum GammaAndColorProfileOption {
76 GammaAndColorProfileApplied, 76 GammaAndColorProfileApplied,
77 GammaAndColorProfileIgnored 77 GammaAndColorProfileIgnored
78 }; 78 };
79 79
80 ImageSource(AlphaOption alphaOption = AlphaPremultiplied, GammaAndColorProfi leOption gammaAndColorProfileOption = GammaAndColorProfileApplied); 80 ImageSource(AlphaOption alphaOption = AlphaPremultiplied, GammaAndColorProfi leOption gammaAndColorProfileOption = GammaAndColorProfileApplied);
81 ~ImageSource(); 81 ~ImageSource();
82 82
83 // Tells the ImageSource that the Image no longer cares about decoded frame 83 // Tells the ImageSource that the Image no longer cares about decoded frame
84 // data -- at all (if |destroyAll| is true), or before frame 84 // data -- at all (if |destroyAll| is true), or except frame
85 // |clearBeforeFrame| (if |destroyAll| is false). The ImageSource should 85 // |clearExceptFrame| (if |destroyAll| is false). The ImageSource should
86 // delete cached decoded data for these frames where possible to keep memory 86 // delete cached decoded data for these frames where possible to keep memory
87 // usage low. When |destroyAll| is true, the ImageSource should also reset 87 // usage low. When |destroyAll| is true, the ImageSource should also reset
88 // any local state so that decoding can begin again. 88 // any local state so that decoding can begin again.
89 // 89 //
90 // Implementations that delete less than what's specified above waste 90 // Implementations that delete less than what's specified above waste
Peter Kasting 2013/05/24 03:15:22 Nit: Change "waste" to "may waste", since ultimate
Xianzhu 2013/05/28 22:54:21 Done.
91 // memory. Implementations that delete more may burn CPU re-decoding frames 91 // memory. Implementations that delete more may burn CPU re-decoding frames
92 // that could otherwise have been cached, or encounter errors if they're 92 // that could otherwise have been cached, or encounter errors if they're
93 // asked to decode frames they can't decode due to the loss of previous 93 // asked to decode frames they can't decode due to the loss of previous
94 // decoded frames. 94 // decoded frames.
95 // 95 //
96 // Callers should not call clear(false, n) and subsequently call
97 // createFrameAtIndex(m) with m < n, unless they first call clear(true).
98 // This ensures that stateful ImageSources/decoders will work properly.
99 //
100 // The |data| and |allDataReceived| parameters should be supplied by callers 96 // The |data| and |allDataReceived| parameters should be supplied by callers
101 // who set |destroyAll| to true if they wish to be able to continue using 97 // who set |destroyAll| to true if they wish to be able to continue using
102 // the ImageSource. This way implementations which choose to destroy their 98 // the ImageSource. This way implementations which choose to destroy their
103 // decoders in some cases can reconstruct them correctly. 99 // decoders in some cases can reconstruct them correctly.
104 void clear(bool destroyAll, 100 void clear(bool destroyAll, size_t clearExceptFrame = 0, SharedBuffer* data = 0, bool allDataReceived = false);
105 size_t clearBeforeFrame = 0,
106 SharedBuffer* data = NULL,
107 bool allDataReceived = false);
108 101
109 bool initialized() const; 102 bool initialized() const;
110 103
111 void setData(SharedBuffer* data, bool allDataReceived); 104 void setData(SharedBuffer* data, bool allDataReceived);
112 String filenameExtension() const; 105 String filenameExtension() const;
113 106
114 bool isSizeAvailable(); 107 bool isSizeAvailable();
115 IntSize size(RespectImageOrientationEnum = DoNotRespectImageOrientation) con st; 108 IntSize size(RespectImageOrientationEnum = DoNotRespectImageOrientation) con st;
116 IntSize frameSizeAtIndex(size_t, RespectImageOrientationEnum = DoNotRespectI mageOrientation) const; 109 IntSize frameSizeAtIndex(size_t, RespectImageOrientationEnum = DoNotRespectI mageOrientation) const;
117 110
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 AlphaOption m_alphaOption; 142 AlphaOption m_alphaOption;
150 GammaAndColorProfileOption m_gammaAndColorProfileOption; 143 GammaAndColorProfileOption m_gammaAndColorProfileOption;
151 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) 144 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
152 static unsigned s_maxPixelsPerDecodedImage; 145 static unsigned s_maxPixelsPerDecodedImage;
153 #endif 146 #endif
154 }; 147 };
155 148
156 } 149 }
157 150
158 #endif 151 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698