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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 class RadialGradientGM : public GM { | 332 class RadialGradientGM : public GM { |
333 public: | 333 public: |
334 RadialGradientGM() {} | 334 RadialGradientGM() {} |
335 | 335 |
336 protected: | 336 protected: |
337 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 337 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
338 return kSkipTiled_Flag; | 338 return kSkipTiled_Flag; |
339 } | 339 } |
340 | 340 |
341 SkString onShortName() { return SkString("radial_gradient"); } | 341 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient"); } |
342 virtual SkISize onISize() { return SkISize::Make(1280, 1280); } | 342 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(1280, 1280); } |
343 void drawBG(SkCanvas* canvas) { | 343 void drawBG(SkCanvas* canvas) { |
344 canvas->drawColor(0xFF000000); | 344 canvas->drawColor(0xFF000000); |
345 } | 345 } |
346 virtual void onDraw(SkCanvas* canvas) { | 346 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
347 const SkISize dim = this->getISize(); | 347 const SkISize dim = this->getISize(); |
348 | 348 |
349 this->drawBG(canvas); | 349 this->drawBG(canvas); |
350 | 350 |
351 SkPaint paint; | 351 SkPaint paint; |
352 paint.setDither(true); | 352 paint.setDither(true); |
353 SkPoint center; | 353 SkPoint center; |
354 center.set(SkIntToScalar(dim.width())/2, SkIntToScalar(dim.height())/2); | 354 center.set(SkIntToScalar(dim.width())/2, SkIntToScalar(dim.height())/2); |
355 SkScalar radius = SkIntToScalar(dim.width())/2; | 355 SkScalar radius = SkIntToScalar(dim.width())/2; |
356 const SkColor colors[] = { 0x7f7f7f7f, 0x7f7f7f7f, 0xb2000000 }; | 356 const SkColor colors[] = { 0x7f7f7f7f, 0x7f7f7f7f, 0xb2000000 }; |
(...skipping 17 matching lines...) Expand all Loading... |
374 | 374 |
375 class RadialGradient2GM : public GM { | 375 class RadialGradient2GM : public GM { |
376 public: | 376 public: |
377 RadialGradient2GM() {} | 377 RadialGradient2GM() {} |
378 | 378 |
379 protected: | 379 protected: |
380 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 380 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
381 return kSkipTiled_Flag; | 381 return kSkipTiled_Flag; |
382 } | 382 } |
383 | 383 |
384 SkString onShortName() { return SkString("radial_gradient2"); } | 384 SkString onShortName() SK_OVERRIDE { return SkString("radial_gradient2"); } |
385 virtual SkISize onISize() { return SkISize::Make(800, 400); } | 385 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 400); } |
386 void drawBG(SkCanvas* canvas) { | 386 void drawBG(SkCanvas* canvas) { |
387 canvas->drawColor(0xFF000000); | 387 canvas->drawColor(0xFF000000); |
388 } | 388 } |
389 | 389 |
390 // Reproduces the example given in bug 7671058. | 390 // Reproduces the example given in bug 7671058. |
391 virtual void onDraw(SkCanvas* canvas) { | 391 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
392 SkPaint paint1, paint2, paint3; | 392 SkPaint paint1, paint2, paint3; |
393 paint1.setStyle(SkPaint::kFill_Style); | 393 paint1.setStyle(SkPaint::kFill_Style); |
394 paint2.setStyle(SkPaint::kFill_Style); | 394 paint2.setStyle(SkPaint::kFill_Style); |
395 paint3.setStyle(SkPaint::kFill_Style); | 395 paint3.setStyle(SkPaint::kFill_Style); |
396 | 396 |
397 const SkColor sweep_colors[] = | 397 const SkColor sweep_colors[] = |
398 { 0xFFFF0000, 0xFFFFFF00, 0xFF00FF00, 0xFF00FFFF, 0xFF0000FF, 0xFFFF
00FF, 0xFFFF0000 }; | 398 { 0xFFFF0000, 0xFFFFFF00, 0xFF00FF00, 0xFF00FFFF, 0xFF0000FF, 0xFFFF
00FF, 0xFFFF0000 }; |
399 const SkColor colors1[] = { 0xFFFFFFFF, 0x00000000 }; | 399 const SkColor colors1[] = { 0xFFFFFFFF, 0x00000000 }; |
400 const SkColor colors2[] = { 0xFF000000, 0x00000000 }; | 400 const SkColor colors2[] = { 0xFF000000, 0x00000000 }; |
401 | 401 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 454 |
455 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } | 455 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } |
456 static GMRegistry reg5(MyFactory5); | 456 static GMRegistry reg5(MyFactory5); |
457 | 457 |
458 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } | 458 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } |
459 static GMRegistry reg6(MyFactory6); | 459 static GMRegistry reg6(MyFactory6); |
460 | 460 |
461 static GM* MyFactory7(void*) { return new RadialGradient2GM; } | 461 static GM* MyFactory7(void*) { return new RadialGradient2GM; } |
462 static GMRegistry reg7(MyFactory7); | 462 static GMRegistry reg7(MyFactory7); |
463 } | 463 } |
OLD | NEW |