| 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 #include "gm.h" | 7 #include "gm.h" | 
| 8 #include "SkGradientShader.h" | 8 #include "SkGradientShader.h" | 
| 9 | 9 | 
| 10 using namespace skiagm; | 10 using namespace skiagm; | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 79 /////////////////////////////////////////////////////////////////////////////// | 79 /////////////////////////////////////////////////////////////////////////////// | 
| 80 | 80 | 
| 81 class GradientsNoTextureGM : public GM { | 81 class GradientsNoTextureGM : public GM { | 
| 82 public: | 82 public: | 
| 83     GradientsNoTextureGM() { | 83     GradientsNoTextureGM() { | 
| 84         this->setBGColor(0xFFDDDDDD); | 84         this->setBGColor(0xFFDDDDDD); | 
| 85     } | 85     } | 
| 86 | 86 | 
| 87 protected: | 87 protected: | 
| 88 | 88 | 
| 89     SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture")
     ; } | 89     SkString onShortName() override { return SkString("gradients_no_texture"); } | 
| 90     SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 615); } | 90     SkISize onISize() override { return SkISize::Make(640, 615); } | 
| 91 | 91 | 
| 92     void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 92     void onDraw(SkCanvas* canvas) override { | 
| 93         static const SkPoint kPts[2] = { { 0, 0 }, | 93         static const SkPoint kPts[2] = { { 0, 0 }, | 
| 94                                          { SkIntToScalar(50), SkIntToScalar(50) 
     } }; | 94                                          { SkIntToScalar(50), SkIntToScalar(50) 
     } }; | 
| 95         static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; | 95         static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; | 
| 96         SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; | 96         SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; | 
| 97         SkPaint paint; | 97         SkPaint paint; | 
| 98         paint.setAntiAlias(true); | 98         paint.setAntiAlias(true); | 
| 99 | 99 | 
| 100         canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); | 100         canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); | 
| 101         static const uint8_t kAlphas[] = { 0xff, 0x40 }; | 101         static const uint8_t kAlphas[] = { 0xff, 0x40 }; | 
| 102         for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphas); ++a) { | 102         for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphas); ++a) { | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 202         W = 800, | 202         W = 800, | 
| 203     }; | 203     }; | 
| 204     SkAutoTUnref<SkShader> fShader; | 204     SkAutoTUnref<SkShader> fShader; | 
| 205 | 205 | 
| 206     typedef void (*Proc)(ColorPos*); | 206     typedef void (*Proc)(ColorPos*); | 
| 207 public: | 207 public: | 
| 208     GradientsManyColorsGM() {} | 208     GradientsManyColorsGM() {} | 
| 209 | 209 | 
| 210 protected: | 210 protected: | 
| 211 | 211 | 
| 212     SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); } | 212     SkString onShortName() override { return SkString("gradients_many"); } | 
| 213     SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); } | 213     SkISize onISize() override { return SkISize::Make(850, 100); } | 
| 214 | 214 | 
| 215     void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 215     void onDraw(SkCanvas* canvas) override { | 
| 216         const Proc procs[] = { | 216         const Proc procs[] = { | 
| 217             make0, make1, make2, | 217             make0, make1, make2, | 
| 218         }; | 218         }; | 
| 219         const SkPoint pts[] = { | 219         const SkPoint pts[] = { | 
| 220             { 0, 0 }, | 220             { 0, 0 }, | 
| 221             { SkIntToScalar(W), 0 }, | 221             { SkIntToScalar(W), 0 }, | 
| 222         }; | 222         }; | 
| 223         const SkRect r = SkRect::MakeWH(SkIntToScalar(W), 30); | 223         const SkRect r = SkRect::MakeWH(SkIntToScalar(W), 30); | 
| 224 | 224 | 
| 225         SkPaint paint; | 225         SkPaint paint; | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 243     } | 243     } | 
| 244 | 244 | 
| 245 private: | 245 private: | 
| 246     typedef GM INHERITED; | 246     typedef GM INHERITED; | 
| 247 }; | 247 }; | 
| 248 | 248 | 
| 249 /////////////////////////////////////////////////////////////////////////////// | 249 /////////////////////////////////////////////////////////////////////////////// | 
| 250 | 250 | 
| 251 DEF_GM( return SkNEW(GradientsNoTextureGM)); | 251 DEF_GM( return SkNEW(GradientsNoTextureGM)); | 
| 252 DEF_GM( return SkNEW(GradientsManyColorsGM)); | 252 DEF_GM( return SkNEW(GradientsManyColorsGM)); | 
| OLD | NEW | 
|---|