aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/ninepatchstretch.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-17 10:51:11 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-17 10:51:11 -0700
commit9ce9d6772df650ceb0511f275e1a83dffa78ff72 (patch)
tree1c0d54a75945863947490ec45cccf7c30eaa2ca4 /gm/ninepatchstretch.cpp
parent42d95a0afb26560586232961445ba36de387ca37 (diff)
update callsites for Make image factories
not forced yet, as we still have the build-guard. waiting on chrome CL BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1810813003 TBR= Review URL: https://codereview.chromium.org/1810813003
Diffstat (limited to 'gm/ninepatchstretch.cpp')
-rw-r--r--gm/ninepatchstretch.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 218b452862..f269376bb0 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -17,7 +17,7 @@ static SkSurface* make_surface(SkCanvas* root, int N) {
return surface;
}
-static SkImage* make_image(SkCanvas* root, SkIRect* center) {
+static sk_sp<SkImage> make_image(SkCanvas* root, SkIRect* center) {
const int kFixed = 28;
const int kStretchy = 8;
const int kSize = 2*kFixed + kStretchy;
@@ -43,7 +43,7 @@ static SkImage* make_image(SkCanvas* root, SkIRect* center) {
paint.setColor(0x880000FF);
canvas->drawRect(r, paint);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
static void image_to_bitmap(const SkImage* image, SkBitmap* bm) {
@@ -54,9 +54,9 @@ static void image_to_bitmap(const SkImage* image, SkBitmap* bm) {
class NinePatchStretchGM : public skiagm::GM {
public:
- SkAutoTUnref<SkImage> fImage;
- SkBitmap fBitmap;
- SkIRect fCenter;
+ sk_sp<SkImage> fImage;
+ SkBitmap fBitmap;
+ SkIRect fCenter;
NinePatchStretchGM() {}
@@ -71,8 +71,8 @@ protected:
void onDraw(SkCanvas* canvas) override {
if (nullptr == fBitmap.pixelRef()) {
- fImage.reset(make_image(canvas, &fCenter));
- image_to_bitmap(fImage, &fBitmap);
+ fImage = make_image(canvas, &fCenter);
+ image_to_bitmap(fImage.get(), &fBitmap);
}
// amount of bm that should not be stretched (unless we have to)
@@ -100,7 +100,7 @@ protected:
SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed,
size[i].width(), size[i].height());
canvas->drawBitmapNine(fBitmap, fCenter, r, &paint);
- canvas->drawImageNine(fImage, fCenter, r.makeOffset(360, 0), &paint);
+ canvas->drawImageNine(fImage.get(), fCenter, r.makeOffset(360, 0), &paint);
}
}
}