| 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 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 colors, NULL, count); | 35 colors, NULL, count); |
| 36 } | 36 } |
| 37 | 37 |
| 38 class ShallowGradientGM : public skiagm::GM { | 38 class ShallowGradientGM : public skiagm::GM { |
| 39 public: | 39 public: |
| 40 ShallowGradientGM(MakeShaderProc proc, const char name[]) : fProc(proc) { | 40 ShallowGradientGM(MakeShaderProc proc, const char name[]) : fProc(proc) { |
| 41 fName.printf("shallow_gradient_%s", name); | 41 fName.printf("shallow_gradient_%s", name); |
| 42 } | 42 } |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 46 if (fName.contains("linear") || fName.contains("radial")) { |
| 47 return kSkipTiled_Flag; |
| 48 } |
| 49 return 0; |
| 50 } |
| 51 |
| 45 virtual SkString onShortName() SK_OVERRIDE { | 52 virtual SkString onShortName() SK_OVERRIDE { |
| 46 return fName; | 53 return fName; |
| 47 } | 54 } |
| 48 | 55 |
| 49 virtual SkISize onISize() SK_OVERRIDE { | 56 virtual SkISize onISize() SK_OVERRIDE { |
| 50 return SkISize::Make(800, 800); | 57 return SkISize::Make(800, 800); |
| 51 } | 58 } |
| 52 | 59 |
| 53 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 60 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 54 const SkColor colors[] = { 0xFF555555, 0xFF444444 }; | 61 const SkColor colors[] = { 0xFF555555, 0xFF444444 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 68 | 75 |
| 69 typedef skiagm::GM INHERITED; | 76 typedef skiagm::GM INHERITED; |
| 70 }; | 77 }; |
| 71 | 78 |
| 72 /////////////////////////////////////////////////////////////////////////////// | 79 /////////////////////////////////////////////////////////////////////////////// |
| 73 | 80 |
| 74 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); ) | 81 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); ) |
| 75 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); ) | 82 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); ) |
| 76 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); ) | 83 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); ) |
| 77 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); ) | 84 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); ) |
| OLD | NEW |