diff options
author | Jim Van Verth <jvanverth@google.com> | 2018-10-17 15:27:19 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-10-17 19:55:32 +0000 |
commit | 976a6b037340578fcdd5466cf09f1113ad826115 (patch) | |
tree | d6a0c2ede8a6294f48ab4bc266a768ded3c17606 /src/image | |
parent | 8982aa3754fa5b2e614ae565c06a039bde8919ab (diff) | |
download | skqp-976a6b037340578fcdd5466cf09f1113ad826115.tar.gz |
Fix NV12 and NV21 images in non-DDL
Bug: skia:7903
Change-Id: I91d0abee6baa8e939b9a9b90386b7d13dfe8eece
Reviewed-on: https://skia-review.googlesource.com/c/163222
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 2c3926b5fa..33a0a2ceab 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -149,8 +149,8 @@ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB( ct = kAlpha_8_SkColorType; } else { // The UV planes can either be interleaved or planar. If interleaved the Y plane - // will have RBGA color type. - ct = nv12 ? kRGBA_8888_SkColorType : kAlpha_8_SkColorType; + // should have A8 color type but may be RGBA. We fall back in the latter case below. + ct = nv12 && SkYUVAIndex::kY_Index != i ? kRGBA_8888_SkColorType : kAlpha_8_SkColorType; } if (!yuvaTexturesCopy[yuvaIndex.fIndex].isValid()) { @@ -161,7 +161,12 @@ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB( if (!ValidateBackendTexture(ctx, yuvaTexturesCopy[yuvaIndex.fIndex], &yuvaTexturesCopy[yuvaIndex.fIndex].fConfig, ct, kPremul_SkAlphaType, nullptr)) { - return nullptr; + // Try RGBA in case the assumed colortype is wrong + if (!ValidateBackendTexture(ctx, yuvaTexturesCopy[yuvaIndex.fIndex], + &yuvaTexturesCopy[yuvaIndex.fIndex].fConfig, + kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr)) { + return nullptr; + } } } |