OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 | 10 |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 SkISize onISize() override { return SkISize::Make(500, 500); } | 442 SkISize onISize() override { return SkISize::Make(500, 500); } |
443 | 443 |
444 bool runAsBench() const override { return true; } | 444 bool runAsBench() const override { return true; } |
445 | 445 |
446 void onOnceBeforeDraw() override { | 446 void onOnceBeforeDraw() override { |
447 const SkPoint center = { 0, 0 }; | 447 const SkPoint center = { 0, 0 }; |
448 const SkScalar kRadius = 3000; | 448 const SkScalar kRadius = 3000; |
449 const SkColor gColors[] = { 0xFFFFFFFF, 0xFF000000 }; | 449 const SkColor gColors[] = { 0xFFFFFFFF, 0xFF000000 }; |
450 fShader.reset(SkGradientShader::CreateRadial(center, kRadius, gColors, N
ULL, 2, | 450 fShader.reset(SkGradientShader::CreateRadial(center, kRadius, gColors, N
ULL, 2, |
451 SkShader::kClamp_TileMode))
; | 451 SkShader::kClamp_TileMode)); |
452 } | 452 } |
453 | 453 |
454 void onDraw(SkCanvas* canvas) override { | 454 void onDraw(SkCanvas* canvas) override { |
455 SkPaint paint; | 455 SkPaint paint; |
456 paint.setShader(fShader); | 456 paint.setShader(fShader); |
457 canvas->drawRect(SkRect::MakeWH(500, 500), paint); | 457 canvas->drawRect(SkRect::MakeWH(500, 500), paint); |
458 } | 458 } |
459 | 459 |
460 private: | 460 private: |
461 typedef GM INHERITED; | 461 typedef GM INHERITED; |
462 }; | 462 }; |
463 DEF_GM( return new RadialGradient3GM; ) | 463 DEF_GM( return new RadialGradient3GM; ) |
464 | 464 |
465 } | 465 } |
OLD | NEW |