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

Side by Side Diff: gm/imagefilterscropexpand.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/imagefiltersclipped.cpp ('k') | gm/imagefiltersscaled.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 2014 Google Inc. 2 * Copyright 2014 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); 136 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint);
137 canvas.restore(); 137 canvas.restore();
138 } 138 }
139 } 139 }
140 } 140 }
141 141
142 static sk_sp<SkImage> MakeGradientCircle(int width, int height) { 142 static sk_sp<SkImage> MakeGradientCircle(int width, int height) {
143 SkScalar x = SkIntToScalar(width / 2); 143 SkScalar x = SkIntToScalar(width / 2);
144 SkScalar y = SkIntToScalar(height / 2); 144 SkScalar y = SkIntToScalar(height / 2);
145 SkScalar radius = SkMinScalar(x, y) * 0.8f; 145 SkScalar radius = SkMinScalar(x, y) * 0.8f;
146 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, hei ght)); 146 auto surface(SkSurface::MakeRasterN32Premul(width, height));
147 SkCanvas* canvas = surface->getCanvas(); 147 SkCanvas* canvas = surface->getCanvas();
148 canvas->clear(0x00000000); 148 canvas->clear(0x00000000);
149 SkColor colors[2]; 149 SkColor colors[2];
150 colors[0] = SK_ColorWHITE; 150 colors[0] = SK_ColorWHITE;
151 colors[1] = SK_ColorBLACK; 151 colors[1] = SK_ColorBLACK;
152 SkPaint paint; 152 SkPaint paint;
153 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr, 153 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr,
154 2, SkShader::kClamp_TileMod e)); 154 2, SkShader::kClamp_TileMod e));
155 canvas->drawCircle(x, y, radius, paint); 155 canvas->drawCircle(x, y, radius, paint);
156 156
(...skipping 14 matching lines...) Expand all
171 171
172 canvas->translate(SkIntToScalar(80), 0); 172 canvas->translate(SkIntToScalar(80), 0);
173 } 173 }
174 174
175 typedef GM INHERITED; 175 typedef GM INHERITED;
176 }; 176 };
177 177
178 /////////////////////////////////////////////////////////////////////////////// 178 ///////////////////////////////////////////////////////////////////////////////
179 179
180 DEF_GM( return new ImageFiltersCropExpandGM; ) 180 DEF_GM( return new ImageFiltersCropExpandGM; )
OLDNEW
« no previous file with comments | « gm/imagefiltersclipped.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698