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

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

Issue 2556723003: Merge color options into ColorBehavior (Closed)
Patch Set: Feedback Created 4 years 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 float m_duration; 54 float m_duration;
55 bool m_isComplete; 55 bool m_isComplete;
56 size_t m_frameBytes; 56 size_t m_frameBytes;
57 uint32_t m_uniqueID; 57 uint32_t m_uniqueID;
58 }; 58 };
59 59
60 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create( 60 std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create(
61 PassRefPtr<SharedBuffer> passData, 61 PassRefPtr<SharedBuffer> passData,
62 bool dataComplete, 62 bool dataComplete,
63 ImageDecoder::AlphaOption alphaOption, 63 ImageDecoder::AlphaOption alphaOption,
64 ImageDecoder::ColorSpaceOption colorOptions, 64 const ColorBehavior& colorBehavior) {
65 sk_sp<SkColorSpace> targetColorSpace) {
66 RefPtr<SharedBuffer> data = passData; 65 RefPtr<SharedBuffer> data = passData;
67 66
68 std::unique_ptr<ImageDecoder> actualDecoder = 67 std::unique_ptr<ImageDecoder> actualDecoder =
69 ImageDecoder::create(data, dataComplete, alphaOption, colorOptions, 68 ImageDecoder::create(data, dataComplete, alphaOption, colorBehavior);
70 std::move(targetColorSpace));
71 if (!actualDecoder) 69 if (!actualDecoder)
72 return nullptr; 70 return nullptr;
73 71
74 std::unique_ptr<DeferredImageDecoder> decoder( 72 std::unique_ptr<DeferredImageDecoder> decoder(
75 new DeferredImageDecoder(std::move(actualDecoder))); 73 new DeferredImageDecoder(std::move(actualDecoder)));
76 74
77 // Since we've just instantiated a fresh decoder, there's no need to reset its 75 // Since we've just instantiated a fresh decoder, there's no need to reset its
78 // data. 76 // data.
79 decoder->setDataInternal(data.release(), dataComplete, false); 77 decoder->setDataInternal(data.release(), dataComplete, false);
80 78
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 m_hasEmbeddedColorSpace = m_actualDecoder->hasEmbeddedColorSpace(); 268 m_hasEmbeddedColorSpace = m_actualDecoder->hasEmbeddedColorSpace();
271 m_colorSpaceForSkImages = m_actualDecoder->colorSpaceForSkImages(); 269 m_colorSpaceForSkImages = m_actualDecoder->colorSpaceForSkImages();
272 270
273 const bool isSingleFrame = 271 const bool isSingleFrame =
274 m_actualDecoder->repetitionCount() == cAnimationNone || 272 m_actualDecoder->repetitionCount() == cAnimationNone ||
275 (m_allDataReceived && m_actualDecoder->frameCount() == 1u); 273 (m_allDataReceived && m_actualDecoder->frameCount() == 1u);
276 const SkISize decodedSize = 274 const SkISize decodedSize =
277 SkISize::Make(m_actualDecoder->decodedSize().width(), 275 SkISize::Make(m_actualDecoder->decodedSize().width(),
278 m_actualDecoder->decodedSize().height()); 276 m_actualDecoder->decodedSize().height());
279 m_frameGenerator = ImageFrameGenerator::create( 277 m_frameGenerator = ImageFrameGenerator::create(
280 decodedSize, !isSingleFrame, m_actualDecoder->colorSpaceOption(), 278 decodedSize, !isSingleFrame, m_actualDecoder->colorBehavior());
281 m_actualDecoder->targetColorSpace());
282 } 279 }
283 280
284 void DeferredImageDecoder::prepareLazyDecodedFrames() { 281 void DeferredImageDecoder::prepareLazyDecodedFrames() {
285 if (!m_actualDecoder || !m_actualDecoder->isSizeAvailable()) 282 if (!m_actualDecoder || !m_actualDecoder->isSizeAvailable())
286 return; 283 return;
287 284
288 activateLazyDecoding(); 285 activateLazyDecoding();
289 286
290 const size_t previousSize = m_frameData.size(); 287 const size_t previousSize = m_frameData.size();
291 m_frameData.resize(m_actualDecoder->frameCount()); 288 m_frameData.resize(m_actualDecoder->frameCount());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 363
367 namespace WTF { 364 namespace WTF {
368 template <> 365 template <>
369 struct VectorTraits<blink::DeferredFrameData> 366 struct VectorTraits<blink::DeferredFrameData>
370 : public SimpleClassVectorTraits<blink::DeferredFrameData> { 367 : public SimpleClassVectorTraits<blink::DeferredFrameData> {
371 STATIC_ONLY(VectorTraits); 368 STATIC_ONLY(VectorTraits);
372 static const bool canInitializeWithMemset = 369 static const bool canInitializeWithMemset =
373 false; // Not all DeferredFrameData members initialize to 0. 370 false; // Not all DeferredFrameData members initialize to 0.
374 }; 371 };
375 } 372 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698