OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SampleCode.h" | 7 #include "SampleCode.h" |
8 #include "SkView.h" | 8 #include "SkView.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 canvas->drawPath(path, p); | 218 canvas->drawPath(path, p); |
219 canvas->restore(); | 219 canvas->restore(); |
220 | 220 |
221 p.setStyle(SkPaint::kStroke_Style); | 221 p.setStyle(SkPaint::kStroke_Style); |
222 p.setStrokeWidth(6); | 222 p.setStrokeWidth(6); |
223 | 223 |
224 // Draw each of the "Edges" that survived the clipping | 224 // Draw each of the "Edges" that survived the clipping |
225 // We use a layer, so we can PLUS the different edge-colors, showing whe
re two edges | 225 // We use a layer, so we can PLUS the different edge-colors, showing whe
re two edges |
226 // canceled each other out. | 226 // canceled each other out. |
227 canvas->saveLayer(nullptr, nullptr); | 227 canvas->saveLayer(nullptr, nullptr); |
228 p.setXfermodeMode(SkXfermode::kPlus_Mode); | 228 p.setBlendMode(SkBlendMode::kPlus); |
229 for (int i = 0; i < N; ++i) { | 229 for (int i = 0; i < N; ++i) { |
230 const int j = (i + 1) % N; | 230 const int j = (i + 1) % N; |
231 p.setColor(fEdgeColor[i]); | 231 p.setColor(fEdgeColor[i]); |
232 draw_clipped_line(canvas, fClip, fPoly[i], fPoly[j], p); | 232 draw_clipped_line(canvas, fClip, fPoly[i], fPoly[j], p); |
233 } | 233 } |
234 canvas->restore(); | 234 canvas->restore(); |
235 } | 235 } |
236 | 236 |
237 class MyClick : public Click { | 237 class MyClick : public Click { |
238 public: | 238 public: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 bool onClick(Click* click) override { | 309 bool onClick(Click* click) override { |
310 ((MyClick*)click)->handleMove(); | 310 ((MyClick*)click)->handleMove(); |
311 this->inval(nullptr); | 311 this->inval(nullptr); |
312 return false; | 312 return false; |
313 } | 313 } |
314 | 314 |
315 private: | 315 private: |
316 typedef SampleView INHERITED; | 316 typedef SampleView INHERITED; |
317 }; | 317 }; |
318 DEF_SAMPLE( return new EdgeClipView; ) | 318 DEF_SAMPLE( return new EdgeClipView; ) |
OLD | NEW |