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 "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 SkString onShortName() override { | 44 SkString onShortName() override { |
45 return fName; | 45 return fName; |
46 } | 46 } |
47 | 47 |
48 SkISize onISize() override { | 48 SkISize onISize() override { |
49 return SkISize::Make(800, 800); | 49 return SkISize::Make(800, 800); |
50 } | 50 } |
51 | 51 |
52 void onDraw(SkCanvas* canvas) override { | 52 void onDraw(SkCanvas* canvas) override { |
53 const SkColor colors[] = { sk_tool_utils::color_to_565(0xFF555555), | 53 const SkColor colors[] = { sk_tool_utils::color_to_565(0xFF555555), |
54 sk_tool_utils::color_to_565(0xFF444444) }; | 54 sk_tool_utils::color_to_565(0xFF444444) }; |
55 const int colorCount = SK_ARRAY_COUNT(colors); | 55 const int colorCount = SK_ARRAY_COUNT(colors); |
56 | 56 |
57 SkRect r = { 0, 0, this->width(), this->height() }; | 57 SkRect r = { 0, 0, this->width(), this->height() }; |
58 SkSize size = SkSize::Make(r.width(), r.height()); | 58 SkSize size = SkSize::Make(r.width(), r.height()); |
59 | 59 |
60 SkPaint paint; | 60 SkPaint paint; |
61 paint.setShader(fProc(colors, colorCount, size)); | 61 paint.setShader(fProc(colors, colorCount, size)); |
62 paint.setDither(fDither); | 62 paint.setDither(fDither); |
63 canvas->drawRect(r, paint); | 63 canvas->drawRect(r, paint); |
(...skipping 11 matching lines...) Expand all Loading... |
75 | 75 |
76 DEF_GM( return new ShallowGradientGM(shader_linear, "linear", true); ) | 76 DEF_GM( return new ShallowGradientGM(shader_linear, "linear", true); ) |
77 DEF_GM( return new ShallowGradientGM(shader_radial, "radial", true); ) | 77 DEF_GM( return new ShallowGradientGM(shader_radial, "radial", true); ) |
78 DEF_GM( return new ShallowGradientGM(shader_conical, "conical", true); ) | 78 DEF_GM( return new ShallowGradientGM(shader_conical, "conical", true); ) |
79 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep", true); ) | 79 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep", true); ) |
80 | 80 |
81 DEF_GM( return new ShallowGradientGM(shader_linear, "linear_nodither", false); ) | 81 DEF_GM( return new ShallowGradientGM(shader_linear, "linear_nodither", false); ) |
82 DEF_GM( return new ShallowGradientGM(shader_radial, "radial_nodither", false); ) | 82 DEF_GM( return new ShallowGradientGM(shader_radial, "radial_nodither", false); ) |
83 DEF_GM( return new ShallowGradientGM(shader_conical, "conical_nodither", false);
) | 83 DEF_GM( return new ShallowGradientGM(shader_conical, "conical_nodither", false);
) |
84 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep_nodither", false); ) | 84 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep_nodither", false); ) |
OLD | NEW |