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/imageblurrepeatmode.cpp b/gm/imageblurrepeatmode.cpp
index 6f38029..b7705be 100644
--- a/gm/imageblurrepeatmode.cpp
+++ b/gm/imageblurrepeatmode.cpp
@@ -10,17 +10,9 @@
#include "SkSurface.h"
#include "SkBlurImageFilter.h"
-static sk_sp<SkSurface> make_surface(SkCanvas* canvas, const SkImageInfo& info) {
- auto surface = canvas->makeSurface(info);
- if (!surface) {
- surface = SkSurface::MakeRaster(info);
- }
- return surface;
-}
-
static sk_sp<SkImage> make_image(SkCanvas* canvas, int direction) {
SkImageInfo info = SkImageInfo::MakeN32Premul(250, 200);
- auto surface = make_surface(canvas, info);
+ auto surface = sk_tool_utils::makeSurface(canvas, info);
SkCanvas* c = surface->getCanvas();
SkPaint paint;
paint.setAntiAlias(true);