use tool_utils to encapsulate checking for recording canvas and makeSurface

Bug: skia:
Change-Id: Ia93ee09dd213b8d6ad5c18e887add5ff3448c824
Reviewed-on: https://skia-review.googlesource.com/90243
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 4a23e26..afb197e 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -11,14 +11,12 @@
 #include "SkCanvas.h"
 #include "SkRSXform.h"
 #include "SkSurface.h"
+#include "sk_tool_utils.h"
 
 class DrawAtlasGM : public skiagm::GM {
     static sk_sp<SkImage> MakeAtlas(SkCanvas* caller, const SkRect& target) {
         SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
-        auto surface(caller->makeSurface(info));
-        if (nullptr == surface) {
-            surface = SkSurface::MakeRaster(info);
-        }
+        auto surface(sk_tool_utils::makeSurface(caller, info));
         SkCanvas* canvas = surface->getCanvas();
         // draw red everywhere, but we don't expect to see it in the draw, testing the notion
         // that drawAtlas draws a subset-region of the atlas.