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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkGradientShader.h" | 8 #include "SkGradientShader.h" |
9 | 9 |
10 using namespace skiagm; | 10 using namespace skiagm; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 /////////////////////////////////////////////////////////////////////////////// | 79 /////////////////////////////////////////////////////////////////////////////// |
80 | 80 |
81 class GradientsNoTextureGM : public GM { | 81 class GradientsNoTextureGM : public GM { |
82 public: | 82 public: |
83 GradientsNoTextureGM() { | 83 GradientsNoTextureGM() { |
84 this->setBGColor(0xFFDDDDDD); | 84 this->setBGColor(0xFFDDDDDD); |
85 } | 85 } |
86 | 86 |
87 protected: | 87 protected: |
88 uint32_t onGetFlags() const SK_OVERRIDE { | |
89 return kSkipTiled_Flag; | |
90 } | |
91 | 88 |
92 SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture")
; } | 89 SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture")
; } |
93 SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 615); } | 90 SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 615); } |
94 | 91 |
95 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 92 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
96 static const SkPoint kPts[2] = { { 0, 0 }, | 93 static const SkPoint kPts[2] = { { 0, 0 }, |
97 { SkIntToScalar(50), SkIntToScalar(50)
} }; | 94 { SkIntToScalar(50), SkIntToScalar(50)
} }; |
98 static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; | 95 static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; |
99 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; | 96 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; |
100 SkPaint paint; | 97 SkPaint paint; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 enum { | 201 enum { |
205 W = 800, | 202 W = 800, |
206 }; | 203 }; |
207 SkAutoTUnref<SkShader> fShader; | 204 SkAutoTUnref<SkShader> fShader; |
208 | 205 |
209 typedef void (*Proc)(ColorPos*); | 206 typedef void (*Proc)(ColorPos*); |
210 public: | 207 public: |
211 GradientsManyColorsGM() {} | 208 GradientsManyColorsGM() {} |
212 | 209 |
213 protected: | 210 protected: |
214 uint32_t onGetFlags() const SK_OVERRIDE { | |
215 return kSkipTiled_Flag; | |
216 } | |
217 | 211 |
218 SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); } | 212 SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); } |
219 SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); } | 213 SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); } |
220 | 214 |
221 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 215 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
222 const Proc procs[] = { | 216 const Proc procs[] = { |
223 make0, make1, make2, | 217 make0, make1, make2, |
224 }; | 218 }; |
225 const SkPoint pts[] = { | 219 const SkPoint pts[] = { |
226 { 0, 0 }, | 220 { 0, 0 }, |
(...skipping 22 matching lines...) Expand all Loading... |
249 } | 243 } |
250 | 244 |
251 private: | 245 private: |
252 typedef GM INHERITED; | 246 typedef GM INHERITED; |
253 }; | 247 }; |
254 | 248 |
255 /////////////////////////////////////////////////////////////////////////////// | 249 /////////////////////////////////////////////////////////////////////////////// |
256 | 250 |
257 DEF_GM( return SkNEW(GradientsNoTextureGM)); | 251 DEF_GM( return SkNEW(GradientsNoTextureGM)); |
258 DEF_GM( return SkNEW(GradientsManyColorsGM)); | 252 DEF_GM( return SkNEW(GradientsManyColorsGM)); |
OLD | NEW |