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

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

Issue 2787053004: Respect colorSpace in DecodingImageGenerator::onGetPixels() (Closed)
Patch Set: Response to comments Created 3 years, 8 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // JPEG images support YUV decoding; other decoders do not. (WebP could in the 264 // JPEG images support YUV decoding; other decoders do not. (WebP could in the
265 // future.) 265 // future.)
266 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() && 266 m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() &&
267 (m_filenameExtension == "jpg"); 267 (m_filenameExtension == "jpg");
268 m_hasEmbeddedColorSpace = m_actualDecoder->hasEmbeddedColorSpace(); 268 m_hasEmbeddedColorSpace = m_actualDecoder->hasEmbeddedColorSpace();
269 m_colorSpaceForSkImages = m_actualDecoder->colorSpaceForSkImages(); 269 m_colorSpaceForSkImages = m_actualDecoder->colorSpaceForSkImages();
270 270
271 const bool isSingleFrame = 271 const bool isSingleFrame =
272 m_actualDecoder->repetitionCount() == cAnimationNone || 272 m_actualDecoder->repetitionCount() == cAnimationNone ||
273 (m_allDataReceived && m_actualDecoder->frameCount() == 1u); 273 (m_allDataReceived && m_actualDecoder->frameCount() == 1u);
274 const SkISize decodedSize = 274 const SkImageInfo info = SkImageInfo::Make(
scroggo_chromium 2017/04/07 18:06:06 nit: You could use MakeN32Premul (which has a flav
msarett1 2017/04/10 14:42:45 Acknowledged.
275 SkISize::Make(m_actualDecoder->decodedSize().width(), 275 m_actualDecoder->decodedSize().width(),
276 m_actualDecoder->decodedSize().height()); 276 m_actualDecoder->decodedSize().height(), kN32_SkColorType,
277 kPremul_SkAlphaType, m_colorSpaceForSkImages);
277 m_frameGenerator = ImageFrameGenerator::create( 278 m_frameGenerator = ImageFrameGenerator::create(
278 decodedSize, !isSingleFrame, m_actualDecoder->colorBehavior()); 279 info, !isSingleFrame, m_actualDecoder->colorBehavior());
279 } 280 }
280 281
281 void DeferredImageDecoder::prepareLazyDecodedFrames() { 282 void DeferredImageDecoder::prepareLazyDecodedFrames() {
282 if (!m_actualDecoder || !m_actualDecoder->isSizeAvailable()) 283 if (!m_actualDecoder || !m_actualDecoder->isSizeAvailable())
283 return; 284 return;
284 285
285 activateLazyDecoding(); 286 activateLazyDecoding();
286 287
287 const size_t previousSize = m_frameData.size(); 288 const size_t previousSize = m_frameData.size();
288 m_frameData.resize(m_actualDecoder->frameCount()); 289 m_frameData.resize(m_actualDecoder->frameCount());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 362
362 namespace WTF { 363 namespace WTF {
363 template <> 364 template <>
364 struct VectorTraits<blink::DeferredFrameData> 365 struct VectorTraits<blink::DeferredFrameData>
365 : public SimpleClassVectorTraits<blink::DeferredFrameData> { 366 : public SimpleClassVectorTraits<blink::DeferredFrameData> {
366 STATIC_ONLY(VectorTraits); 367 STATIC_ONLY(VectorTraits);
367 static const bool canInitializeWithMemset = 368 static const bool canInitializeWithMemset =
368 false; // Not all DeferredFrameData members initialize to 0. 369 false; // Not all DeferredFrameData members initialize to 0.
369 }; 370 };
370 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698