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>
This commit is contained in:
parent
860026d9e9
commit
ff1aeb953f
@ -831,15 +831,13 @@ bool SkJpegCodec::onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpa
|
|||||||
}
|
}
|
||||||
|
|
||||||
jpeg_component_info * comp_info = dinfo->comp_info;
|
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->fSizes[i].set(comp_info[i].downsampled_width, comp_info[i].downsampled_height);
|
||||||
sizeInfo->fWidthBytes[i] = comp_info[i].width_in_blocks * DCTSIZE;
|
sizeInfo->fWidthBytes[i] = comp_info[i].width_in_blocks * DCTSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// JPEG never has an alpha channel
|
// JPEG never has an alpha channel
|
||||||
sizeInfo->fSizes[SkYUVAIndex::kA_Index].fHeight =
|
sizeInfo->fSizes[3].fHeight = sizeInfo->fSizes[3].fWidth = sizeInfo->fWidthBytes[3] = 0;
|
||||||
sizeInfo->fSizes[SkYUVAIndex::kA_Index].fWidth =
|
|
||||||
sizeInfo->fWidthBytes[SkYUVAIndex::kA_Index] = 0;
|
|
||||||
|
|
||||||
if (colorSpace) {
|
if (colorSpace) {
|
||||||
*colorSpace = kJPEG_SkYUVColorSpace;
|
*colorSpace = kJPEG_SkYUVColorSpace;
|
||||||
|
@ -62,7 +62,7 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo,
|
|||||||
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
||||||
break;
|
break;
|
||||||
case 2:
|
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].fIndex = 0;
|
||||||
yuvaIndices[SkYUVAIndex::kY_Index].fChannel = SkColorChannel::kR;
|
yuvaIndices[SkYUVAIndex::kY_Index].fChannel = SkColorChannel::kR;
|
||||||
yuvaIndices[SkYUVAIndex::kU_Index].fIndex = 1;
|
yuvaIndices[SkYUVAIndex::kU_Index].fIndex = 1;
|
||||||
@ -85,6 +85,8 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo,
|
|||||||
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
||||||
break;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user