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

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

Issue 25976002: Remove ImageSource::bytesDecodedToDetermineProperties() and fallout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: For landing again, rebased Created 7 years, 2 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
« no previous file with comments | « no previous file | Source/core/platform/graphics/BitmapImage.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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * Copyright (C) 2008-2009 Torch Mobile, Inc. 4 * Copyright (C) 2008-2009 Torch Mobile, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 virtual bool dataChanged(bool allDataReceived) OVERRIDE; 69 virtual bool dataChanged(bool allDataReceived) OVERRIDE;
70 virtual String filenameExtension() const OVERRIDE; 70 virtual String filenameExtension() const OVERRIDE;
71 71
72 // It may look unusual that there is no start animation call as public API. This is because 72 // It may look unusual that there is no start animation call as public API. This is because
73 // we start and stop animating lazily. Animation begins whenever someone dr aws the image. It will 73 // we start and stop animating lazily. Animation begins whenever someone dr aws the image. It will
74 // automatically pause once all observers no longer want to render the image anywhere. 74 // automatically pause once all observers no longer want to render the image anywhere.
75 virtual void stopAnimation() OVERRIDE; 75 virtual void stopAnimation() OVERRIDE;
76 virtual void resetAnimation() OVERRIDE; 76 virtual void resetAnimation() OVERRIDE;
77 77
78 virtual unsigned decodedSize() const OVERRIDE;
79
80 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE; 78 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE;
81 virtual bool currentFrameKnownToBeOpaque() OVERRIDE; 79 virtual bool currentFrameKnownToBeOpaque() OVERRIDE;
82 80
83 ImageOrientation currentFrameOrientation(); 81 ImageOrientation currentFrameOrientation();
84 82
85 #if !ASSERT_DISABLED 83 #if !ASSERT_DISABLED
86 virtual bool notSolidColor() OVERRIDE; 84 virtual bool notSolidColor() OVERRIDE;
87 #endif 85 #endif
88 86
89 private: 87 private:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void destroyDecodedDataIfNecessary(); 128 void destroyDecodedDataIfNecessary();
131 129
132 // Generally called by destroyDecodedData(), destroys whole-image metadata 130 // Generally called by destroyDecodedData(), destroys whole-image metadata
133 // and notifies observers that the memory footprint has (hopefully) 131 // and notifies observers that the memory footprint has (hopefully)
134 // decreased by |frameBytesCleared|. 132 // decreased by |frameBytesCleared|.
135 void destroyMetadataAndNotify(size_t frameBytesCleared); 133 void destroyMetadataAndNotify(size_t frameBytesCleared);
136 134
137 // Whether or not size is available yet. 135 // Whether or not size is available yet.
138 bool isSizeAvailable(); 136 bool isSizeAvailable();
139 137
140 // Called after asking the source for any information that may require
141 // decoding part of the image (e.g., the image size). We need to report
142 // the partially decoded data to our observer so it has an accurate
143 // account of the BitmapImage's memory usage.
144 void didDecodeProperties() const;
145
146 // Animation. 138 // Animation.
147 int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplet e| should be set if the caller knows the entire image has been decoded. 139 int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplet e| should be set if the caller knows the entire image has been decoded.
148 bool shouldAnimate(); 140 bool shouldAnimate();
149 virtual void startAnimation(bool catchUpIfNecessary = true) OVERRIDE; 141 virtual void startAnimation(bool catchUpIfNecessary = true) OVERRIDE;
150 void advanceAnimation(Timer<BitmapImage>*); 142 void advanceAnimation(Timer<BitmapImage>*);
151 143
152 // Function that does the real work of advancing the animation. When 144 // Function that does the real work of advancing the animation. When
153 // skippingFrames is true, we're in the middle of a loop trying to skip over 145 // skippingFrames is true, we're in the middle of a loop trying to skip over
154 // a bunch of animation frames, so we should not do things like decode each 146 // a bunch of animation frames, so we should not do things like decode each
155 // one or notify our observers. 147 // one or notify our observers.
(...skipping 16 matching lines...) Expand all
172 Vector<FrameData, 1> m_frames; // An array of the cached frames of the anima tion. We have to ref frames to pin them in the cache. 164 Vector<FrameData, 1> m_frames; // An array of the cached frames of the anima tion. We have to ref frames to pin them in the cache.
173 165
174 Timer<BitmapImage>* m_frameTimer; 166 Timer<BitmapImage>* m_frameTimer;
175 int m_repetitionCount; // How many total animation loops we should do. This will be cAnimationNone if this image type is incapable of animation. 167 int m_repetitionCount; // How many total animation loops we should do. This will be cAnimationNone if this image type is incapable of animation.
176 RepetitionCountStatus m_repetitionCountStatus; 168 RepetitionCountStatus m_repetitionCountStatus;
177 int m_repetitionsComplete; // How many repetitions we've finished. 169 int m_repetitionsComplete; // How many repetitions we've finished.
178 double m_desiredFrameStartTime; // The system time at which we hope to see the next call to startAnimation(). 170 double m_desiredFrameStartTime; // The system time at which we hope to see the next call to startAnimation().
179 171
180 Color m_solidColor; // If we're a 1x1 solid color, this is the color to use to fill. 172 Color m_solidColor; // If we're a 1x1 solid color, this is the color to use to fill.
181 173
182 unsigned m_decodedSize; // The current size of all decoded frames.
183 mutable unsigned m_decodedPropertiesSize; // The size of data decoded by the source to determine image properties (e.g. size, frame count, etc).
184 size_t m_frameCount; 174 size_t m_frameCount;
185 175
186 bool m_isSolidColor : 1; // Whether or not we are a 1x1 solid image. 176 bool m_isSolidColor : 1; // Whether or not we are a 1x1 solid image.
187 bool m_checkedForSolidColor : 1; // Whether we've checked the frame for soli d color. 177 bool m_checkedForSolidColor : 1; // Whether we've checked the frame for soli d color.
188 178
189 bool m_animationFinished : 1; // Whether or not we've completed the entire a nimation. 179 bool m_animationFinished : 1; // Whether or not we've completed the entire a nimation.
190 180
191 bool m_allDataReceived : 1; // Whether or not we've received all our data. 181 bool m_allDataReceived : 1; // Whether or not we've received all our data.
192 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable has the final overall image size yet. 182 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable has the final overall image size yet.
193 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi rst image frame yet from ImageIO. 183 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi rst image frame yet from ImageIO.
194 mutable bool m_hasUniformFrameSize : 1; 184 mutable bool m_hasUniformFrameSize : 1;
195 mutable bool m_haveFrameCount : 1; 185 mutable bool m_haveFrameCount : 1;
196 }; 186 };
197 187
198 } 188 }
199 189
200 #endif 190 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/graphics/BitmapImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698