| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 m_actualDecoder->setData(&data, allDataReceived); | 119 m_actualDecoder->setData(&data, allDataReceived); |
| 120 prepareLazyDecodedFrames(); | 120 prepareLazyDecodedFrames(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (m_frameGenerator) | 123 if (m_frameGenerator) |
| 124 m_frameGenerator->setData(&data, allDataReceived); | 124 m_frameGenerator->setData(&data, allDataReceived); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool DeferredImageDecoder::isSizeAvailable() | 127 bool DeferredImageDecoder::isSizeAvailable() |
| 128 { | 128 { |
| 129 // m_actualDecoder is 0 only if image decoding is deferred and that | 129 // m_actualDecoder is 0 only if image decoding is deferred and that means th
e |
| 130 // means image header decoded successfully and size is available. | 130 // image header decoded successfully and the size is available. |
| 131 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; | 131 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool DeferredImageDecoder::hasColorProfile() const | 134 bool DeferredImageDecoder::hasColorProfile() const |
| 135 { | 135 { |
| 136 return m_actualDecoder ? m_actualDecoder->hasColorProfile() : m_hasColorProf
ile; | 136 return m_actualDecoder ? m_actualDecoder->hasColorProfile() : m_hasColorProf
ile; |
| 137 } | 137 } |
| 138 | 138 |
| 139 PassRefPtr<ColorSpaceProfile> DeferredImageDecoder::colorProfile() const |
| 140 { |
| 141 return m_actualDecoder ? m_actualDecoder->colorProfile() : m_colorProfile; |
| 142 } |
| 143 |
| 139 IntSize DeferredImageDecoder::size() const | 144 IntSize DeferredImageDecoder::size() const |
| 140 { | 145 { |
| 141 return m_actualDecoder ? m_actualDecoder->size() : m_size; | 146 return m_actualDecoder ? m_actualDecoder->size() : m_size; |
| 142 } | 147 } |
| 143 | 148 |
| 144 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const | 149 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const |
| 145 { | 150 { |
| 146 // FIXME: LocalFrame size is assumed to be uniform. This might not be true f
or | 151 // FIXME: LocalFrame size is assumed to be uniform. This might not be true f
or |
| 147 // future supported codecs. | 152 // future supported codecs. |
| 148 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size; | 153 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 210 } |
| 206 | 211 |
| 207 void DeferredImageDecoder::activateLazyDecoding() | 212 void DeferredImageDecoder::activateLazyDecoding() |
| 208 { | 213 { |
| 209 if (m_frameGenerator) | 214 if (m_frameGenerator) |
| 210 return; | 215 return; |
| 211 m_size = m_actualDecoder->size(); | 216 m_size = m_actualDecoder->size(); |
| 212 m_orientation = m_actualDecoder->orientation(); | 217 m_orientation = m_actualDecoder->orientation(); |
| 213 m_filenameExtension = m_actualDecoder->filenameExtension(); | 218 m_filenameExtension = m_actualDecoder->filenameExtension(); |
| 214 m_hasColorProfile = m_actualDecoder->hasColorProfile(); | 219 m_hasColorProfile = m_actualDecoder->hasColorProfile(); |
| 220 m_colorProfile = m_hasColorProfile ? m_actualDecoder->colorProfile() : nullp
tr; |
| 215 const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationN
one || (m_allDataReceived && m_actualDecoder->frameCount() == 1u); | 221 const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationN
one || (m_allDataReceived && m_actualDecoder->frameCount() == 1u); |
| 216 m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder
->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_all
DataReceived, !isSingleFrame); | 222 m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder
->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_all
DataReceived, !isSingleFrame); |
| 217 } | 223 } |
| 218 | 224 |
| 219 void DeferredImageDecoder::prepareLazyDecodedFrames() | 225 void DeferredImageDecoder::prepareLazyDecodedFrames() |
| 220 { | 226 { |
| 221 if (!s_enabled | 227 if (!s_enabled |
| 222 || !m_actualDecoder | 228 || !m_actualDecoder |
| 223 || !m_actualDecoder->isSizeAvailable() | 229 || !m_actualDecoder->isSizeAvailable() |
| 224 || m_actualDecoder->filenameExtension() == "ico") | 230 || m_actualDecoder->filenameExtension() == "ico") |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return bitmap; | 294 return bitmap; |
| 289 } | 295 } |
| 290 | 296 |
| 291 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const | 297 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const |
| 292 { | 298 { |
| 293 // TODO: Implement. | 299 // TODO: Implement. |
| 294 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; | 300 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; |
| 295 } | 301 } |
| 296 | 302 |
| 297 } // namespace WebCore | 303 } // namespace WebCore |
| OLD | NEW |