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

Side by Side Diff: gm/perspshaders.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 unified diff | Download patch
« no previous file with comments | « gm/ninepatchstretch.cpp ('k') | gm/resizeimagefilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkSurface.h" 12 #include "SkSurface.h"
13 13
14 static sk_sp<SkImage> make_image(SkCanvas* origCanvas, int w, int h) { 14 static sk_sp<SkImage> make_image(SkCanvas* origCanvas, int w, int h) {
15 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); 15 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
16 SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info)); 16 auto surface(origCanvas->makeSurface(info));
17 if (nullptr == surface) { 17 if (nullptr == surface) {
18 surface.reset(SkSurface::NewRaster(info)); 18 surface = SkSurface::MakeRaster(info);
19 } 19 }
20 SkCanvas* canvas = surface->getCanvas(); 20 SkCanvas* canvas = surface->getCanvas();
21 21
22 sk_tool_utils::draw_checkerboard(canvas, SK_ColorRED, SK_ColorGREEN, w/10); 22 sk_tool_utils::draw_checkerboard(canvas, SK_ColorRED, SK_ColorGREEN, w/10);
23 return surface->makeImageSnapshot(); 23 return surface->makeImageSnapshot();
24 } 24 }
25 25
26 namespace skiagm { 26 namespace skiagm {
27 27
28 class PerspShadersGM : public GM { 28 class PerspShadersGM : public GM {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SkBitmap fBitmap; 165 SkBitmap fBitmap;
166 166
167 typedef GM INHERITED; 167 typedef GM INHERITED;
168 }; 168 };
169 169
170 ////////////////////////////////////////////////////////////////////////////// 170 //////////////////////////////////////////////////////////////////////////////
171 171
172 DEF_GM(return new PerspShadersGM(true);) 172 DEF_GM(return new PerspShadersGM(true);)
173 DEF_GM(return new PerspShadersGM(false);) 173 DEF_GM(return new PerspShadersGM(false);)
174 } 174 }
OLDNEW
« no previous file with comments | « gm/ninepatchstretch.cpp ('k') | gm/resizeimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698