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

Side by Side Diff: gm/roundrects.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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/rects.cpp ('k') | gm/samplerstress.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkTArray.h" 10 #include "SkTArray.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 fPaints[i].setColor(color); 254 fPaints[i].setColor(color);
255 255
256 canvas->drawRRect(circleRect, fPaints[i]); 256 canvas->drawRRect(circleRect, fPaints[i]);
257 canvas->restore(); 257 canvas->restore();
258 } 258 }
259 259
260 // radial gradient 260 // radial gradient
261 SkPoint center = SkPoint::Make(SkIntToScalar(0), SkIntToScalar(0)); 261 SkPoint center = SkPoint::Make(SkIntToScalar(0), SkIntToScalar(0));
262 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN }; 262 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN };
263 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 }; 263 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 };
264 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center, 264 auto shader = SkGradientShader::MakeRadial(center, 20, colors, pos, SK_A RRAY_COUNT(colors),
265 SkIntToScalar(20), 265 SkShader::kClamp_TileMode);
266 colors,
267 pos,
268 SK_ARRAY_COUNT(colors),
269 SkShader::kClamp_TileMode)) ;
270 266
271 for (int i = 0; i < fPaints.count(); ++i) { 267 for (int i = 0; i < fPaints.count(); ++i) {
272 canvas->save(); 268 canvas->save();
273 // position the path, and make it at off-integer coords. 269 // position the path, and make it at off-integer coords.
274 canvas->translate(kXStart + SK_Scalar1 * kXStep * 0 + SK_Scalar1 / 4 , 270 canvas->translate(kXStart + SK_Scalar1 * kXStep * 0 + SK_Scalar1 / 4 ,
275 kYStart + SK_Scalar1 * kYStep * i + 3 * SK_Scalar1 / 4 + 271 kYStart + SK_Scalar1 * kYStep * i + 3 * SK_Scalar1 / 4 +
276 SK_ScalarHalf * kYStep); 272 SK_ScalarHalf * kYStep);
277 273
278 SkColor color = gen_color(&rand); 274 SkColor color = gen_color(&rand);
279 fPaints[i].setColor(color); 275 fPaints[i].setColor(color);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 345
350 typedef GM INHERITED; 346 typedef GM INHERITED;
351 }; 347 };
352 348
353 ////////////////////////////////////////////////////////////////////////////// 349 //////////////////////////////////////////////////////////////////////////////
354 350
355 static GM* MyFactory(void*) { return new RoundRectGM; } 351 static GM* MyFactory(void*) { return new RoundRectGM; }
356 static GMRegistry reg(MyFactory); 352 static GMRegistry reg(MyFactory);
357 353
358 } 354 }
OLDNEW
« no previous file with comments | « gm/rects.cpp ('k') | gm/samplerstress.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698