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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 /////////////////////////////////////////////////////////////////////////////// | 106 /////////////////////////////////////////////////////////////////////////////// |
107 | 107 |
108 class GradientsGM : public GM { | 108 class GradientsGM : public GM { |
109 public: | 109 public: |
110 GradientsGM() { | 110 GradientsGM() { |
111 this->setBGColor(0xFFDDDDDD); | 111 this->setBGColor(0xFFDDDDDD); |
112 } | 112 } |
113 | 113 |
114 protected: | 114 protected: |
| 115 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 116 return kSkipTiled_Flag; |
| 117 } |
| 118 |
115 SkString onShortName() { | 119 SkString onShortName() { |
116 return SkString("gradients"); | 120 return SkString("gradients"); |
117 } | 121 } |
118 | 122 |
119 virtual SkISize onISize() { return SkISize::Make(840, 815); } | 123 virtual SkISize onISize() { return SkISize::Make(840, 815); } |
120 | 124 |
121 virtual void onDraw(SkCanvas* canvas) { | 125 virtual void onDraw(SkCanvas* canvas) { |
122 | 126 |
123 SkPoint pts[2] = { | 127 SkPoint pts[2] = { |
124 { 0, 0 }, | 128 { 0, 0 }, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 162 |
159 // Based on the original gradient slide, but with perspective applied to the | 163 // Based on the original gradient slide, but with perspective applied to the |
160 // gradient shaders' local matrices | 164 // gradient shaders' local matrices |
161 class GradientsLocalPerspectiveGM : public GM { | 165 class GradientsLocalPerspectiveGM : public GM { |
162 public: | 166 public: |
163 GradientsLocalPerspectiveGM() { | 167 GradientsLocalPerspectiveGM() { |
164 this->setBGColor(0xFFDDDDDD); | 168 this->setBGColor(0xFFDDDDDD); |
165 } | 169 } |
166 | 170 |
167 protected: | 171 protected: |
| 172 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 173 return kSkipTiled_Flag; |
| 174 } |
| 175 |
168 SkString onShortName() { | 176 SkString onShortName() { |
169 return SkString("gradients_local_perspective"); | 177 return SkString("gradients_local_perspective"); |
170 } | 178 } |
171 | 179 |
172 virtual SkISize onISize() { return SkISize::Make(840, 815); } | 180 virtual SkISize onISize() { return SkISize::Make(840, 815); } |
173 | 181 |
174 virtual void onDraw(SkCanvas* canvas) { | 182 virtual void onDraw(SkCanvas* canvas) { |
175 | 183 |
176 SkPoint pts[2] = { | 184 SkPoint pts[2] = { |
177 { 0, 0 }, | 185 { 0, 0 }, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 typedef GM INHERITED; | 295 typedef GM INHERITED; |
288 }; | 296 }; |
289 | 297 |
290 /// Tests correctness of *optimized* codepaths in gradients. | 298 /// Tests correctness of *optimized* codepaths in gradients. |
291 | 299 |
292 class ClampedGradientsGM : public GM { | 300 class ClampedGradientsGM : public GM { |
293 public: | 301 public: |
294 ClampedGradientsGM() {} | 302 ClampedGradientsGM() {} |
295 | 303 |
296 protected: | 304 protected: |
| 305 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 306 return kSkipTiled_Flag; |
| 307 } |
| 308 |
297 SkString onShortName() { return SkString("clamped_gradients"); } | 309 SkString onShortName() { return SkString("clamped_gradients"); } |
298 | 310 |
299 virtual SkISize onISize() { return SkISize::Make(640, 510); } | 311 virtual SkISize onISize() { return SkISize::Make(640, 510); } |
300 | 312 |
301 void drawBG(SkCanvas* canvas) { | 313 void drawBG(SkCanvas* canvas) { |
302 canvas->drawColor(0xFFDDDDDD); | 314 canvas->drawColor(0xFFDDDDDD); |
303 } | 315 } |
304 | 316 |
305 virtual void onDraw(SkCanvas* canvas) { | 317 virtual void onDraw(SkCanvas* canvas) { |
306 this->drawBG(canvas); | 318 this->drawBG(canvas); |
(...skipping 19 matching lines...) Expand all Loading... |
326 }; | 338 }; |
327 | 339 |
328 /// Checks quality of large radial gradients, which may display | 340 /// Checks quality of large radial gradients, which may display |
329 /// some banding. | 341 /// some banding. |
330 | 342 |
331 class RadialGradientGM : public GM { | 343 class RadialGradientGM : public GM { |
332 public: | 344 public: |
333 RadialGradientGM() {} | 345 RadialGradientGM() {} |
334 | 346 |
335 protected: | 347 protected: |
| 348 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 349 return kSkipTiled_Flag; |
| 350 } |
| 351 |
336 SkString onShortName() { return SkString("radial_gradient"); } | 352 SkString onShortName() { return SkString("radial_gradient"); } |
337 virtual SkISize onISize() { return SkISize::Make(1280, 1280); } | 353 virtual SkISize onISize() { return SkISize::Make(1280, 1280); } |
338 void drawBG(SkCanvas* canvas) { | 354 void drawBG(SkCanvas* canvas) { |
339 canvas->drawColor(0xFF000000); | 355 canvas->drawColor(0xFF000000); |
340 } | 356 } |
341 virtual void onDraw(SkCanvas* canvas) { | 357 virtual void onDraw(SkCanvas* canvas) { |
342 const SkISize dim = this->getISize(); | 358 const SkISize dim = this->getISize(); |
343 | 359 |
344 this->drawBG(canvas); | 360 this->drawBG(canvas); |
345 | 361 |
(...skipping 19 matching lines...) Expand all Loading... |
365 private: | 381 private: |
366 typedef GM INHERITED; | 382 typedef GM INHERITED; |
367 }; | 383 }; |
368 | 384 |
369 | 385 |
370 class RadialGradient2GM : public GM { | 386 class RadialGradient2GM : public GM { |
371 public: | 387 public: |
372 RadialGradient2GM() {} | 388 RadialGradient2GM() {} |
373 | 389 |
374 protected: | 390 protected: |
| 391 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 392 return kSkipTiled_Flag; |
| 393 } |
| 394 |
375 SkString onShortName() { return SkString("radial_gradient2"); } | 395 SkString onShortName() { return SkString("radial_gradient2"); } |
376 virtual SkISize onISize() { return SkISize::Make(800, 400); } | 396 virtual SkISize onISize() { return SkISize::Make(800, 400); } |
377 void drawBG(SkCanvas* canvas) { | 397 void drawBG(SkCanvas* canvas) { |
378 canvas->drawColor(0xFF000000); | 398 canvas->drawColor(0xFF000000); |
379 } | 399 } |
380 | 400 |
381 // Reproduces the example given in bug 7671058. | 401 // Reproduces the example given in bug 7671058. |
382 virtual void onDraw(SkCanvas* canvas) { | 402 virtual void onDraw(SkCanvas* canvas) { |
383 SkPaint paint1, paint2, paint3; | 403 SkPaint paint1, paint2, paint3; |
384 paint1.setStyle(SkPaint::kFill_Style); | 404 paint1.setStyle(SkPaint::kFill_Style); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 465 |
446 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } | 466 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } |
447 static GMRegistry reg5(MyFactory5); | 467 static GMRegistry reg5(MyFactory5); |
448 | 468 |
449 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } | 469 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } |
450 static GMRegistry reg6(MyFactory6); | 470 static GMRegistry reg6(MyFactory6); |
451 | 471 |
452 static GM* MyFactory7(void*) { return new RadialGradient2GM; } | 472 static GM* MyFactory7(void*) { return new RadialGradient2GM; } |
453 static GMRegistry reg7(MyFactory7); | 473 static GMRegistry reg7(MyFactory7); |
454 } | 474 } |
OLD | NEW |