Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp |
| index 806350a5e2556e6f898caba4346c80f5bf062b8e..a7a910324bc52d462bdff0767ac468e7bee8e5d0 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp |
| @@ -84,17 +84,20 @@ private: |
| size_t m_rowBytes; |
| }; |
| -static bool updateYUVComponentSizes(ImageDecoder* decoder, SkISize componentSizes[3], ImageDecoder::SizeType sizeType) |
| +static bool updateYUVComponentSizes(ImageDecoder* decoder, SkISize componentSizes[3], size_t componentWidthBytes[3]) |
| { |
| if (!decoder->canDecodeToYUV()) |
| return false; |
| - IntSize size = decoder->decodedYUVSize(0, sizeType); |
| + IntSize size = decoder->decodedYUVSize(0); |
| componentSizes[0].set(size.width(), size.height()); |
| - size = decoder->decodedYUVSize(1, sizeType); |
| + componentWidthBytes[0] = decoder->decodedYUVWidthBytes(0); |
| + size = decoder->decodedYUVSize(1); |
| componentSizes[1].set(size.width(), size.height()); |
| - size = decoder->decodedYUVSize(2, sizeType); |
| + componentWidthBytes[1] = decoder->decodedYUVWidthBytes(1); |
| + size = decoder->decodedYUVSize(2); |
| componentSizes[2].set(size.width(), size.height()); |
| + componentWidthBytes[2] = decoder->decodedYUVWidthBytes(2); |
| return true; |
| } |
| @@ -206,7 +209,7 @@ bool ImageFrameGenerator::decodeAndScale(size_t index, const SkImageInfo& info, |
| return true; |
| } |
| -bool ImageFrameGenerator::decodeToYUV(size_t index, SkISize componentSizes[3], void* planes[3], size_t rowBytes[3]) |
| +bool ImageFrameGenerator::decodeToYUV(size_t index, const SkISize componentSizes[3], void* planes[3], const size_t rowBytes[3]) |
| { |
| // Prevent concurrent decode or scale operations on the same image data. |
| MutexLocker lock(m_decodeMutex); |
| @@ -237,9 +240,6 @@ bool ImageFrameGenerator::decodeToYUV(size_t index, SkISize componentSizes[3], v |
| OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes)); |
| decoder->setImagePlanes(imagePlanes.release()); |
| - bool sizeUpdated = updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::ActualSize); |
| - RELEASE_ASSERT(sizeUpdated); |
|
Noel Gordon
2016/03/03 01:25:28
We lost an ASSERT here. Something like this
msarett
2016/03/04 19:49:08
Added the assert for canDecodeToYUV(). That gives
|
| - |
| if (decoder->decodeToYUV()) { |
| setHasAlpha(0, false); // YUV is always opaque |
| return true; |
| @@ -389,7 +389,7 @@ bool ImageFrameGenerator::hasAlpha(size_t index) |
| return true; |
| } |
| -bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3]) |
| +bool ImageFrameGenerator::getYUVComponentSizes(SkYUVSizeInfo* sizeInfo) |
| { |
| TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height()); |
| @@ -410,8 +410,7 @@ bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3]) |
| OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
| decoder->setImagePlanes(dummyImagePlanes.release()); |
| - ASSERT(componentSizes); |
| - return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::SizeForMemoryAllocation); |
| + return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fWidthBytes); |
| } |
| } // namespace blink |