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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 /////////////////////////////////////////////////////////////////////////////// | 86 /////////////////////////////////////////////////////////////////////////////// |
87 | 87 |
88 class GradientsNoTextureGM : public GM { | 88 class GradientsNoTextureGM : public GM { |
89 public: | 89 public: |
90 GradientsNoTextureGM() { | 90 GradientsNoTextureGM() { |
91 this->setBGColor(0xFFDDDDDD); | 91 this->setBGColor(0xFFDDDDDD); |
92 } | 92 } |
93 | 93 |
94 protected: | 94 protected: |
| 95 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 96 return kSkipTiled_Flag; |
| 97 } |
| 98 |
95 SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture")
; } | 99 SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture")
; } |
96 virtual SkISize onISize() SK_OVERRIDE { return make_isize(640, 615); } | 100 virtual SkISize onISize() SK_OVERRIDE { return make_isize(640, 615); } |
97 | 101 |
98 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 102 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
99 static const SkPoint kPts[2] = { { 0, 0 }, | 103 static const SkPoint kPts[2] = { { 0, 0 }, |
100 { SkIntToScalar(50), SkIntToScalar(50)
} }; | 104 { SkIntToScalar(50), SkIntToScalar(50)
} }; |
101 static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; | 105 static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; |
102 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; | 106 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; |
103 SkPaint paint; | 107 SkPaint paint; |
104 paint.setAntiAlias(true); | 108 paint.setAntiAlias(true); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 enum { | 211 enum { |
208 W = 800, | 212 W = 800, |
209 }; | 213 }; |
210 SkAutoTUnref<SkShader> fShader; | 214 SkAutoTUnref<SkShader> fShader; |
211 | 215 |
212 typedef void (*Proc)(ColorPos*); | 216 typedef void (*Proc)(ColorPos*); |
213 public: | 217 public: |
214 GradientsManyColorsGM() {} | 218 GradientsManyColorsGM() {} |
215 | 219 |
216 protected: | 220 protected: |
| 221 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 222 return kSkipTiled_Flag; |
| 223 } |
| 224 |
217 SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); } | 225 SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); } |
218 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); } | 226 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); } |
219 | 227 |
220 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 228 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
221 const Proc procs[] = { | 229 const Proc procs[] = { |
222 make0, make1, make2, | 230 make0, make1, make2, |
223 }; | 231 }; |
224 const SkPoint pts[] = { | 232 const SkPoint pts[] = { |
225 { 0, 0 }, | 233 { 0, 0 }, |
226 { SkIntToScalar(W), 0 }, | 234 { SkIntToScalar(W), 0 }, |
(...skipping 21 matching lines...) Expand all Loading... |
248 } | 256 } |
249 | 257 |
250 private: | 258 private: |
251 typedef GM INHERITED; | 259 typedef GM INHERITED; |
252 }; | 260 }; |
253 | 261 |
254 /////////////////////////////////////////////////////////////////////////////// | 262 /////////////////////////////////////////////////////////////////////////////// |
255 | 263 |
256 DEF_GM( return SkNEW(GradientsNoTextureGM)); | 264 DEF_GM( return SkNEW(GradientsNoTextureGM)); |
257 DEF_GM( return SkNEW(GradientsManyColorsGM)); | 265 DEF_GM( return SkNEW(GradientsManyColorsGM)); |
OLD | NEW |