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

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

Issue 1860523002: Do not set m_decodeFailed in ImageFrameGenerator::decodeToYUV (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 size = decoder->decodedYUVSize(2, sizeType); 96 size = decoder->decodedYUVSize(2, sizeType);
97 componentSizes[2].set(size.width(), size.height()); 97 componentSizes[2].set(size.width(), size.height());
98 return true; 98 return true;
99 } 99 }
100 100
101 ImageFrameGenerator::ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<Sha redBuffer> data, bool allDataReceived, bool isMultiFrame) 101 ImageFrameGenerator::ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<Sha redBuffer> data, bool allDataReceived, bool isMultiFrame)
102 : m_fullSize(fullSize) 102 : m_fullSize(fullSize)
103 , m_data(adoptRef(new ThreadSafeDataTransport())) 103 , m_data(adoptRef(new ThreadSafeDataTransport()))
104 , m_isMultiFrame(isMultiFrame) 104 , m_isMultiFrame(isMultiFrame)
105 , m_decodeFailed(false) 105 , m_decodeFailed(false)
106 , m_yuvDecodingFailed(false)
106 , m_frameCount(0) 107 , m_frameCount(0)
107 , m_encodedData(nullptr) 108 , m_encodedData(nullptr)
108 { 109 {
109 setData(data.get(), allDataReceived); 110 setData(data.get(), allDataReceived);
110 } 111 }
111 112
112 ImageFrameGenerator::~ImageFrameGenerator() 113 ImageFrameGenerator::~ImageFrameGenerator()
113 { 114 {
114 if (m_encodedData) 115 if (m_encodedData)
115 m_encodedData->unref(); 116 m_encodedData->unref();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 bool sizeUpdated = updateYUVComponentSizes(decoder.get(), componentSizes, Im ageDecoder::ActualSize); 241 bool sizeUpdated = updateYUVComponentSizes(decoder.get(), componentSizes, Im ageDecoder::ActualSize);
241 RELEASE_ASSERT(sizeUpdated); 242 RELEASE_ASSERT(sizeUpdated);
242 243
243 if (decoder->decodeToYUV()) { 244 if (decoder->decodeToYUV()) {
244 setHasAlpha(0, false); // YUV is always opaque 245 setHasAlpha(0, false); // YUV is always opaque
245 return true; 246 return true;
246 } 247 }
247 248
248 ASSERT(decoder->failed()); 249 ASSERT(decoder->failed());
249 m_decodeFailed = true; 250 m_yuvDecodingFailed = true;
250 return false; 251 return false;
251 } 252 }
252 253
253 SkBitmap ImageFrameGenerator::tryToResumeDecode(size_t index, const SkISize& sca ledSize) 254 SkBitmap ImageFrameGenerator::tryToResumeDecode(size_t index, const SkISize& sca ledSize)
254 { 255 {
255 TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index ", static_cast<int>(index)); 256 TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index ", static_cast<int>(index));
256 257
257 ImageDecoder* decoder = 0; 258 ImageDecoder* decoder = 0;
258 const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder); 259 const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder);
259 ASSERT(!resumeDecoding || decoder); 260 ASSERT(!resumeDecoding || decoder);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 MutexLocker lock(m_alphaMutex); 387 MutexLocker lock(m_alphaMutex);
387 if (index < m_hasAlpha.size()) 388 if (index < m_hasAlpha.size())
388 return m_hasAlpha[index]; 389 return m_hasAlpha[index];
389 return true; 390 return true;
390 } 391 }
391 392
392 bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3]) 393 bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3])
393 { 394 {
394 TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height()); 395 TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height());
395 396
397 if (m_yuvDecodingFailed)
398 return false;
399
396 SharedBuffer* data = 0; 400 SharedBuffer* data = 0;
397 bool allDataReceived = false; 401 bool allDataReceived = false;
398 m_data->data(&data, &allDataReceived); 402 m_data->data(&data, &allDataReceived);
399 403
400 // FIXME: YUV decoding does not currently support progressive decoding. 404 // FIXME: YUV decoding does not currently support progressive decoding.
401 if (!allDataReceived) 405 if (!allDataReceived)
402 return false; 406 return false;
403 407
404 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied); 408 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
405 if (!decoder) 409 if (!decoder)
406 return false; 410 return false;
407 411
408 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. 412 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding.
409 decoder->setData(data, allDataReceived); 413 decoder->setData(data, allDataReceived);
410 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); 414 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes);
411 decoder->setImagePlanes(dummyImagePlanes.release()); 415 decoder->setImagePlanes(dummyImagePlanes.release());
412 416
413 ASSERT(componentSizes); 417 ASSERT(componentSizes);
414 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder:: SizeForMemoryAllocation); 418 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder:: SizeForMemoryAllocation);
415 } 419 }
416 420
417 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698