| 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 "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
| 12 #include "SkRandom.h" | 12 #include "SkRandom.h" |
| 13 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
| 14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 15 | 15 |
| 16 static SkShader* make_linear() { | 16 static SkShader* make_linear() { |
| 17 SkPoint pts[] = { 0, 0, SK_Scalar1/500, SK_Scalar1/500 }; | 17 SkPoint pts[] = { 0, 0, SK_Scalar1/500, SK_Scalar1/500 }; |
| 18 SkColor colors[] = { SK_ColorRED, SK_ColorBLUE }; | 18 SkColor colors[] = { SK_ColorRED, SK_ColorBLUE }; |
| 19 return SkGradientShader::CreateLinear(pts, colors, NULL, 2, | 19 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, |
| 20 SkShader::kClamp_TileMode); | 20 SkShader::kClamp_TileMode); |
| 21 } | 21 } |
| 22 | 22 |
| 23 class ClampView : public SampleView { | 23 class ClampView : public SampleView { |
| 24 SkShader* fGrad; | 24 SkShader* fGrad; |
| 25 | 25 |
| 26 public: | 26 public: |
| 27 ClampView() { | 27 ClampView() { |
| 28 fGrad = make_linear(); | 28 fGrad = make_linear(); |
| 29 } | 29 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 typedef SampleView INHERITED; | 61 typedef SampleView INHERITED; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 ////////////////////////////////////////////////////////////////////////////// | 64 ////////////////////////////////////////////////////////////////////////////// |
| 65 | 65 |
| 66 static SkView* MyFactory() { return new ClampView; } | 66 static SkView* MyFactory() { return new ClampView; } |
| 67 static SkViewRegister reg(MyFactory); | 67 static SkViewRegister reg(MyFactory); |
| OLD | NEW |