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

Side by Side Diff: gm/roundrects.cpp

Issue 1790353002: Revert of more shader-->sp conversions (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/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 auto shader = SkGradientShader::MakeRadial(center, 20, colors, pos, SK_A RRAY_COUNT(colors), 264 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center,
265 SkShader::kClamp_TileMode); 265 SkIntToScalar(20),
266 colors,
267 pos,
268 SK_ARRAY_COUNT(colors),
269 SkShader::kClamp_TileMode)) ;
266 270
267 for (int i = 0; i < fPaints.count(); ++i) { 271 for (int i = 0; i < fPaints.count(); ++i) {
268 canvas->save(); 272 canvas->save();
269 // position the path, and make it at off-integer coords. 273 // position the path, and make it at off-integer coords.
270 canvas->translate(kXStart + SK_Scalar1 * kXStep * 0 + SK_Scalar1 / 4 , 274 canvas->translate(kXStart + SK_Scalar1 * kXStep * 0 + SK_Scalar1 / 4 ,
271 kYStart + SK_Scalar1 * kYStep * i + 3 * SK_Scalar1 / 4 + 275 kYStart + SK_Scalar1 * kYStep * i + 3 * SK_Scalar1 / 4 +
272 SK_ScalarHalf * kYStep); 276 SK_ScalarHalf * kYStep);
273 277
274 SkColor color = gen_color(&rand); 278 SkColor color = gen_color(&rand);
275 fPaints[i].setColor(color); 279 fPaints[i].setColor(color);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 349
346 typedef GM INHERITED; 350 typedef GM INHERITED;
347 }; 351 };
348 352
349 ////////////////////////////////////////////////////////////////////////////// 353 //////////////////////////////////////////////////////////////////////////////
350 354
351 static GM* MyFactory(void*) { return new RoundRectGM; } 355 static GM* MyFactory(void*) { return new RoundRectGM; }
352 static GMRegistry reg(MyFactory); 356 static GMRegistry reg(MyFactory);
353 357
354 } 358 }
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