Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
mac_aa_explorer.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/SkFontStyle.h"
#include "include/core/SkFontTypes.h"
#include "include/core/SkPaint.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
#include "tools/fonts/FontToolUtils.h"
#include <string.h>
#include <initializer_list>

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (macaa_colors, canvas, 800, 500)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( macaa_colors  ,
canvas  ,
800  ,
500   
)

Definition at line 136 of file mac_aa_explorer.cpp.

136 {
137 const SkColor GRAY = 0xFF808080;
138 const SkColor colors[] = {
140 SK_ColorBLACK, GRAY,
142 SK_ColorWHITE, GRAY,
143 };
144 const SkScalar sizes[] = {10, 12, 15, 18, 24};
145
146 const SkScalar width = 200;
147 const SkScalar height = 500;
148 const char str[] = "Hamburgefons";
149 const size_t len = strlen(str);
150
152 if (!face) {
154 }
155 SkFont font(face, 12);
156
157 for (size_t i = 0; i < std::size(colors); i += 2) {
158 canvas->save();
159
161 paint.setColor(colors[i+1]);
162 canvas->drawRect({0, 0, width, height}, paint);
163 paint.setColor(colors[i]);
164
165 SkScalar y = 10;
166 SkScalar x = 10;
167 for (SkScalar ps : sizes) {
168 font.setSize(ps);
169 for (bool lcd : {false, true}) {
173 font.setHinting(h);
174
175 y += font.getSpacing() + 2;
176 canvas->drawSimpleText(str, len, SkTextEncoding::kUTF8, x, y, font, paint);
177 }
178 }
179 y += 8;
180 }
181 canvas->restore();
182 canvas->translate(width, 0);
183 }
184}
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
@ kNormal
glyph outlines modified to improve constrast
@ kNone
glyph outlines unchanged
@ kUTF8
uses bytes to represent UTF-8 or ASCII
Definition: SkFont.h:35
@ kAntiAlias
may have transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
double y
double x
PODArray< SkColor > colors
Definition: SkRecords.h:276
sk_sp< SkTypeface > DefaultPortableTypeface()
sk_sp< SkTypeface > CreateTestTypeface(const char *name, SkFontStyle style)
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.
SkScalar h
int32_t height
int32_t width