Flutter Engine
The Flutter Engine
Functions | Variables
daa.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFont.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPathBuilder.h"
#include "include/core/SkPoint.h"
#include "include/core/SkTypes.h"
#include "tools/fonts/FontToolUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (daa, canvas, K+350, 5 *K)
 

Variables

static const int K = 49
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( daa  ,
canvas  ,
K 350,
5 *  K 
)

Definition at line 23 of file daa.cpp.

23 {
25 paint.setAntiAlias(true);
27
28 {
29 paint.setColor(SK_ColorBLACK);
30 canvas->drawString("Should be a green square with no red showing through.",
31 K*1.5f, K*0.5f, font, paint);
32
33 paint.setColor(SK_ColorRED);
34 canvas->drawRect({0,0,K,K}, paint);
35
36 SkPoint tri1[] = {{0,0},{K,K},{0,K},{0,0}};
37 SkPoint tri2[] = {{0,0},{K,K},{K,0},{0,0}};
38 SkPath path = SkPathBuilder().addPolygon(tri1, std::size(tri1), false)
39 .addPolygon(tri2, std::size(tri2), false)
40 .detach();
41
42 paint.setColor(SK_ColorGREEN);
43 canvas->drawPath(path, paint);
44 }
45
46 canvas->translate(0,K);
47 {
48 paint.setColor(SK_ColorBLACK);
49 canvas->drawString("Adjacent rects, two draws. Blue then green, no red?",
50 K*1.5f, K*0.5f, font, paint);
51
52 paint.setColor(SK_ColorRED);
53 canvas->drawRect({0,0,K,K}, paint);
54
55 {
56 SkPath path = SkPath::Polygon({{0,0},{0,K},{K*0.5f,K},{K*0.5f,0}}, false);
57 paint.setColor(SK_ColorBLUE);
58 canvas->drawPath(path, paint);
59 }
60
61 {
62 SkPath path = SkPath::Polygon({{K*0.5f,0},{K*0.5f,K},{K,K},{K,0}}, false);
63 paint.setColor(SK_ColorGREEN);
64 canvas->drawPath(path, paint);
65 }
66 }
67
68 canvas->translate(0,K);
69 {
70 paint.setColor(SK_ColorBLACK);
71 canvas->drawString("Adjacent rects, wound together. All green?",
72 K*1.5f, K*0.5f, font, paint);
73
74 paint.setColor(SK_ColorRED);
75 canvas->drawRect({0,0,K,K}, paint);
76
77 {
78 SkPath path = SkPathBuilder().addPolygon({{0,0},{0,K},{K*0.5f,K},{K*0.5f,0}}, false)
79 .addPolygon({{K*0.5f,0},{K*0.5f,K},{K,K},{K,0}}, false)
80 .detach();
81
82 paint.setColor(SK_ColorGREEN);
83 canvas->drawPath(path, paint);
84 }
85 }
86
87 canvas->translate(0,K);
88 {
89 paint.setColor(SK_ColorBLACK);
90 canvas->drawString("Adjacent rects, wound opposite. All green?",
91 K*1.5f, K*0.5f, font, paint);
92
93 paint.setColor(SK_ColorRED);
94 canvas->drawRect({0,0,K,K}, paint);
95
96 {
97 SkPath path = SkPathBuilder().addPolygon({{0,0},{0,K},{K*0.5f,K},{K*0.5f,0}}, false)
98 .addPolygon({{K*0.5f,0},{K,0},{K,K},{K*0.5f,K}}, false)
99 .detach();
100
101 paint.setColor(SK_ColorGREEN);
102 canvas->drawPath(path, paint);
103 }
104 }
105
106 canvas->translate(0,K);
107 {
108 paint.setColor(SK_ColorBLACK);
109 canvas->drawString("One poly, wound opposite. All green?",
110 K*1.5f, K*0.5f, font, paint);
111
112 paint.setColor(SK_ColorRED);
113 canvas->drawRect({0,0,K,K}, paint);
114
115 SkPath path = SkPath::Polygon({{K*0.5f,0},{0,0},{0,K},{K*0.5f,K},
116 {K*0.5f,0},{K,0},{K,K},{K*0.5f,K}},
117 false);
118
119 paint.setColor(SK_ColorGREEN);
120 canvas->drawPath(path, paint);
121 }
122}
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
Definition: SkFont.h:35
SkPathBuilder & addPolygon(const SkPoint pts[], int count, bool isClosed)
Definition: SkPath.h:59
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition: SkPath.cpp:3614
const Paint & paint
Definition: color_source.cc:38
static const int K
Definition: daa.cpp:21
SkFont DefaultPortableFont()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
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
font
Font Metadata and Metrics.

Variable Documentation

◆ K

const int K = 49
static

Definition at line 21 of file daa.cpp.