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

Side by Side Diff: gm/drawminibitmaprect.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/drawbitmaprect.cpp ('k') | gm/fatpathfill.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 "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "SkImage.h" 11 #include "SkImage.h"
12 #include "SkRandom.h" 12 #include "SkRandom.h"
13 #include "SkShader.h" 13 #include "SkShader.h"
14 #include "SkSurface.h" 14 #include "SkSurface.h"
15 15
16 static sk_sp<SkImage> makebm(SkCanvas* caller, int w, int h) { 16 static sk_sp<SkImage> makebm(SkCanvas* caller, int w, int h) {
17 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h); 17 SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
18 SkAutoTUnref<SkSurface> surface(caller->newSurface(info)); 18 auto surface(caller->makeSurface(info));
19 if (nullptr == surface) { 19 if (nullptr == surface) {
20 surface.reset(SkSurface::NewRaster(info)); 20 surface = SkSurface::MakeRaster(info);
21 } 21 }
22 SkCanvas* canvas = surface->getCanvas(); 22 SkCanvas* canvas = surface->getCanvas();
23 23
24 const SkScalar wScalar = SkIntToScalar(w); 24 const SkScalar wScalar = SkIntToScalar(w);
25 const SkScalar hScalar = SkIntToScalar(h); 25 const SkScalar hScalar = SkIntToScalar(h);
26 26
27 const SkPoint pt = { wScalar / 2, hScalar / 2 }; 27 const SkPoint pt = { wScalar / 2, hScalar / 2 };
28 28
29 const SkScalar radius = 4 * SkMaxScalar(wScalar, hScalar); 29 const SkScalar radius = 4 * SkMaxScalar(wScalar, hScalar);
30 30
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool fAA; 134 bool fAA;
135 sk_sp<SkImage> fImage; 135 sk_sp<SkImage> fImage;
136 SkString fName; 136 SkString fName;
137 137
138 typedef skiagm::GM INHERITED; 138 typedef skiagm::GM INHERITED;
139 }; 139 };
140 140
141 DEF_GM( return new DrawMiniBitmapRectGM(true); ) 141 DEF_GM( return new DrawMiniBitmapRectGM(true); )
142 DEF_GM( return new DrawMiniBitmapRectGM(false); ) 142 DEF_GM( return new DrawMiniBitmapRectGM(false); )
143 143
OLDNEW
« no previous file with comments | « gm/drawbitmaprect.cpp ('k') | gm/fatpathfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698