From 46596ae50559e89a0a2462573ac9448cf309cf56 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 2 Jan 2018 15:40:29 -0500 Subject: 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 Commit-Queue: Mike Reed --- gm/imagealphathreshold.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'gm/imagealphathreshold.cpp') diff --git a/gm/imagealphathreshold.cpp b/gm/imagealphathreshold.cpp index 6d01722d0a..3783bfcb3a 100644 --- a/gm/imagealphathreshold.cpp +++ b/gm/imagealphathreshold.cpp @@ -12,6 +12,7 @@ #include "SkRandom.h" #include "SkRegion.h" #include "SkSurface.h" +#include "sk_tool_utils.h" #define WIDTH 500 #define HEIGHT 500 @@ -101,12 +102,7 @@ static sk_sp make_color_matching_surface(SkCanvas* canvas, int width, SkImageInfo info = SkImageInfo::Make(width, height, ct, alphaType, std::move(cs)); - sk_sp result = canvas->makeSurface(info); - if (!result) { - result = SkSurface::MakeRaster(info); - } - - return result; + return sk_tool_utils::makeSurface(canvas, info); } class ImageAlphaThresholdSurfaceGM : public skiagm::GM { -- cgit v1.2.3