| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 /// Checks quality of large radial gradients, which may display | 323 /// Checks quality of large radial gradients, which may display |
| 324 /// some banding. | 324 /// some banding. |
| 325 | 325 |
| 326 class RadialGradientGM : public GM { | 326 class RadialGradientGM : public GM { |
| 327 public: | 327 public: |
| 328 RadialGradientGM() {} | 328 RadialGradientGM() {} |
| 329 | 329 |
| 330 protected: | 330 protected: |
| 331 | 331 |
| 332 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient"); } | 332 SkString onShortName() override { return SkString("radial_gradient"); } |
| 333 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1280, 1280); } | 333 SkISize onISize() override { return SkISize::Make(1280, 1280); } |
| 334 void drawBG(SkCanvas* canvas) { | 334 void drawBG(SkCanvas* canvas) { |
| 335 canvas->drawColor(0xFF000000); | 335 canvas->drawColor(0xFF000000); |
| 336 } | 336 } |
| 337 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 337 void onDraw(SkCanvas* canvas) override { |
| 338 const SkISize dim = this->getISize(); | 338 const SkISize dim = this->getISize(); |
| 339 | 339 |
| 340 this->drawBG(canvas); | 340 this->drawBG(canvas); |
| 341 | 341 |
| 342 SkPaint paint; | 342 SkPaint paint; |
| 343 paint.setDither(true); | 343 paint.setDither(true); |
| 344 SkPoint center; | 344 SkPoint center; |
| 345 center.set(SkIntToScalar(dim.width())/2, SkIntToScalar(dim.height())/2); | 345 center.set(SkIntToScalar(dim.width())/2, SkIntToScalar(dim.height())/2); |
| 346 SkScalar radius = SkIntToScalar(dim.width())/2; | 346 SkScalar radius = SkIntToScalar(dim.width())/2; |
| 347 const SkColor colors[] = { 0x7f7f7f7f, 0x7f7f7f7f, 0xb2000000 }; | 347 const SkColor colors[] = { 0x7f7f7f7f, 0x7f7f7f7f, 0xb2000000 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 362 typedef GM INHERITED; | 362 typedef GM INHERITED; |
| 363 }; | 363 }; |
| 364 | 364 |
| 365 | 365 |
| 366 class RadialGradient2GM : public GM { | 366 class RadialGradient2GM : public GM { |
| 367 public: | 367 public: |
| 368 RadialGradient2GM() {} | 368 RadialGradient2GM() {} |
| 369 | 369 |
| 370 protected: | 370 protected: |
| 371 | 371 |
| 372 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient2"); } | 372 SkString onShortName() override { return SkString("radial_gradient2"); } |
| 373 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 400); } | 373 SkISize onISize() override { return SkISize::Make(800, 400); } |
| 374 void drawBG(SkCanvas* canvas) { | 374 void drawBG(SkCanvas* canvas) { |
| 375 canvas->drawColor(0xFF000000); | 375 canvas->drawColor(0xFF000000); |
| 376 } | 376 } |
| 377 | 377 |
| 378 // Reproduces the example given in bug 7671058. | 378 // Reproduces the example given in bug 7671058. |
| 379 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 379 void onDraw(SkCanvas* canvas) override { |
| 380 SkPaint paint1, paint2, paint3; | 380 SkPaint paint1, paint2, paint3; |
| 381 paint1.setStyle(SkPaint::kFill_Style); | 381 paint1.setStyle(SkPaint::kFill_Style); |
| 382 paint2.setStyle(SkPaint::kFill_Style); | 382 paint2.setStyle(SkPaint::kFill_Style); |
| 383 paint3.setStyle(SkPaint::kFill_Style); | 383 paint3.setStyle(SkPaint::kFill_Style); |
| 384 | 384 |
| 385 const SkColor sweep_colors[] = | 385 const SkColor sweep_colors[] = |
| 386 { 0xFFFF0000, 0xFFFFFF00, 0xFF00FF00, 0xFF00FFFF, 0xFF0000FF, 0xFFFF
00FF, 0xFFFF0000 }; | 386 { 0xFFFF0000, 0xFFFFFF00, 0xFF00FF00, 0xFF00FFFF, 0xFF0000FF, 0xFFFF
00FF, 0xFFFF0000 }; |
| 387 const SkColor colors1[] = { 0xFFFFFFFF, 0x00000000 }; | 387 const SkColor colors1[] = { 0xFFFFFFFF, 0x00000000 }; |
| 388 const SkColor colors2[] = { 0xFF000000, 0x00000000 }; | 388 const SkColor colors2[] = { 0xFF000000, 0x00000000 }; |
| 389 | 389 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } | 443 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } |
| 444 static GMRegistry reg5(MyFactory5); | 444 static GMRegistry reg5(MyFactory5); |
| 445 | 445 |
| 446 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } | 446 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } |
| 447 static GMRegistry reg6(MyFactory6); | 447 static GMRegistry reg6(MyFactory6); |
| 448 | 448 |
| 449 static GM* MyFactory7(void*) { return new RadialGradient2GM; } | 449 static GM* MyFactory7(void*) { return new RadialGradient2GM; } |
| 450 static GMRegistry reg7(MyFactory7); | 450 static GMRegistry reg7(MyFactory7); |
| 451 } | 451 } |
| OLD | NEW |