diff options
author | Jim Van Verth <jvanverth@google.com> | 2018-10-22 15:16:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-10-22 19:52:27 +0000 |
commit | ff1aeb953faf9f68631d5f6086611ff3564344ce (patch) | |
tree | 82ca72034cb29385403e63ae5d79951ff6f71ef0 /src | |
parent | 860026d9e98e5311d5dd855dcde209eb1e22acb5 (diff) | |
download | skqp-ff1aeb953faf9f68631d5f6086611ff3564344ce.tar.gz |
Ensure that SkYUVSizeInfo is fully initialized with old interface.
Bug: chromium:897245
Change-Id: If9394c59e4b774cc17bba76c1445e423f07a7644
Reviewed-on: https://skia-review.googlesource.com/c/164341
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/codec/SkJpegCodec.cpp | 6 | ||||
-rw-r--r-- | src/core/SkImageGenerator.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp index c883b3e7df..a60e9f810f 100644 --- a/src/codec/SkJpegCodec.cpp +++ b/src/codec/SkJpegCodec.cpp @@ -831,15 +831,13 @@ bool SkJpegCodec::onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpa } jpeg_component_info * comp_info = dinfo->comp_info; - for (auto i : { SkYUVAIndex::kY_Index, SkYUVAIndex::kU_Index, SkYUVAIndex::kV_Index }) { + for (int i = 0; i < 3; ++i) { sizeInfo->fSizes[i].set(comp_info[i].downsampled_width, comp_info[i].downsampled_height); sizeInfo->fWidthBytes[i] = comp_info[i].width_in_blocks * DCTSIZE; } // JPEG never has an alpha channel - sizeInfo->fSizes[SkYUVAIndex::kA_Index].fHeight = - sizeInfo->fSizes[SkYUVAIndex::kA_Index].fWidth = - sizeInfo->fWidthBytes[SkYUVAIndex::kA_Index] = 0; + sizeInfo->fSizes[3].fHeight = sizeInfo->fSizes[3].fWidth = sizeInfo->fWidthBytes[3] = 0; if (colorSpace) { *colorSpace = kJPEG_SkYUVColorSpace; diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp index 2c59c9a2a0..1f16bc810a 100644 --- a/src/core/SkImageGenerator.cpp +++ b/src/core/SkImageGenerator.cpp @@ -62,7 +62,7 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo, yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR; break; case 2: - // Assume 1 Y plane and interleaved UV planes (NV12) + // Assume Y plane and interleaved UV plane (NV12) yuvaIndices[SkYUVAIndex::kY_Index].fIndex = 0; yuvaIndices[SkYUVAIndex::kY_Index].fChannel = SkColorChannel::kR; yuvaIndices[SkYUVAIndex::kU_Index].fIndex = 1; @@ -85,6 +85,8 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo, yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR; break; } + // clear fourth element in sizeInfo to ensure it's initialized + sizeInfo->fSizes[3].fWidth = sizeInfo->fSizes[3].fHeight = sizeInfo->fWidthBytes[3] = 0; return true; } |