OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 bool DeferredImageDecoder::frameHasAlphaAtIndex(size_t index) const | 173 bool DeferredImageDecoder::frameHasAlphaAtIndex(size_t index) const |
174 { | 174 { |
175 if (m_actualDecoder) | 175 if (m_actualDecoder) |
176 return m_actualDecoder->frameHasAlphaAtIndex(index); | 176 return m_actualDecoder->frameHasAlphaAtIndex(index); |
177 if (!m_frameGenerator->isMultiFrame()) | 177 if (!m_frameGenerator->isMultiFrame()) |
178 return m_frameGenerator->hasAlpha(index); | 178 return m_frameGenerator->hasAlpha(index); |
179 return true; | 179 return true; |
180 } | 180 } |
181 | 181 |
182 bool DeferredImageDecoder::frameIsCompleteAtIndex(size_t index) const | 182 bool DeferredImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const |
183 { | 183 { |
184 if (m_actualDecoder) | 184 if (m_actualDecoder) |
185 return m_actualDecoder->frameIsCompleteAtIndex(index); | 185 return m_actualDecoder->frameIsFullyReceivedAtIndex(index); |
186 if (index < m_frameData.size()) | 186 if (index < m_frameData.size()) |
187 return m_frameData[index].m_isComplete; | 187 return m_frameData[index].m_isComplete; |
188 return false; | 188 return false; |
189 } | 189 } |
190 | 190 |
191 float DeferredImageDecoder::frameDurationAtIndex(size_t index) const | 191 float DeferredImageDecoder::frameDurationAtIndex(size_t index) const |
192 { | 192 { |
193 if (m_actualDecoder) | 193 if (m_actualDecoder) |
194 return m_actualDecoder->frameDurationAtIndex(index); | 194 return m_actualDecoder->frameDurationAtIndex(index); |
195 if (index < m_frameData.size()) | 195 if (index < m_frameData.size()) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 m_frameData.resize(m_actualDecoder->frameCount()); | 244 m_frameData.resize(m_actualDecoder->frameCount()); |
245 | 245 |
246 // We have encountered a broken image file. Simply bail. | 246 // We have encountered a broken image file. Simply bail. |
247 if (m_frameData.size() < previousSize) | 247 if (m_frameData.size() < previousSize) |
248 return; | 248 return; |
249 | 249 |
250 for (size_t i = previousSize; i < m_frameData.size(); ++i) { | 250 for (size_t i = previousSize; i < m_frameData.size(); ++i) { |
251 m_frameData[i].m_haveMetadata = true; | 251 m_frameData[i].m_haveMetadata = true; |
252 m_frameData[i].m_duration = m_actualDecoder->frameDurationAtIndex(i); | 252 m_frameData[i].m_duration = m_actualDecoder->frameDurationAtIndex(i); |
253 m_frameData[i].m_orientation = m_actualDecoder->orientation(); | 253 m_frameData[i].m_orientation = m_actualDecoder->orientation(); |
254 m_frameData[i].m_isComplete = m_actualDecoder->frameIsCompleteAtIndex(i)
; | 254 m_frameData[i].m_isComplete = m_actualDecoder->frameIsFullyReceivedAtInd
ex(i); |
255 } | 255 } |
256 | 256 |
257 // The last lazy decoded frame created from previous call might be | 257 // The last lazy decoded frame created from previous call might be |
258 // incomplete so update its state. | 258 // incomplete so update its state. |
259 if (previousSize) { | 259 if (previousSize) { |
260 const size_t lastFrame = previousSize - 1; | 260 const size_t lastFrame = previousSize - 1; |
261 m_frameData[lastFrame].m_isComplete = m_actualDecoder->frameIsCompleteAt
Index(lastFrame); | 261 m_frameData[lastFrame].m_isComplete = m_actualDecoder->frameIsFullyRecei
vedAtIndex(lastFrame); |
262 } | 262 } |
263 | 263 |
264 if (m_allDataReceived) { | 264 if (m_allDataReceived) { |
265 m_repetitionCount = m_actualDecoder->repetitionCount(); | 265 m_repetitionCount = m_actualDecoder->repetitionCount(); |
266 m_actualDecoder.clear(); | 266 m_actualDecoder.clear(); |
267 m_data = nullptr; | 267 m_data = nullptr; |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 inline SkImageInfo imageInfoFrom(const SkISize& decodedSize, bool knownToBeOpaqu
e) | 271 inline SkImageInfo imageInfoFrom(const SkISize& decodedSize, bool knownToBeOpaqu
e) |
(...skipping 18 matching lines...) Expand all Loading... |
290 return image.release(); | 290 return image.release(); |
291 } | 291 } |
292 | 292 |
293 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const | 293 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const |
294 { | 294 { |
295 // TODO: Implement. | 295 // TODO: Implement. |
296 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; | 296 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; |
297 } | 297 } |
298 | 298 |
299 } // namespace blink | 299 } // namespace blink |
OLD | NEW |