Reroute SurfaceContext factories through RecordingContextPriv

Bug: skia:11837
Change-Id: Ib00ccc78d6394ad85781dc1de090c2fe0e83c01f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439736
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp
index 9f5b803..08ac867 100644
--- a/tests/TestUtils.cpp
+++ b/tests/TestUtils.cpp
@@ -254,6 +254,28 @@
     REPORTER_ASSERT(reporter, actualBackingRefs == expectedBackingRefs);
 }
 
+std::unique_ptr<skgpu::SurfaceContext> CreateSurfaceContext(GrRecordingContext* rContext,
+                                                            const GrImageInfo& info,
+                                                            SkBackingFit fit,
+                                                            GrSurfaceOrigin origin,
+                                                            GrRenderable renderable,
+                                                            int sampleCount,
+                                                            GrMipmapped mipmapped,
+                                                            GrProtected isProtected,
+                                                            SkBudgeted budgeted) {
+    GrBackendFormat format = rContext->priv().caps()->getDefaultBackendFormat(info.colorType(),
+                                                                              renderable);
+    return rContext->priv().makeSC(info,
+                                   format,
+                                   fit,
+                                   origin,
+                                   renderable,
+                                   sampleCount,
+                                   mipmapped,
+                                   isProtected,
+                                   budgeted);
+}
+
 #include "src/utils/SkCharToGlyphCache.h"
 
 static SkGlyphID hash_to_glyph(uint32_t value) {