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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 std::unique_ptr<ImageDecoder> actualDecoder = | 67 std::unique_ptr<ImageDecoder> actualDecoder = |
68 ImageDecoder::create(data, dataComplete, alphaOption, colorOptions); | 68 ImageDecoder::create(data, dataComplete, alphaOption, colorOptions); |
69 | 69 |
70 if (!actualDecoder) | 70 if (!actualDecoder) |
71 return nullptr; | 71 return nullptr; |
72 | 72 |
73 std::unique_ptr<DeferredImageDecoder> decoder( | 73 std::unique_ptr<DeferredImageDecoder> decoder( |
74 new DeferredImageDecoder(std::move(actualDecoder))); | 74 new DeferredImageDecoder(std::move(actualDecoder))); |
75 | 75 |
76 // Since we've just instantiated a fresh decoder, there's no need to reset its
data. | 76 // Since we've just instantiated a fresh decoder, there's no need to reset its |
| 77 // data. |
77 decoder->setDataInternal(data.release(), dataComplete, false); | 78 decoder->setDataInternal(data.release(), dataComplete, false); |
78 | 79 |
79 return decoder; | 80 return decoder; |
80 } | 81 } |
81 | 82 |
82 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::createForTesting( | 83 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::createForTesting( |
83 std::unique_ptr<ImageDecoder> actualDecoder) { | 84 std::unique_ptr<ImageDecoder> actualDecoder) { |
84 return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); | 85 return wrapUnique(new DeferredImageDecoder(std::move(actualDecoder))); |
85 } | 86 } |
86 | 87 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 return DefaultImageOrientation; | 256 return DefaultImageOrientation; |
256 } | 257 } |
257 | 258 |
258 void DeferredImageDecoder::activateLazyDecoding() { | 259 void DeferredImageDecoder::activateLazyDecoding() { |
259 if (m_frameGenerator) | 260 if (m_frameGenerator) |
260 return; | 261 return; |
261 | 262 |
262 m_size = m_actualDecoder->size(); | 263 m_size = m_actualDecoder->size(); |
263 m_hasHotSpot = m_actualDecoder->hotSpot(m_hotSpot); | 264 m_hasHotSpot = m_actualDecoder->hotSpot(m_hotSpot); |
264 m_filenameExtension = m_actualDecoder->filenameExtension(); | 265 m_filenameExtension = m_actualDecoder->filenameExtension(); |
265 // JPEG images support YUV decoding: other decoders do not, WEBP could in futu
re. | 266 // JPEG images support YUV decoding; other decoders do not. (WebP could in the |
| 267 // future.) |
266 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && | 268 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && |
267 (m_filenameExtension == "jpg"); | 269 (m_filenameExtension == "jpg"); |
268 m_hasColorProfile = m_actualDecoder->hasColorProfile(); | 270 m_hasColorProfile = m_actualDecoder->hasColorProfile(); |
269 | 271 |
270 const bool isSingleFrame = | 272 const bool isSingleFrame = |
271 m_actualDecoder->repetitionCount() == cAnimationNone || | 273 m_actualDecoder->repetitionCount() == cAnimationNone || |
272 (m_allDataReceived && m_actualDecoder->frameCount() == 1u); | 274 (m_allDataReceived && m_actualDecoder->frameCount() == 1u); |
273 const SkISize decodedSize = | 275 const SkISize decodedSize = |
274 SkISize::Make(m_actualDecoder->decodedSize().width(), | 276 SkISize::Make(m_actualDecoder->decodedSize().width(), |
275 m_actualDecoder->decodedSize().height()); | 277 m_actualDecoder->decodedSize().height()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 365 |
364 namespace WTF { | 366 namespace WTF { |
365 template <> | 367 template <> |
366 struct VectorTraits<blink::DeferredFrameData> | 368 struct VectorTraits<blink::DeferredFrameData> |
367 : public SimpleClassVectorTraits<blink::DeferredFrameData> { | 369 : public SimpleClassVectorTraits<blink::DeferredFrameData> { |
368 STATIC_ONLY(VectorTraits); | 370 STATIC_ONLY(VectorTraits); |
369 static const bool canInitializeWithMemset = | 371 static const bool canInitializeWithMemset = |
370 false; // Not all DeferredFrameData members initialize to 0. | 372 false; // Not all DeferredFrameData members initialize to 0. |
371 }; | 373 }; |
372 } | 374 } |
OLD | NEW |