Make ManagedBackendTexture fail on invalid GrBackendTexture
Makes it more sensible.
A bunch of call sites we're already written to expect this. Update
some others.
Change-Id: I77c28045ebf01e6aa9d92d2ebc37287604ec10c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332544
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index a9b0482..a77bd47 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -489,12 +489,11 @@
auto mbet = sk_gpu_test::ManagedBackendTexture::MakeWithoutData(
dContext, kSize, kSize, colorType, GrMipmapped::kNo, GrRenderable::kNo);
- if (!mbet) {
- ERRORF(reporter, "Could not create texture with color type %d.", colorType);
- continue;
+ sk_sp<SkImage> img;
+ if (mbet) {
+ img = SkImage::MakeFromTexture(dContext, mbet->texture(), kTopLeft_GrSurfaceOrigin,
+ colorType, kOpaque_SkAlphaType, nullptr);
}
- auto img = SkImage::MakeFromTexture(dContext, mbet->texture(), kTopLeft_GrSurfaceOrigin,
- colorType, kOpaque_SkAlphaType, nullptr);
REPORTER_ASSERT(reporter, can == SkToBool(img),
"colorTypeSupportedAsImage:%d, actual:%d, ct:%d", can, SkToBool(img),
colorType);
@@ -839,6 +838,7 @@
GrProtected::kNo);
if (!mbet) {
ERRORF(reporter, "couldn't create backend texture\n");
+ return;
}
TextureReleaseChecker releaseChecker;