Move GetFallbackColorTypeAndFormat to GrCaps
This just reduces the usage of GrSurfaceFillContext
Bug: skia:11837
Change-Id: I0fd0b169dbca24901d22421a4c0f13219c44cb3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416797
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 17cad79..be4b444 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -207,7 +207,7 @@
}
std::unique_ptr<GrSurfaceDrawContext> GrSurfaceDrawContext::MakeWithFallback(
- GrRecordingContext* context,
+ GrRecordingContext* rContext,
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
@@ -218,11 +218,12 @@
GrProtected isProtected,
GrSurfaceOrigin origin,
SkBudgeted budgeted) {
- auto [ct, format] = GetFallbackColorTypeAndFormat(context, colorType, sampleCnt);
+ const GrCaps* caps = rContext->priv().caps();
+ auto [ct, format] = caps->getFallbackColorTypeAndFormat(colorType, sampleCnt);
if (ct == GrColorType::kUnknown) {
return nullptr;
}
- return GrSurfaceDrawContext::Make(context, ct, colorSpace, fit, dimensions, surfaceProps,
+ return GrSurfaceDrawContext::Make(rContext, ct, colorSpace, fit, dimensions, surfaceProps,
sampleCnt, mipMapped, isProtected, origin, budgeted);
}