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

Unified Diff: gm/drawatlas.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/displacement.cpp ('k') | gm/drawatlascolor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawatlas.cpp
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 858e4bf056ffb2853ec76f3ca6a9d4ebd10f8cb2..4d2f6d46f3ff6309e82e992152e47e38c3347e1f 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -11,7 +11,7 @@
#include "SkSurface.h"
class DrawAtlasGM : public skiagm::GM {
- static SkImage* MakeAtlas(SkCanvas* caller, const SkRect& target) {
+ static sk_sp<SkImage> MakeAtlas(SkCanvas* caller, const SkRect& target) {
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
if (nullptr == surface) {
@@ -32,10 +32,10 @@ class DrawAtlasGM : public skiagm::GM {
paint.setColor(SK_ColorBLUE);
paint.setAntiAlias(true);
canvas->drawOval(target, paint);
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
- SkAutoTUnref<SkImage> fAtlas;
+ sk_sp<SkImage> fAtlas;
public:
DrawAtlasGM() {}
@@ -53,7 +53,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
const SkRect target = { 50, 50, 80, 90 };
if (nullptr == fAtlas) {
- fAtlas.reset(MakeAtlas(canvas, target));
+ fAtlas = MakeAtlas(canvas, target);
}
const struct {
@@ -91,9 +91,9 @@ protected:
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setAntiAlias(true);
- canvas->drawAtlas(fAtlas, xform, tex, N, nullptr, &paint);
+ canvas->drawAtlas(fAtlas.get(), xform, tex, N, nullptr, &paint);
canvas->translate(0, 100);
- canvas->drawAtlas(fAtlas, xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint);
+ canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint);
}
private:
« no previous file with comments | « gm/displacement.cpp ('k') | gm/drawatlascolor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698