OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(0xFFDDDDDD); |
105 } | 105 } |
106 | 106 |
107 protected: | 107 protected: |
108 uint32_t onGetFlags() const SK_OVERRIDE { | |
109 return kSkipTiled_Flag; | |
110 } | |
111 | 108 |
112 SkString onShortName() { | 109 SkString onShortName() { |
113 return SkString("gradients"); | 110 return SkString("gradients"); |
114 } | 111 } |
115 | 112 |
116 virtual SkISize onISize() { return SkISize::Make(840, 815); } | 113 virtual SkISize onISize() { return SkISize::Make(840, 815); } |
117 | 114 |
118 virtual void onDraw(SkCanvas* canvas) { | 115 virtual void onDraw(SkCanvas* canvas) { |
119 | 116 |
120 SkPoint pts[2] = { | 117 SkPoint pts[2] = { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 152 |
156 // Based on the original gradient slide, but with perspective applied to the | 153 // Based on the original gradient slide, but with perspective applied to the |
157 // gradient shaders' local matrices | 154 // gradient shaders' local matrices |
158 class GradientsLocalPerspectiveGM : public GM { | 155 class GradientsLocalPerspectiveGM : public GM { |
159 public: | 156 public: |
160 GradientsLocalPerspectiveGM() { | 157 GradientsLocalPerspectiveGM() { |
161 this->setBGColor(0xFFDDDDDD); | 158 this->setBGColor(0xFFDDDDDD); |
162 } | 159 } |
163 | 160 |
164 protected: | 161 protected: |
165 uint32_t onGetFlags() const SK_OVERRIDE { | |
166 return kSkipTiled_Flag; | |
167 } | |
168 | 162 |
169 SkString onShortName() { | 163 SkString onShortName() { |
170 return SkString("gradients_local_perspective"); | 164 return SkString("gradients_local_perspective"); |
171 } | 165 } |
172 | 166 |
173 virtual SkISize onISize() { return SkISize::Make(840, 815); } | 167 virtual SkISize onISize() { return SkISize::Make(840, 815); } |
174 | 168 |
175 virtual void onDraw(SkCanvas* canvas) { | 169 virtual void onDraw(SkCanvas* canvas) { |
176 | 170 |
177 SkPoint pts[2] = { | 171 SkPoint pts[2] = { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 }; | 321 }; |
328 | 322 |
329 /// Checks quality of large radial gradients, which may display | 323 /// Checks quality of large radial gradients, which may display |
330 /// some banding. | 324 /// some banding. |
331 | 325 |
332 class RadialGradientGM : public GM { | 326 class RadialGradientGM : public GM { |
333 public: | 327 public: |
334 RadialGradientGM() {} | 328 RadialGradientGM() {} |
335 | 329 |
336 protected: | 330 protected: |
337 uint32_t onGetFlags() const SK_OVERRIDE { | |
338 return kSkipTiled_Flag; | |
339 } | |
340 | 331 |
341 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient"); } | 332 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient"); } |
342 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1280, 1280); } | 333 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1280, 1280); } |
343 void drawBG(SkCanvas* canvas) { | 334 void drawBG(SkCanvas* canvas) { |
344 canvas->drawColor(0xFF000000); | 335 canvas->drawColor(0xFF000000); |
345 } | 336 } |
346 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 337 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
347 const SkISize dim = this->getISize(); | 338 const SkISize dim = this->getISize(); |
348 | 339 |
349 this->drawBG(canvas); | 340 this->drawBG(canvas); |
(...skipping 20 matching lines...) Expand all Loading... |
370 private: | 361 private: |
371 typedef GM INHERITED; | 362 typedef GM INHERITED; |
372 }; | 363 }; |
373 | 364 |
374 | 365 |
375 class RadialGradient2GM : public GM { | 366 class RadialGradient2GM : public GM { |
376 public: | 367 public: |
377 RadialGradient2GM() {} | 368 RadialGradient2GM() {} |
378 | 369 |
379 protected: | 370 protected: |
380 uint32_t onGetFlags() const SK_OVERRIDE { | |
381 return kSkipTiled_Flag; | |
382 } | |
383 | 371 |
384 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient2"); } | 372 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient2"); } |
385 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 400); } | 373 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 400); } |
386 void drawBG(SkCanvas* canvas) { | 374 void drawBG(SkCanvas* canvas) { |
387 canvas->drawColor(0xFF000000); | 375 canvas->drawColor(0xFF000000); |
388 } | 376 } |
389 | 377 |
390 // Reproduces the example given in bug 7671058. | 378 // Reproduces the example given in bug 7671058. |
391 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 379 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
392 SkPaint paint1, paint2, paint3; | 380 SkPaint paint1, paint2, paint3; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 442 |
455 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } | 443 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } |
456 static GMRegistry reg5(MyFactory5); | 444 static GMRegistry reg5(MyFactory5); |
457 | 445 |
458 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } | 446 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } |
459 static GMRegistry reg6(MyFactory6); | 447 static GMRegistry reg6(MyFactory6); |
460 | 448 |
461 static GM* MyFactory7(void*) { return new RadialGradient2GM; } | 449 static GM* MyFactory7(void*) { return new RadialGradient2GM; } |
462 static GMRegistry reg7(MyFactory7); | 450 static GMRegistry reg7(MyFactory7); |
463 } | 451 } |
OLD | NEW |