Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: gm/mipmap.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/localmatriximagefilter.cpp ('k') | gm/multipicturedraw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/mipmap.cpp
diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp
index b0b0cc487c8076de3188e2bca17600f734ff4e1e..4b1912a99c2ae0919950d465362f601b5dc58543 100644
--- a/gm/mipmap.cpp
+++ b/gm/mipmap.cpp
@@ -11,7 +11,7 @@
#include "SkRandom.h"
#include "SkSurface.h"
-static SkImage* make_image() {
+static sk_sp<SkImage> make_image() {
const SkImageInfo info = SkImageInfo::MakeN32Premul(319, 52);
SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
SkCanvas* canvas = surface->getCanvas();
@@ -25,11 +25,11 @@ static SkImage* make_image() {
canvas->drawCircle(-4, 25, 20, paint);
canvas->translate(25, 0);
}
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
DEF_SIMPLE_GM(mipmap, canvas, 400, 200) {
- SkAutoTUnref<SkImage> img(make_image());//SkImage::NewFromEncoded(data));
+ sk_sp<SkImage> img(make_image());//SkImage::NewFromEncoded(data));
SkPaint paint;
const SkRect dst = SkRect::MakeWH(177, 15);
@@ -42,9 +42,9 @@ DEF_SIMPLE_GM(mipmap, canvas, 400, 200) {
canvas->translate(20, 20);
for (int i = 0; i < 4; ++i) {
paint.setFilterQuality(SkFilterQuality(i));
- canvas->drawImageRect(img, dst, &paint);
+ canvas->drawImageRect(img.get(), dst, &paint);
canvas->translate(0, 20);
}
- canvas->drawImage(img, 20, 20, nullptr);
+ canvas->drawImage(img.get(), 20, 20, nullptr);
}
« no previous file with comments | « gm/localmatriximagefilter.cpp ('k') | gm/multipicturedraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698