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

Unified Diff: samplecode/SampleAtlas.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 | « include/core/SkSurface.h ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleAtlas.cpp
diff --git a/samplecode/SampleAtlas.cpp b/samplecode/SampleAtlas.cpp
index a7d5cbe9fd46e6b71ceda35fa2b160f71009d84d..1075f4d12e0e4c29186af69f313d9ba68174b7c1 100644
--- a/samplecode/SampleAtlas.cpp
+++ b/samplecode/SampleAtlas.cpp
@@ -39,7 +39,7 @@ static void draw_atlas_sim(SkCanvas* canvas, SkImage* atlas, const SkRSXform xfo
}
}
-static SkImage* make_atlas(int atlasSize, int cellSize) {
+static sk_sp<SkImage> make_atlas(int atlasSize, int cellSize) {
SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize);
SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
SkCanvas* canvas = surface->getCanvas();
@@ -62,7 +62,7 @@ static SkImage* make_atlas(int atlasSize, int cellSize) {
i += 1;
}
}
- return surface->newImageSnapshot();
+ return surface->makeImageSnapshot();
}
class DrawAtlasDrawable : public SkDrawable {
@@ -131,7 +131,7 @@ class DrawAtlasDrawable : public SkDrawable {
N = 256,
};
- SkAutoTUnref<SkImage> fAtlas;
+ sk_sp<SkImage> fAtlas;
Rec fRec[N];
SkRect fTex[N];
SkRect fBounds;
@@ -142,7 +142,7 @@ public:
: fProc(proc), fBounds(r), fUseColors(false)
{
SkRandom rand;
- fAtlas.reset(make_atlas(kAtlasSize, kCellSize));
+ fAtlas = make_atlas(kAtlasSize, kCellSize);
const SkScalar kMaxSpeed = 5;
const SkScalar cell = SkIntToScalar(kCellSize);
int i = 0;
@@ -187,7 +187,7 @@ protected:
const SkRect cull = this->getBounds();
const SkColor* colorsPtr = fUseColors ? colors : nullptr;
- fProc(canvas, fAtlas, xform, fTex, colorsPtr, N, &cull, &paint);
+ fProc(canvas, fAtlas.get(), xform, fTex, colorsPtr, N, &cull, &paint);
}
SkRect onGetBounds() override {
« no previous file with comments | « include/core/SkSurface.h ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698