aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkImage_Gpu.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-07-03 16:18:29 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-03 20:46:27 +0000
commit108bb232775c0b768ce1beca929ed31a97b46ed3 (patch)
treeff882d51dac3e7dfd66ae79a0be0883d6b379c25 /src/image/SkImage_Gpu.cpp
parent58a1605d2b9bab077f53b6a223f9e7ce1891d3ea (diff)
Reland "Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors."
This reverts commit 34aa059c1502d67c9a5f4db449667a8709b69fb9. Reason for revert: <INSERT REASONING HERE> Original change's description: > Revert "Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors." > > This reverts commit ff2181e62e79ffd2ce628fc8c05b5457d4f54163. > > Reason for revert: suspect it's behind Chrome roll failure > > Original change's description: > > Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors. > > > > Bug: skia: > > Change-Id: I1466668e3502cd1e6e1f6aed4105e0f626d293dd > > Reviewed-on: https://skia-review.googlesource.com/138987 > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > Reviewed-by: Robert Phillips <robertphillips@google.com> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com > > Change-Id: I4cba44858aafffbadc45e18349b93c741d7cfc66 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/139220 > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Bug: skia: Change-Id: Ib1fd10c126862824f3e31c420c697ac749c637f5 Reviewed-on: https://skia-review.googlesource.com/139221 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r--src/image/SkImage_Gpu.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 1a89ba42ae..7b24858c2f 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -370,6 +370,10 @@ sk_sp<SkImage> SkImage_Gpu::MakeFromYUVATexturesCopyImpl(GrContext* ctx,
bool nv12 = (yuvaIndices[1].fIndex == yuvaIndices[2].fIndex);
auto ct = nv12 ? kRGBA_8888_SkColorType : kAlpha_8_SkColorType;
+ // We need to make a copy of the input backend textures because we need to preserve the result
+ // of validate_backend_texture.
+ GrBackendTexture yuvaTexturesCopy[4];
+
for (int i = 0; i < 4; ++i) {
// Validate that the yuvaIndices refer to valid backend textures.
SkYUVAIndex& yuvaIndex = yuvaIndices[i];
@@ -382,12 +386,14 @@ sk_sp<SkImage> SkImage_Gpu::MakeFromYUVATexturesCopyImpl(GrContext* ctx,
// at most 4 images sources being passed in, could not have a index more than 3.
return nullptr;
}
- auto texture = yuvaTextures[yuvaIndex.fIndex];
- // TODO: Instead of using assumption about whether it is NV12 format to guess colorType,
- // actually use channel information here.
- if (!validate_backend_texture(ctx, texture, &texture.fConfig, ct, kPremul_SkAlphaType,
- nullptr)) {
- return nullptr;
+ if (!yuvaTexturesCopy[yuvaIndex.fIndex].isValid()) {
+ yuvaTexturesCopy[yuvaIndex.fIndex] = yuvaTextures[yuvaIndex.fIndex];
+ // TODO: Instead of using assumption about whether it is NV12 format to guess colorType,
+ // actually use channel information here.
+ if (!validate_backend_texture(ctx, yuvaTexturesCopy[i], &yuvaTexturesCopy[i].fConfig,
+ ct, kPremul_SkAlphaType, nullptr)) {
+ return nullptr;
+ }
}
// TODO: Check that for each plane, the channel actually exist in the image source we are
@@ -406,8 +412,9 @@ sk_sp<SkImage> SkImage_Gpu::MakeFromYUVATexturesCopyImpl(GrContext* ctx,
}
if (!tempTextureProxies[textureIndex]) {
+ SkASSERT(yuvaTexturesCopy[textureIndex].isValid());
tempTextureProxies[textureIndex] =
- proxyProvider->wrapBackendTexture(yuvaTextures[textureIndex], origin);
+ proxyProvider->wrapBackendTexture(yuvaTexturesCopy[textureIndex], origin);
}
}
sk_sp<GrTextureProxy> yProxy = tempTextureProxies[yuvaIndices[0].fIndex];