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

Unified Diff: src/codec/SkCodecImageGenerator.cpp

Issue 1716523002: Update Skia's YUV API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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
« no previous file with comments | « src/codec/SkCodecImageGenerator.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodecImageGenerator.cpp
diff --git a/src/codec/SkCodecImageGenerator.cpp b/src/codec/SkCodecImageGenerator.cpp
index e6e164ef6137ba358b2b769a928f5af98ade8bab..e579da92f6f435c8a34ba21aae5fdfb02f2cbe23 100644
--- a/src/codec/SkCodecImageGenerator.cpp
+++ b/src/codec/SkCodecImageGenerator.cpp
@@ -28,9 +28,6 @@ SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data)
: INHERITED(make_premul(codec->getInfo()))
, fCodec(codec)
, fData(SkRef(data))
- , fYWidth(0)
- , fUWidth(0)
- , fVWidth(0)
{}
SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) {
@@ -51,47 +48,13 @@ bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, s
}
}
-bool SkCodecImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
- SkYUVColorSpace* colorSpace) {
- // TODO (msarett): Change the YUV API in ImageGenerator to match SkCodec.
- // This function is currently a hack to match the implementation
- // in SkCodec with the old API.
- SkCodec::YUVSizeInfo sizeInfo;
-
- // If planes is NULL, we just need to return the size.
- if (nullptr == planes) {
- bool result = fCodec->queryYUV8(&sizeInfo, colorSpace);
- if (result) {
- // Save the true widths
- fYWidth = sizeInfo.fYSize.width();
- fUWidth = sizeInfo.fUSize.width();
- fVWidth = sizeInfo.fVSize.width();
-
- // Set the sizes so that the client allocates enough memory
- sizes[0].fWidth = (int) sizeInfo.fYWidthBytes;
- sizes[0].fHeight = sizeInfo.fYSize.height();
- sizes[1].fWidth = (int) sizeInfo.fUWidthBytes;
- sizes[1].fHeight = sizeInfo.fUSize.height();
- sizes[2].fWidth = (int) sizeInfo.fVWidthBytes;
- sizes[2].fHeight = sizeInfo.fVSize.height();
- }
- return result;
- }
-
- // Set the sizeInfo with the true widths and heights
- SkASSERT(fYWidth != 0 && fUWidth != 0 && fVWidth != 0);
- sizeInfo.fYSize.set(fYWidth, sizes[0].height());
- sizeInfo.fUSize.set(fUWidth, sizes[1].height());
- sizeInfo.fVSize.set(fVWidth, sizes[2].height());
+bool SkCodecImageGenerator::onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const
+{
+ return fCodec->queryYUV8(sizeInfo, colorSpace);
+}
- // Set the sizeInfo with the allocated widths
- sizeInfo.fYWidthBytes = sizes[0].width();
- sizeInfo.fUWidthBytes = sizes[1].width();
- sizeInfo.fVWidthBytes = sizes[2].width();
+bool SkCodecImageGenerator::onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) {
SkCodec::Result result = fCodec->getYUV8Planes(sizeInfo, planes);
- if ((result == SkCodec::kSuccess || result == SkCodec::kIncompleteInput) && colorSpace) {
- *colorSpace = kJPEG_SkYUVColorSpace;
- }
switch (result) {
case SkCodec::kSuccess:
« no previous file with comments | « src/codec/SkCodecImageGenerator.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698