OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2, | 31 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2, |
32 SkShader::kClamp_TileMode,
flags, nullptr)); | 32 SkShader::kClamp_TileMode,
flags, nullptr)); |
33 canvas->drawRect(r, paint); | 33 canvas->drawRect(r, paint); |
34 | 34 |
35 paint.setShader(nullptr); | 35 paint.setShader(nullptr); |
36 paint.setStyle(SkPaint::kStroke_Style); | 36 paint.setStyle(SkPaint::kStroke_Style); |
37 canvas->drawRect(r, paint); | 37 canvas->drawRect(r, paint); |
38 } | 38 } |
39 | 39 |
40 void onDraw(SkCanvas* canvas) override { | 40 void onDraw(SkCanvas* canvas) override { |
41 static const struct { | 41 constexpr struct { |
42 SkColor fColor0; | 42 SkColor fColor0; |
43 SkColor fColor1; | 43 SkColor fColor1; |
44 } gRec[] = { | 44 } gRec[] = { |
45 { 0xFFFFFFFF, 0x00000000 }, | 45 { 0xFFFFFFFF, 0x00000000 }, |
46 { 0xFFFFFFFF, 0x00FF0000 }, | 46 { 0xFFFFFFFF, 0x00FF0000 }, |
47 { 0xFFFFFFFF, 0x00FFFF00 }, | 47 { 0xFFFFFFFF, 0x00FFFF00 }, |
48 { 0xFFFFFFFF, 0x00FFFFFF }, | 48 { 0xFFFFFFFF, 0x00FFFFFF }, |
49 { 0xFFFF0000, 0x00000000 }, | 49 { 0xFFFF0000, 0x00000000 }, |
50 { 0xFFFF0000, 0x00FF0000 }, | 50 { 0xFFFF0000, 0x00FF0000 }, |
51 { 0xFFFF0000, 0x00FFFF00 }, | 51 { 0xFFFF0000, 0x00FFFF00 }, |
(...skipping 17 matching lines...) Expand all Loading... |
69 canvas->restore(); | 69 canvas->restore(); |
70 canvas->translate(r.width() + 10, 0); | 70 canvas->translate(r.width() + 10, 0); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 private: | 74 private: |
75 typedef skiagm::GM INHERITED; | 75 typedef skiagm::GM INHERITED; |
76 }; | 76 }; |
77 | 77 |
78 DEF_GM(return new AlphaGradientsGM;) | 78 DEF_GM(return new AlphaGradientsGM;) |
OLD | NEW |