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

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

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Created 4 years, 1 month 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 } 174 }
175 175
176 bool DeferredImageDecoder::isSizeAvailable() { 176 bool DeferredImageDecoder::isSizeAvailable() {
177 // m_actualDecoder is 0 only if image decoding is deferred and that means 177 // m_actualDecoder is 0 only if image decoding is deferred and that means
178 // the image header decoded successfully and the size is available. 178 // the image header decoded successfully and the size is available.
179 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; 179 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true;
180 } 180 }
181 181
182 bool DeferredImageDecoder::hasColorProfile() const { 182 bool DeferredImageDecoder::hasColorProfile() const {
183 return m_actualDecoder ? m_actualDecoder->hasColorProfile() 183 return m_actualDecoder ? m_actualDecoder->hasColorSpace() : m_hasColorProfile;
f(malita) 2016/10/27 15:57:28 If we're renaming ImageDecoder::hasColorProfile ->
msarett 2016/10/27 16:42:56 Yeah I think so. In general, it probably makes se
184 : m_hasColorProfile;
185 } 184 }
186 185
187 IntSize DeferredImageDecoder::size() const { 186 IntSize DeferredImageDecoder::size() const {
188 return m_actualDecoder ? m_actualDecoder->size() : m_size; 187 return m_actualDecoder ? m_actualDecoder->size() : m_size;
189 } 188 }
190 189
191 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const { 190 IntSize DeferredImageDecoder::frameSizeAtIndex(size_t index) const {
192 // FIXME: LocalFrame size is assumed to be uniform. This might not be true for 191 // FIXME: LocalFrame size is assumed to be uniform. This might not be true for
193 // future supported codecs. 192 // future supported codecs.
194 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size; 193 return m_actualDecoder ? m_actualDecoder->frameSizeAtIndex(index) : m_size;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (m_frameGenerator) 259 if (m_frameGenerator)
261 return; 260 return;
262 261
263 m_size = m_actualDecoder->size(); 262 m_size = m_actualDecoder->size();
264 m_hasHotSpot = m_actualDecoder->hotSpot(m_hotSpot); 263 m_hasHotSpot = m_actualDecoder->hotSpot(m_hotSpot);
265 m_filenameExtension = m_actualDecoder->filenameExtension(); 264 m_filenameExtension = m_actualDecoder->filenameExtension();
266 // JPEG images support YUV decoding; other decoders do not. (WebP could in the 265 // JPEG images support YUV decoding; other decoders do not. (WebP could in the
267 // future.) 266 // future.)
268 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && 267 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() &&
269 (m_filenameExtension == "jpg"); 268 (m_filenameExtension == "jpg");
270 m_hasColorProfile = m_actualDecoder->hasColorProfile(); 269 m_hasColorProfile = m_actualDecoder->hasColorSpace();
271 270
272 const bool isSingleFrame = 271 const bool isSingleFrame =
273 m_actualDecoder->repetitionCount() == cAnimationNone || 272 m_actualDecoder->repetitionCount() == cAnimationNone ||
274 (m_allDataReceived && m_actualDecoder->frameCount() == 1u); 273 (m_allDataReceived && m_actualDecoder->frameCount() == 1u);
275 const SkISize decodedSize = 274 const SkISize decodedSize =
276 SkISize::Make(m_actualDecoder->decodedSize().width(), 275 SkISize::Make(m_actualDecoder->decodedSize().width(),
277 m_actualDecoder->decodedSize().height()); 276 m_actualDecoder->decodedSize().height());
278 m_frameGenerator = ImageFrameGenerator::create(decodedSize, !isSingleFrame); 277 m_frameGenerator = ImageFrameGenerator::create(decodedSize, !isSingleFrame);
279 } 278 }
280 279
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 364
366 namespace WTF { 365 namespace WTF {
367 template <> 366 template <>
368 struct VectorTraits<blink::DeferredFrameData> 367 struct VectorTraits<blink::DeferredFrameData>
369 : public SimpleClassVectorTraits<blink::DeferredFrameData> { 368 : public SimpleClassVectorTraits<blink::DeferredFrameData> {
370 STATIC_ONLY(VectorTraits); 369 STATIC_ONLY(VectorTraits);
371 static const bool canInitializeWithMemset = 370 static const bool canInitializeWithMemset =
372 false; // Not all DeferredFrameData members initialize to 0. 371 false; // Not all DeferredFrameData members initialize to 0.
373 }; 372 };
374 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698