| 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 "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
| 12 | 12 |
| 13 static SkShader* make_grad(SkScalar w, SkScalar h) { | 13 static SkShader* make_grad(SkScalar w, SkScalar h) { |
| 14 SkColor colors[] = { 0xFF000000, 0xFF333333 }; | 14 SkColor colors[] = { 0xFF000000, 0xFF333333 }; |
| 15 SkPoint pts[] = { { 0, 0 }, { w, h } }; | 15 SkPoint pts[] = { { 0, 0 }, { w, h } }; |
| 16 return SkGradientShader::CreateLinear(pts, colors, NULL, 2, | 16 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, |
| 17 SkShader::kClamp_TileMode); | 17 SkShader::kClamp_TileMode); |
| 18 } | 18 } |
| 19 | 19 |
| 20 class BigGradientView : public SampleView { | 20 class BigGradientView : public SampleView { |
| 21 public: | 21 public: |
| 22 BigGradientView() {} | 22 BigGradientView() {} |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 // overrides from SkEventSink | 25 // overrides from SkEventSink |
| 26 virtual bool onQuery(SkEvent* evt) { | 26 virtual bool onQuery(SkEvent* evt) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 typedef SampleView INHERITED; | 43 typedef SampleView INHERITED; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 /////////////////////////////////////////////////////////////////////////////// | 46 /////////////////////////////////////////////////////////////////////////////// |
| 47 | 47 |
| 48 static SkView* MyFactory() { return new BigGradientView; } | 48 static SkView* MyFactory() { return new BigGradientView; } |
| 49 static SkViewRegister reg(MyFactory); | 49 static SkViewRegister reg(MyFactory); |
| OLD | NEW |