1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC.
2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h"
4cb93a386Sopenharmony_ci// HASH=4eb2d95c9e9a66f05296e345bb68bd51
5cb93a386Sopenharmony_ciREG_FIDDLE(IPoint_addto_operator, 256, 64, false, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void {
8cb93a386Sopenharmony_ci        for (size_t i = 0; i < count - 1; ++i) {
9cb93a386Sopenharmony_ci            SkPoint p0, p1;
10cb93a386Sopenharmony_ci            p0.iset(pts[i]);
11cb93a386Sopenharmony_ci            p1.iset(pts[i + 1]);
12cb93a386Sopenharmony_ci            canvas->drawLine(p0, p1, paint);
13cb93a386Sopenharmony_ci        }
14cb93a386Sopenharmony_ci    };
15cb93a386Sopenharmony_ci    SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } };
16cb93a386Sopenharmony_ci    SkPaint paint;
17cb93a386Sopenharmony_ci    paint.setAntiAlias(true);
18cb93a386Sopenharmony_ci    paint.setStyle(SkPaint::kStroke_Style);
19cb93a386Sopenharmony_ci    canvas->scale(30, 15);
20cb93a386Sopenharmony_ci    draw_lines(points, SK_ARRAY_COUNT(points), paint);
21cb93a386Sopenharmony_ci    points[1] += {1, 1};
22cb93a386Sopenharmony_ci    points[2] += {-1, -1};
23cb93a386Sopenharmony_ci    paint.setColor(SK_ColorRED);
24cb93a386Sopenharmony_ci    draw_lines(points, SK_ARRAY_COUNT(points), paint);
25cb93a386Sopenharmony_ci}
26cb93a386Sopenharmony_ci}  // END FIDDLE
27