Check correct number of planes in queryYUVA8
Bug: chromium:897395 Change-Id: I6bc872d00de466963383ee4caeeb60aea83c39fb Reviewed-on: https://skia-review.googlesource.com/c/164047 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
2b667d6219
commit
3b5c8b73a6
@ -39,8 +39,8 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo,
|
||||
// try the deprecated method and make a guess at the other data
|
||||
if (this->onQueryYUV8(sizeInfo, colorSpace)) {
|
||||
// take a guess at the number of planes
|
||||
int numPlanes = SkYUVSizeInfo::kMaxCount;
|
||||
for (int i = 0; i < SkYUVSizeInfo::kMaxCount; ++i) {
|
||||
int numPlanes = 3; // onQueryYUV8 only supports up to 3 channels
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (sizeInfo->fSizes[i].isEmpty()) {
|
||||
numPlanes = i;
|
||||
break;
|
||||
@ -66,7 +66,7 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo,
|
||||
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
||||
break;
|
||||
case 2:
|
||||
// Assume 1 Y plane and interleaved UV planes
|
||||
// Assume 1 Y plane and interleaved UV planes (NV12)
|
||||
sizeInfo->fColorTypes[0] = kAlpha_8_SkColorType;
|
||||
sizeInfo->fColorTypes[1] = kRGBA_8888_SkColorType;
|
||||
sizeInfo->fColorTypes[2] = kUnknown_SkColorType;
|
||||
@ -81,6 +81,7 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo,
|
||||
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
// Assume 3 separate non-interleaved planes
|
||||
sizeInfo->fColorTypes[0] = kAlpha_8_SkColorType;
|
||||
sizeInfo->fColorTypes[1] = kAlpha_8_SkColorType;
|
||||
@ -95,22 +96,6 @@ bool SkImageGenerator::queryYUVA8(SkYUVSizeInfo* sizeInfo,
|
||||
yuvaIndices[SkYUVAIndex::kA_Index].fIndex = -1;
|
||||
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
// Assume 4 separate non-interleaved planes
|
||||
sizeInfo->fColorTypes[0] = kAlpha_8_SkColorType;
|
||||
sizeInfo->fColorTypes[1] = kAlpha_8_SkColorType;
|
||||
sizeInfo->fColorTypes[2] = kAlpha_8_SkColorType;
|
||||
sizeInfo->fColorTypes[3] = kAlpha_8_SkColorType;
|
||||
yuvaIndices[SkYUVAIndex::kY_Index].fIndex = 0;
|
||||
yuvaIndices[SkYUVAIndex::kY_Index].fChannel = SkColorChannel::kR;
|
||||
yuvaIndices[SkYUVAIndex::kU_Index].fIndex = 1;
|
||||
yuvaIndices[SkYUVAIndex::kU_Index].fChannel = SkColorChannel::kR;
|
||||
yuvaIndices[SkYUVAIndex::kV_Index].fIndex = 2;
|
||||
yuvaIndices[SkYUVAIndex::kV_Index].fChannel = SkColorChannel::kR;
|
||||
yuvaIndices[SkYUVAIndex::kA_Index].fIndex = 3;
|
||||
yuvaIndices[SkYUVAIndex::kA_Index].fChannel = SkColorChannel::kR;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user