fix for preabadoncontext after SkImage_Base::asView

asView may fail in makeTextureImage.

Bug: skia:11208
Change-Id: I31090f8e05aad5cf0d530b31cfac328d3b9ed292
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365700
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2021-02-03 16:10:07 -05:00 committed by Skia Commit-Bot
parent ecd2036eae
commit d48f9daeb5

View File

@ -358,7 +358,10 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrDirectContext* dContext,
: GrImageTexGenPolicy::kNew_Uncached_Unbudgeted;
// TODO: Don't flatten YUVA images here. Add mips to the planes instead.
auto [view, ct] = as_IB(this)->asView(dContext, mipmapped, policy);
SkASSERT(view && view.asTextureProxy());
if (!view) {
return nullptr;
}
SkASSERT(view.asTextureProxy());
SkASSERT(mipmapped == GrMipmapped::kNo ||
view.asTextureProxy()->mipmapped() == GrMipmapped::kYes);
SkColorInfo colorInfo(GrColorTypeToSkColorType(ct), this->alphaType(), this->refColorSpace());