aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/bleed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/bleed.cpp')
-rw-r--r--gm/bleed.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/gm/bleed.cpp b/gm/bleed.cpp
index 1bb8b2b029..b6ee10b555 100644
--- a/gm/bleed.cpp
+++ b/gm/bleed.cpp
@@ -13,6 +13,7 @@
#include "SkImage.h"
#include "SkTDArray.h"
#include "SkUtils.h"
+#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -449,14 +450,6 @@ DEF_GM( return new BleedGM(kUseAlphaImageShader_BleedTest); )
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "SkSurface.h"
-sk_sp<SkSurface> make_surface(SkCanvas* canvas, const SkImageInfo& info) {
- auto surface = canvas->makeSurface(info);
- if (!surface) {
- surface = SkSurface::MakeRaster(info);
- }
- return surface;
-}
-
// Construct an image and return the inner "src" rect. Build the image such that the interior is
// blue, with a margin of blue (2px) but then an outer margin of red.
//
@@ -468,7 +461,7 @@ static sk_sp<SkImage> make_image(SkCanvas* canvas, SkRect* srcR) {
// produce different mipmap filtering when we have an odd sized texture.
const int N = 10 + 2 + 8 + 2 + 10;
SkImageInfo info = SkImageInfo::MakeN32Premul(N, N);
- auto surface = make_surface(canvas, info);
+ auto surface = sk_tool_utils::makeSurface(canvas, info);
SkCanvas* c = surface->getCanvas();
SkRect r = SkRect::MakeIWH(info.width(), info.height());
SkPaint paint;
@@ -500,7 +493,7 @@ DEF_SIMPLE_GM(bleed_downscale, canvas, 360, 240) {
canvas->save();
for (auto quality : qualities) {
paint.setFilterQuality(quality);
- auto surf = make_surface(canvas, SkImageInfo::MakeN32Premul(1, 1));
+ auto surf = sk_tool_utils::makeSurface(canvas, SkImageInfo::MakeN32Premul(1, 1));
surf->getCanvas()->drawImageRect(img, src, SkRect::MakeWH(1, 1), &paint, constraint);
// now blow up the 1 pixel result
canvas->drawImageRect(surf->makeImageSnapshot(), SkRect::MakeWH(100, 100), nullptr);