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

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

Issue 1508683002: DeferredImageDecoder: early-out onGetYUV8Planes when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 MutexLocker lock(m_alphaMutex); 347 MutexLocker lock(m_alphaMutex);
348 if (index < m_hasAlpha.size()) 348 if (index < m_hasAlpha.size())
349 return m_hasAlpha[index]; 349 return m_hasAlpha[index];
350 return true; 350 return true;
351 } 351 }
352 352
353 bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3]) 353 bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3])
354 { 354 {
355 ASSERT(componentSizes); 355 ASSERT(componentSizes);
356 356
357 TRACE_EVENT2("webkit", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height()); 357 TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height());
358 358
359 SharedBuffer* data = 0; 359 SharedBuffer* data = 0;
360 bool allDataReceived = false; 360 bool allDataReceived = false;
361 m_data.data(&data, &allDataReceived); 361 m_data.data(&data, &allDataReceived);
362 362
363 // FIXME: YUV decoding does not currently support progressive decoding. 363 // FIXME: YUV decoding does not currently support progressive decoding.
364 if (!allDataReceived) 364 if (!allDataReceived)
365 return false; 365 return false;
366 366
367 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied); 367 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
368 if (!decoder) 368 if (!decoder)
369 return false; 369 return false;
370 370
371 // JPEG images support YUV decoding: other decoders do not. So don't pump da ta into decoders
372 // that always return false to updateYUVComponentSizes() requests.
373 if (decoder->filenameExtension() != "jpg")
374 return false;
375
376 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. 371 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding.
377 decoder->setData(data, allDataReceived); 372 decoder->setData(data, allDataReceived);
378 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); 373 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes);
379 decoder->setImagePlanes(dummyImagePlanes.release()); 374 decoder->setImagePlanes(dummyImagePlanes.release());
380 375
381 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder:: SizeForMemoryAllocation); 376 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder:: SizeForMemoryAllocation);
382 } 377 }
383 378
384 } // namespace blink 379 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698