Chromium Code Reviews| Index: Source/platform/graphics/ImageFrameGenerator.cpp |
| diff --git a/Source/platform/graphics/ImageFrameGenerator.cpp b/Source/platform/graphics/ImageFrameGenerator.cpp |
| index b046744b31c76ce29b836f7269f4531d654130a3..a870fc1937d8dd358b9b7780122abe3492088cf6 100644 |
| --- a/Source/platform/graphics/ImageFrameGenerator.cpp |
| +++ b/Source/platform/graphics/ImageFrameGenerator.cpp |
| @@ -133,7 +133,7 @@ bool ImageFrameGenerator::decodeAndScale(const SkImageInfo& info, size_t index, |
| return result; |
| } |
| -bool ImageFrameGenerator::decodeToYUV(void* planes[3], size_t rowBytes[3]) |
| +bool ImageFrameGenerator::decodeToYUV(SkISize componentSizes[3], void* planes[3], size_t rowBytes[3]) |
| { |
| // This method is called to populate a discardable memory owned by Skia. |
| @@ -165,6 +165,8 @@ bool ImageFrameGenerator::decodeToYUV(void* planes[3], size_t rowBytes[3]) |
| OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes)); |
| decoder->setImagePlanes(imagePlanes.release()); |
| + if (decoder->isSizeAvailable()) |
|
Noel Gordon
2014/09/08 16:13:32
ASSERT this?
sugoi1
2014/09/09 15:08:15
isSizeAvailable() has to actually get called, beca
|
| + getYUVComponentSizes(decoder.get(), componentSizes, false); // Update component sizes with real size |
| bool yuvDecoded = decoder->decodeToYUV(); |
| if (yuvDecoded) |
| setHasAlpha(0, false); // YUV is always opaque |
| @@ -319,13 +321,18 @@ bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3]) |
| if (!decoder->isSizeAvailable() || !decoder->canDecodeToYUV()) |
| return false; |
| - IntSize size = decoder->decodedYUVSize(0); |
| + getYUVComponentSizes(decoder.get(), componentSizes, true); |
| + return true; |
| +} |
| + |
| +void ImageFrameGenerator::getYUVComponentSizes(const ImageDecoder* decoder, SkISize componentSizes[3], bool memoryAllocation) |
| +{ |
| + IntSize size = decoder->decodedYUVSize(0, memoryAllocation); |
| componentSizes[0].set(size.width(), size.height()); |
| - size = decoder->decodedYUVSize(1); |
| + size = decoder->decodedYUVSize(1, memoryAllocation); |
| componentSizes[1].set(size.width(), size.height()); |
| - size = decoder->decodedYUVSize(2); |
| + size = decoder->decodedYUVSize(2, memoryAllocation); |
| componentSizes[2].set(size.width(), size.height()); |
| - return true; |
| } |
| } // namespace blink |