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

Unified Diff: gm/drawatlascolor.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/drawatlas.cpp ('k') | gm/drawbitmaprect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawatlascolor.cpp
diff --git a/gm/drawatlascolor.cpp b/gm/drawatlascolor.cpp
index b5f9d7a28564736c25e68a1d648441bcc6c39005..85a7a9473adad7f8a964655f12cc9428c8ff9382 100644
--- a/gm/drawatlascolor.cpp
+++ b/gm/drawatlascolor.cpp
@@ -15,7 +15,7 @@
// ------------------------------------
// opaque green | transparent black
//
-static SkImage* make_atlas(SkCanvas* caller, int atlasSize) {
+static sk_sp<SkImage> make_atlas(SkCanvas* caller, int atlasSize) {
const int kBlockSize = atlasSize/2;
SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize);
@@ -48,7 +48,7 @@ static SkImage* make_atlas(SkCanvas* caller, int atlasSize) {
SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
canvas->drawRect(r, paint);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
// This GM tests the drawAtlas API with colors, different xfer modes
@@ -73,7 +73,7 @@ protected:
const SkRect target = SkRect::MakeWH(SkIntToScalar(kAtlasSize), SkIntToScalar(kAtlasSize));
if (nullptr == fAtlas) {
- fAtlas.reset(make_atlas(canvas, kAtlasSize));
+ fAtlas = make_atlas(canvas, kAtlasSize);
}
const struct {
@@ -151,11 +151,11 @@ protected:
canvas->translate(SkIntToScalar(i*(target.height()+kPad)),
SkIntToScalar(kTextPad+kPad));
// w/o a paint
- canvas->drawAtlas(fAtlas, xforms, rects, quadColors, numColors,
+ canvas->drawAtlas(fAtlas.get(), xforms, rects, quadColors, numColors,
gModes[i].fMode, nullptr, nullptr);
canvas->translate(0.0f, numColors*(target.height()+kPad));
// w a paint
- canvas->drawAtlas(fAtlas, xforms, rects, quadColors, numColors,
+ canvas->drawAtlas(fAtlas.get(), xforms, rects, quadColors, numColors,
gModes[i].fMode, nullptr, &paint);
canvas->restore();
}
@@ -169,7 +169,7 @@ private:
static const int kTextPad = 8;
- SkAutoTUnref<SkImage> fAtlas;
+ sk_sp<SkImage> fAtlas;
typedef GM INHERITED;
};
« no previous file with comments | « gm/drawatlas.cpp ('k') | gm/drawbitmaprect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698