| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
| 10 #include "SkDrawable.h" | 10 #include "SkDrawable.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class CircDrawable : public ModeDrawable { | 123 class CircDrawable : public ModeDrawable { |
| 124 SkPaint fPaint; | 124 SkPaint fPaint; |
| 125 SkRect fBounds; | 125 SkRect fBounds; |
| 126 | 126 |
| 127 public: | 127 public: |
| 128 CircDrawable(SkScalar size, SkColor c) { | 128 CircDrawable(SkScalar size, SkColor c) { |
| 129 const SkColor colors[] = { 0, c }; | 129 const SkColor colors[] = { 0, c }; |
| 130 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(SkPoint::Ma
ke(size/2, size/2), size/2, | 130 fPaint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(size/2, size
/2), size/2, |
| 131 colors, nul
lptr, 2, | 131 colors, nul
lptr, 2, |
| 132 SkShader::k
Clamp_TileMode)); | 132 SkShader::k
Clamp_TileMode)); |
| 133 fPaint.setShader(shader); | |
| 134 fBounds = SkRect::MakeWH(size, size); | 133 fBounds = SkRect::MakeWH(size, size); |
| 135 } | 134 } |
| 136 | 135 |
| 137 protected: | 136 protected: |
| 138 SkRect onGetBounds() override { | 137 SkRect onGetBounds() override { |
| 139 return fBounds; | 138 return fBounds; |
| 140 } | 139 } |
| 141 | 140 |
| 142 void onDraw(SkCanvas* canvas) override { | 141 void onDraw(SkCanvas* canvas) override { |
| 143 fPaint.setXfermodeMode(fMode); | 142 fPaint.setXfermodeMode(fMode); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 return true; | 242 return true; |
| 244 } | 243 } |
| 245 | 244 |
| 246 private: | 245 private: |
| 247 typedef SampleView INHERITED; | 246 typedef SampleView INHERITED; |
| 248 }; | 247 }; |
| 249 | 248 |
| 250 ////////////////////////////////////////////////////////////////////////////// | 249 ////////////////////////////////////////////////////////////////////////////// |
| 251 | 250 |
| 252 DEF_SAMPLE( return new XferDemo; ) | 251 DEF_SAMPLE( return new XferDemo; ) |
| OLD | NEW |