| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |