Flutter Engine
The Flutter Engine
IPoint_add_operator.cpp
Go to the documentation of this file.
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.
4REG_FIDDLE(IPoint_add_operator, 256, 128, false, 0) {
5void draw(SkCanvas* canvas) {
6 auto draw_lines = [=](const SkIPoint pts[], size_t count, SkPaint& paint) -> void {
7 for (size_t i = 0; i < count - 1; ++i) {
8 SkPoint p0, p1;
9 p0.iset(pts[i]);
10 p1.iset(pts[i + 1]);
11 canvas->drawLine(p0, p1, paint);
12 }
13 };
14 SkIPoint points[] = { { 3, 1 }, { 4, 2 }, { 5, 1 }, { 7, 3 } };
16 paint.setAntiAlias(true);
18 canvas->scale(30, 15);
19 draw_lines(points, std::size(points), paint);
20 SkIPoint mod = {4, 1};
21 for (auto& point : points) {
22 point = point + mod;
23 mod.fX -= 1;
24 mod.fY += 1;
25 }
26 paint.setColor(SK_ColorRED);
27 draw_lines(points, std::size(points), paint);
28}
29} // END FIDDLE
int count
Definition: FontMgrTest.cpp:50
static const int points[]
REG_FIDDLE(IPoint_add_operator, 256, 128, false, 0)
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
int32_t fX
x-axis value
Definition: SkPoint_impl.h:29
void iset(int32_t x, int32_t y)
Definition: SkPoint_impl.h:214