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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // m_actualDecoder is 0 only if image decoding is deferred and that means | 116 // m_actualDecoder is 0 only if image decoding is deferred and that means |
117 // the image header decoded successfully and the size is available. | 117 // the image header decoded successfully and the size is available. |
118 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; | 118 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; |
119 } | 119 } |
120 | 120 |
121 bool DeferredImageDecoder::hasColorProfile() const | 121 bool DeferredImageDecoder::hasColorProfile() const |
122 { | 122 { |
123 return m_actualDecoder ? m_actualDecoder->hasColorProfile() : m_hasColorProf
ile; | 123 return m_actualDecoder ? m_actualDecoder->hasColorProfile() : m_hasColorProf
ile; |
124 } | 124 } |
125 | 125 |
| 126 PassRefPtr<ColorSpaceProfile> DeferredImageDecoder::colorProfile() const |
| 127 { |
| 128 if (m_actualDecoder) |
| 129 return m_actualDecoder->colorProfile(); |
| 130 |
| 131 return m_colorProfile; |
| 132 } |
| 133 |
126 IntSize DeferredImageDecoder::size() const | 134 IntSize DeferredImageDecoder::size() const |
127 { | 135 { |
128 return m_actualDecoder ? m_actualDecoder->size() : m_size; | 136 return m_actualDecoder ? m_actualDecoder->size() : m_size; |
129 } | 137 } |
130 | 138 |
131 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const | 139 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const |
132 { | 140 { |
133 // FIXME: LocalFrame size is assumed to be uniform. This might not be true f
or | 141 // FIXME: LocalFrame size is assumed to be uniform. This might not be true f
or |
134 // future supported codecs. | 142 // future supported codecs. |
135 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size; | 143 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return DefaultImageOrientation; | 212 return DefaultImageOrientation; |
205 } | 213 } |
206 | 214 |
207 void DeferredImageDecoder::activateLazyDecoding() | 215 void DeferredImageDecoder::activateLazyDecoding() |
208 { | 216 { |
209 if (m_frameGenerator) | 217 if (m_frameGenerator) |
210 return; | 218 return; |
211 m_size = m_actualDecoder->size(); | 219 m_size = m_actualDecoder->size(); |
212 m_filenameExtension = m_actualDecoder->filenameExtension(); | 220 m_filenameExtension = m_actualDecoder->filenameExtension(); |
213 m_hasColorProfile = m_actualDecoder->hasColorProfile(); | 221 m_hasColorProfile = m_actualDecoder->hasColorProfile(); |
| 222 m_colorProfile = m_hasColorProfile ? m_actualDecoder->colorProfile() : nullp
tr; |
214 const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationN
one || (m_allDataReceived && m_actualDecoder->frameCount() == 1u); | 223 const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationN
one || (m_allDataReceived && m_actualDecoder->frameCount() == 1u); |
215 m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder
->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_all
DataReceived, !isSingleFrame); | 224 m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder
->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_all
DataReceived, !isSingleFrame); |
216 } | 225 } |
217 | 226 |
218 void DeferredImageDecoder::prepareLazyDecodedFrames() | 227 void DeferredImageDecoder::prepareLazyDecodedFrames() |
219 { | 228 { |
220 if (!s_enabled | 229 if (!s_enabled |
221 || !m_actualDecoder | 230 || !m_actualDecoder |
222 || !m_actualDecoder->isSizeAvailable() | 231 || !m_actualDecoder->isSizeAvailable() |
223 || m_actualDecoder->filenameExtension() == "ico") | 232 || m_actualDecoder->filenameExtension() == "ico") |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 return image.release(); | 281 return image.release(); |
273 } | 282 } |
274 | 283 |
275 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const | 284 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const |
276 { | 285 { |
277 // TODO: Implement. | 286 // TODO: Implement. |
278 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; | 287 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; |
279 } | 288 } |
280 | 289 |
281 } // namespace blink | 290 } // namespace blink |
OLD | NEW |