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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp

Issue 1719533002: Modify YUV codecs to match Skia's API change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update DEPS again Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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 edb8bf46bced153c514a85e3e89ff9780f738f25..4800a3141ac19725d605923cccbbcb94373fba80 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,8 +240,7 @@ 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);
+ ASSERT(decoder->canDecodeToYUV());
if (decoder->decodeToYUV()) {
setHasAlpha(0, false); // YUV is always opaque
@@ -389,7 +391,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 +412,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

Powered by Google App Engine
This is Rietveld 408576698