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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 SkShader::TileMode tm, const SkMatrix& localMatri
x); | 94 SkShader::TileMode tm, const SkMatrix& localMatri
x); |
95 static const GradMaker gGradMakers[] = { | 95 static const GradMaker gGradMakers[] = { |
96 MakeLinear, MakeRadial, MakeSweep, Make2Radial, Make2Conical | 96 MakeLinear, MakeRadial, MakeSweep, Make2Radial, Make2Conical |
97 }; | 97 }; |
98 | 98 |
99 /////////////////////////////////////////////////////////////////////////////// | 99 /////////////////////////////////////////////////////////////////////////////// |
100 | 100 |
101 class GradientsGM : public GM { | 101 class GradientsGM : public GM { |
102 public: | 102 public: |
103 GradientsGM() { | 103 GradientsGM() { |
104 this->setBGColor(0xFFDDDDDD); | 104 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
105 } | 105 } |
106 | 106 |
107 protected: | 107 protected: |
108 | 108 |
109 SkString onShortName() { | 109 SkString onShortName() { |
110 return SkString("gradients"); | 110 return SkString("gradients"); |
111 } | 111 } |
112 | 112 |
113 virtual SkISize onISize() { return SkISize::Make(840, 815); } | 113 virtual SkISize onISize() { return SkISize::Make(840, 815); } |
114 | 114 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 private: | 149 private: |
150 typedef GM INHERITED; | 150 typedef GM INHERITED; |
151 }; | 151 }; |
152 DEF_GM( return new GradientsGM; ) | 152 DEF_GM( return new GradientsGM; ) |
153 | 153 |
154 // Based on the original gradient slide, but with perspective applied to the | 154 // Based on the original gradient slide, but with perspective applied to the |
155 // gradient shaders' local matrices | 155 // gradient shaders' local matrices |
156 class GradientsLocalPerspectiveGM : public GM { | 156 class GradientsLocalPerspectiveGM : public GM { |
157 public: | 157 public: |
158 GradientsLocalPerspectiveGM() { | 158 GradientsLocalPerspectiveGM() { |
159 this->setBGColor(0xFFDDDDDD); | 159 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
160 } | 160 } |
161 | 161 |
162 protected: | 162 protected: |
163 | 163 |
164 SkString onShortName() { | 164 SkString onShortName() { |
165 return SkString("gradients_local_perspective"); | 165 return SkString("gradients_local_perspective"); |
166 } | 166 } |
167 | 167 |
168 virtual SkISize onISize() { return SkISize::Make(840, 815); } | 168 virtual SkISize onISize() { return SkISize::Make(840, 815); } |
169 | 169 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 paint.setShader(fShader); | 454 paint.setShader(fShader); |
455 canvas->drawRect(SkRect::MakeWH(500, 500), paint); | 455 canvas->drawRect(SkRect::MakeWH(500, 500), paint); |
456 } | 456 } |
457 | 457 |
458 private: | 458 private: |
459 typedef GM INHERITED; | 459 typedef GM INHERITED; |
460 }; | 460 }; |
461 DEF_GM( return new RadialGradient3GM; ) | 461 DEF_GM( return new RadialGradient3GM; ) |
462 | 462 |
463 } | 463 } |
OLD | NEW |