Add a makeDrawContextWithFallback that handles config fallback
This fixes a bug in find_or_create_rrect_blur_mask where an A8-based drawContext was desired but creation was failing b.c. A8 wasn't renderable.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2296193005
Review-Url: https://codereview.chromium.org/2296193005
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index ff5c860..d6ad1d9 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -407,16 +407,11 @@
return sk_sp<GrTexture>(texture);
}
- // There's no texture in the cache. Let's try to allocate it then.
- GrPixelConfig config = kRGBA_8888_GrPixelConfig;
- if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
- config = kAlpha_8_GrPixelConfig;
- }
-
- sk_sp<GrDrawContext> dc(context->makeDrawContext(SkBackingFit::kApprox,
- reducedClip.width(),
- reducedClip.height(),
- config, nullptr));
+ sk_sp<GrDrawContext> dc(context->makeDrawContextWithFallback(SkBackingFit::kApprox,
+ reducedClip.width(),
+ reducedClip.height(),
+ kAlpha_8_GrPixelConfig,
+ nullptr));
if (!dc) {
return nullptr;
}