• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(Path_rLineTo, 256, 128, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6     SkPaint paint;
7     paint.setAntiAlias(true);
8     paint.setStyle(SkPaint::kStroke_Style);
9     SkPath path;
10     path.moveTo(10, 98);
11     SkScalar x = 0, y = 0;
12     for (int i = 10; i < 100; i += 5) {
13         x += i * ((i & 2) - 1);
14         y += i * (((i + 1) & 2) - 1);
15         path.rLineTo(x, y);
16     }
17     canvas->drawPath(path, paint);
18 }
19 }  // END FIDDLE
20