OLD | NEW |
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, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 , m_repetitionCount(cAnimationNone) | 60 , m_repetitionCount(cAnimationNone) |
61 , m_repetitionCountStatus(Unknown) | 61 , m_repetitionCountStatus(Unknown) |
62 , m_repetitionsComplete(0) | 62 , m_repetitionsComplete(0) |
63 , m_desiredFrameStartTime(0) | 63 , m_desiredFrameStartTime(0) |
64 , m_frameCount(0) | 64 , m_frameCount(0) |
65 , m_animationPolicy(ImageAnimationPolicyAllowed) | 65 , m_animationPolicy(ImageAnimationPolicyAllowed) |
66 , m_animationFinished(false) | 66 , m_animationFinished(false) |
67 , m_allDataReceived(false) | 67 , m_allDataReceived(false) |
68 , m_haveSize(false) | 68 , m_haveSize(false) |
69 , m_sizeAvailable(false) | 69 , m_sizeAvailable(false) |
70 , m_hasUniformFrameSize(true) | |
71 , m_haveFrameCount(false) | 70 , m_haveFrameCount(false) |
72 { | 71 { |
73 } | 72 } |
74 | 73 |
75 BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) | 74 BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) |
76 : Image(observer) | 75 : Image(observer) |
77 , m_size(bitmap.width(), bitmap.height()) | 76 , m_size(bitmap.width(), bitmap.height()) |
78 , m_currentFrame(0) | 77 , m_currentFrame(0) |
79 , m_repetitionCount(cAnimationNone) | 78 , m_repetitionCount(cAnimationNone) |
80 , m_repetitionCountStatus(Unknown) | 79 , m_repetitionCountStatus(Unknown) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 m_frames[index].m_frame = m_source.createFrameAtIndex(index); | 159 m_frames[index].m_frame = m_source.createFrameAtIndex(index); |
161 | 160 |
162 m_frames[index].m_orientation = m_source.orientationAtIndex(index); | 161 m_frames[index].m_orientation = m_source.orientationAtIndex(index); |
163 m_frames[index].m_haveMetadata = true; | 162 m_frames[index].m_haveMetadata = true; |
164 m_frames[index].m_isComplete = m_source.frameIsCompleteAtIndex(index); | 163 m_frames[index].m_isComplete = m_source.frameIsCompleteAtIndex(index); |
165 if (repetitionCount(false) != cAnimationNone) | 164 if (repetitionCount(false) != cAnimationNone) |
166 m_frames[index].m_duration = m_source.frameDurationAtIndex(index); | 165 m_frames[index].m_duration = m_source.frameDurationAtIndex(index); |
167 m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index); | 166 m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index); |
168 m_frames[index].m_frameBytes = m_source.frameBytesAtIndex(index); | 167 m_frames[index].m_frameBytes = m_source.frameBytesAtIndex(index); |
169 | 168 |
170 const IntSize frameSize(index ? m_source.frameSizeAtIndex(index) : m_size); | |
171 if (frameSize != m_size) | |
172 m_hasUniformFrameSize = false; | |
173 | |
174 notifyMemoryChanged(); | 169 notifyMemoryChanged(); |
175 } | 170 } |
176 | 171 |
177 void BitmapImage::updateSize() const | 172 void BitmapImage::updateSize() const |
178 { | 173 { |
179 if (!m_sizeAvailable || m_haveSize) | 174 if (!m_sizeAvailable || m_haveSize) |
180 return; | 175 return; |
181 | 176 |
182 m_size = m_source.size(); | 177 m_size = m_source.size(); |
183 m_sizeRespectingOrientation = m_source.size(RespectImageOrientation); | 178 m_sizeRespectingOrientation = m_source.size(RespectImageOrientation); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (m_frames[i].m_haveMetadata && !m_frames[i].m_isComplete) | 224 if (m_frames[i].m_haveMetadata && !m_frames[i].m_isComplete) |
230 m_frames[i].clear(true); | 225 m_frames[i].clear(true); |
231 } | 226 } |
232 | 227 |
233 // Feed all the data we've seen so far to the image decoder. | 228 // Feed all the data we've seen so far to the image decoder. |
234 m_allDataReceived = allDataReceived; | 229 m_allDataReceived = allDataReceived; |
235 ASSERT(data()); | 230 ASSERT(data()); |
236 m_source.setData(*data(), allDataReceived); | 231 m_source.setData(*data(), allDataReceived); |
237 | 232 |
238 m_haveFrameCount = false; | 233 m_haveFrameCount = false; |
239 m_hasUniformFrameSize = true; | |
240 return isSizeAvailable(); | 234 return isSizeAvailable(); |
241 } | 235 } |
242 | 236 |
243 bool BitmapImage::hasColorProfile() const | 237 bool BitmapImage::hasColorProfile() const |
244 { | 238 { |
245 return m_source.hasColorProfile(); | 239 return m_source.hasColorProfile(); |
246 } | 240 } |
247 | 241 |
248 String BitmapImage::filenameExtension() const | 242 String BitmapImage::filenameExtension() const |
249 { | 243 { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 destroyDecodedDataIfNecessary(); | 622 destroyDecodedDataIfNecessary(); |
629 | 623 |
630 // We need to draw this frame if we advanced to it while not skipping, or if | 624 // We need to draw this frame if we advanced to it while not skipping, or if |
631 // while trying to skip frames we hit the last frame and thus had to stop. | 625 // while trying to skip frames we hit the last frame and thus had to stop. |
632 if (skippingFrames != advancedAnimation) | 626 if (skippingFrames != advancedAnimation) |
633 getImageObserver()->animationAdvanced(this); | 627 getImageObserver()->animationAdvanced(this); |
634 return advancedAnimation; | 628 return advancedAnimation; |
635 } | 629 } |
636 | 630 |
637 } // namespace blink | 631 } // namespace blink |
OLD | NEW |