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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
11 #include "SkTypeface.h" | 11 #include "SkTypeface.h" |
12 | 12 |
13 // test shader w/ transparency | 13 // test shader w/ transparency |
14 static SkShader* make_grad(SkScalar width) { | 14 static SkShader* make_grad(SkScalar width) { |
15 SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE }; | 15 SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE }; |
16 SkPoint pts[] = { { 0, 0 }, { width, 0 } }; | 16 SkPoint pts[] = { { 0, 0 }, { width, 0 } }; |
17 return SkGradientShader::CreateLinear(pts, colors, NULL, | 17 return SkGradientShader::CreateLinear(pts, colors, nullptr, |
18 SK_ARRAY_COUNT(colors), | 18 SK_ARRAY_COUNT(colors), |
19 SkShader::kMirror_TileMode); | 19 SkShader::kMirror_TileMode); |
20 } | 20 } |
21 | 21 |
22 // test opaque shader | 22 // test opaque shader |
23 static SkShader* make_grad2(SkScalar width) { | 23 static SkShader* make_grad2(SkScalar width) { |
24 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; | 24 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
25 SkPoint pts[] = { { 0, 0 }, { width, 0 } }; | 25 SkPoint pts[] = { { 0, 0 }, { width, 0 } }; |
26 return SkGradientShader::CreateLinear(pts, colors, NULL, | 26 return SkGradientShader::CreateLinear(pts, colors, nullptr, |
27 SK_ARRAY_COUNT(colors), | 27 SK_ARRAY_COUNT(colors), |
28 SkShader::kMirror_TileMode); | 28 SkShader::kMirror_TileMode); |
29 } | 29 } |
30 | 30 |
31 static SkShader* make_chrome_solid() { | 31 static SkShader* make_chrome_solid() { |
32 SkColor colors[] = { SK_ColorGREEN, SK_ColorGREEN }; | 32 SkColor colors[] = { SK_ColorGREEN, SK_ColorGREEN }; |
33 SkPoint pts[] = { { 0, 0 }, { 1, 0 } }; | 33 SkPoint pts[] = { { 0, 0 }, { 1, 0 } }; |
34 return SkGradientShader::CreateLinear(pts, colors, NULL, 2, | 34 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, |
35 SkShader::kClamp_TileMode); | 35 SkShader::kClamp_TileMode); |
36 } | 36 } |
37 | 37 |
38 namespace skiagm { | 38 namespace skiagm { |
39 | 39 |
40 // Replicate chrome layout test - clipped pathed gradient-shaded text | 40 // Replicate chrome layout test - clipped pathed gradient-shaded text |
41 class ChromeGradTextGM1 : public GM { | 41 class ChromeGradTextGM1 : public GM { |
42 public: | 42 public: |
43 ChromeGradTextGM1() { } | 43 ChromeGradTextGM1() { } |
44 protected: | 44 protected: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 ////////////////////////////////////////////////////////////////////////////// | 159 ////////////////////////////////////////////////////////////////////////////// |
160 | 160 |
161 static GM* MyFactory(void*) { return new GradTextGM; } | 161 static GM* MyFactory(void*) { return new GradTextGM; } |
162 static GM* CMyFactory(void*) { return new ChromeGradTextGM1; } | 162 static GM* CMyFactory(void*) { return new ChromeGradTextGM1; } |
163 static GM* CMyFactory2(void*) { return new ChromeGradTextGM2; } | 163 static GM* CMyFactory2(void*) { return new ChromeGradTextGM2; } |
164 | 164 |
165 static GMRegistry reg(MyFactory); | 165 static GMRegistry reg(MyFactory); |
166 static GMRegistry Creg(CMyFactory); | 166 static GMRegistry Creg(CMyFactory); |
167 static GMRegistry Creg2(CMyFactory2); | 167 static GMRegistry Creg2(CMyFactory2); |
168 } | 168 } |
OLD | NEW |