Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 1331533002: [poc] curve-filter Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ensure screen device profiles are matrix Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 PassOwnPtr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(PassOwnP tr<ImageDecoder> actualDecoder) 50 PassOwnPtr<DeferredImageDecoder> DeferredImageDecoder::createForTesting(PassOwnP tr<ImageDecoder> actualDecoder)
51 { 51 {
52 return adoptPtr(new DeferredImageDecoder(std::move(actualDecoder))); 52 return adoptPtr(new DeferredImageDecoder(std::move(actualDecoder)));
53 } 53 }
54 54
55 DeferredImageDecoder::DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecode r) 55 DeferredImageDecoder::DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecode r)
56 : m_allDataReceived(false) 56 : m_allDataReceived(false)
57 , m_lastDataSize(0) 57 , m_lastDataSize(0)
58 , m_actualDecoder(std::move(actualDecoder)) 58 , m_actualDecoder(std::move(actualDecoder))
59 , m_repetitionCount(cAnimationNone) 59 , m_repetitionCount(cAnimationNone)
60 , m_canYUVDecode(false)
60 , m_hasColorProfile(false) 61 , m_hasColorProfile(false)
61 , m_canYUVDecode(false)
62 { 62 {
63 } 63 }
64 64
65 DeferredImageDecoder::~DeferredImageDecoder() 65 DeferredImageDecoder::~DeferredImageDecoder()
66 { 66 {
67 } 67 }
68 68
69 void DeferredImageDecoder::setEnabled(bool enabled) 69 void DeferredImageDecoder::setEnabled(bool enabled)
70 { 70 {
71 s_enabled = enabled; 71 s_enabled = enabled;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // m_actualDecoder is 0 only if image decoding is deferred and that means 127 // m_actualDecoder is 0 only if image decoding is deferred and that means
128 // the image header decoded successfully and the size is available. 128 // the image header decoded successfully and the size is available.
129 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; 129 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true;
130 } 130 }
131 131
132 bool DeferredImageDecoder::hasColorProfile() const 132 bool DeferredImageDecoder::hasColorProfile() const
133 { 133 {
134 return m_actualDecoder ? m_actualDecoder->hasColorProfile() : m_hasColorProf ile; 134 return m_actualDecoder ? m_actualDecoder->hasColorProfile() : m_hasColorProf ile;
135 } 135 }
136 136
137 PassRefPtr<ColorSpaceProfile> DeferredImageDecoder::colorProfile() const
138 {
139 if (m_actualDecoder)
140 return m_actualDecoder->colorProfile();
141
142 return m_colorProfile;
143 }
144
137 IntSize DeferredImageDecoder::size() const 145 IntSize DeferredImageDecoder::size() const
138 { 146 {
139 return m_actualDecoder ? m_actualDecoder->size() : m_size; 147 return m_actualDecoder ? m_actualDecoder->size() : m_size;
140 } 148 }
141 149
142 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const 150 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const
143 { 151 {
144 // FIXME: LocalFrame size is assumed to be uniform. This might not be true f or 152 // FIXME: LocalFrame size is assumed to be uniform. This might not be true f or
145 // future supported codecs. 153 // future supported codecs.
146 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size; 154 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void DeferredImageDecoder::activateLazyDecoding() 226 void DeferredImageDecoder::activateLazyDecoding()
219 { 227 {
220 if (m_frameGenerator) 228 if (m_frameGenerator)
221 return; 229 return;
222 230
223 m_size = m_actualDecoder->size(); 231 m_size = m_actualDecoder->size();
224 m_filenameExtension = m_actualDecoder->filenameExtension(); 232 m_filenameExtension = m_actualDecoder->filenameExtension();
225 // JPEG images support YUV decoding: other decoders do not, WEBP could in fu ture. 233 // JPEG images support YUV decoding: other decoders do not, WEBP could in fu ture.
226 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && (m_filename Extension == "jpg"); 234 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && (m_filename Extension == "jpg");
227 m_hasColorProfile = m_actualDecoder->hasColorProfile(); 235 m_hasColorProfile = m_actualDecoder->hasColorProfile();
236 m_colorProfile = m_hasColorProfile ? m_actualDecoder->colorProfile() : nullp tr;
228 237
229 const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationN one || (m_allDataReceived && m_actualDecoder->frameCount() == 1u); 238 const bool isSingleFrame = m_actualDecoder->repetitionCount() == cAnimationN one || (m_allDataReceived && m_actualDecoder->frameCount() == 1u);
230 m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder ->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_all DataReceived, !isSingleFrame); 239 m_frameGenerator = ImageFrameGenerator::create(SkISize::Make(m_actualDecoder ->decodedSize().width(), m_actualDecoder->decodedSize().height()), m_data, m_all DataReceived, !isSingleFrame);
231 } 240 }
232 241
233 void DeferredImageDecoder::prepareLazyDecodedFrames() 242 void DeferredImageDecoder::prepareLazyDecodedFrames()
234 { 243 {
235 if (!s_enabled 244 if (!s_enabled
236 || !m_actualDecoder 245 || !m_actualDecoder
237 || !m_actualDecoder->isSizeAvailable() 246 || !m_actualDecoder->isSizeAvailable()
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return image.release(); 299 return image.release();
291 } 300 }
292 301
293 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const 302 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const
294 { 303 {
295 // TODO: Implement. 304 // TODO: Implement.
296 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; 305 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false;
297 } 306 }
298 307
299 } // namespace blink 308 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698