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

Unified Diff: gm/multipicturedraw.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/mipmap.cpp ('k') | gm/ninepatchstretch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/multipicturedraw.cpp
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index a4b09b2c2fcc7bd7bd0b5b77c14d025fa98b8c9f..03934a601d5cac435fe4b3cdaabc406d641f3fc3 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -241,15 +241,14 @@ static sk_sp<SkPicture> make_sierpinski_picture() {
return recorder.finishRecordingAsPicture();
}
-static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height) {
+static sk_sp<SkSurface> create_compat_surface(SkCanvas* canvas, int width, int height) {
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- SkSurface* surface = canvas->newSurface(info);
+ auto surface = canvas->makeSurface(info);
if (nullptr == surface) {
// picture canvas returns nullptr so fall back to raster
- surface = SkSurface::NewRaster(info);
+ surface = SkSurface::MakeRaster(info);
}
-
return surface;
}
@@ -257,13 +256,12 @@ static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height)
// fragments potentially generated by the MultiPictureDraw object
class ComposeStep {
public:
- ComposeStep() : fSurf(nullptr), fX(0.0f), fY(0.0f), fPaint(nullptr) { }
+ ComposeStep() : fX(0.0f), fY(0.0f), fPaint(nullptr) { }
~ComposeStep() {
- SkSafeUnref(fSurf);
delete fPaint;
}
- SkSurface* fSurf;
+ sk_sp<SkSurface> fSurf;
SkScalar fX;
SkScalar fY;
SkPaint* fPaint;
« no previous file with comments | « gm/mipmap.cpp ('k') | gm/ninepatchstretch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698