26#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
28 float angleStep = 360.0f / n, angle = 0.0f;
30 angle = angleStep/2.0f;
34 angleStep = -angleStep;
37 for (
int i = 0;
i < n; ++
i) {
116 { -47.55f, -15.45f },
117 { -40.45f, -29.39f },
118 { -29.39f, -40.45f },
119 { -15.45f, -47.55f },
133 { -72.55f, -15.45f },
134 { -65.45f, -29.39f },
135 { -54.39f, -40.45f },
136 { -40.45f, -47.55f },
158 { 19.6157f, 25.f + 3.9018f },
159 { 18.4776f, 25.f + 7.6537f },
160 { 16.6294f, 25.f + 11.1114f },
161 { 14.1421f, 25.f + 14.1421f },
162 { 11.1114f, 25.f + 16.6294f },
163 { 7.6537f, 25.f + 18.4776f },
164 { 3.9018f, 25.f + 19.6157f },
166 { -3.9018f, 25.f + 19.6157f },
167 { -7.6537f, 25.f + 18.4776f },
168 { -11.1114f, 25.f + 16.6294f },
169 { -14.1421f, 25.f + 14.1421f },
170 { -16.6294f, 25.f + 11.1114f },
171 { -18.4776f, 25.f + 7.6537f },
172 { -19.6157f, 25.f + 3.9018f },
200 { 19.6157f,
kBottom - 3.9018f },
201 { 18.4776f,
kBottom - 7.6537f },
202 { 16.6294f,
kBottom - 11.1114f },
203 { 14.1421f,
kBottom - 14.1421f },
204 { 11.1114f,
kBottom - 16.6294f },
205 { 7.6537f,
kBottom - 18.4776f },
206 { 3.9018f,
kBottom - 19.6157f },
208 { -3.9018f,
kBottom - 19.6157f },
209 { -7.6537f,
kBottom - 18.4776f },
210 { -11.1114f,
kBottom - 16.6294f },
211 { -14.1421f,
kBottom - 14.1421f },
212 { -16.6294f,
kBottom - 11.1114f },
213 { -18.4776f,
kBottom - 7.6537f },
214 { -19.6157f,
kBottom - 3.9018f },
288 { -15 + 6.5f, -11.5f },
289 { -15 + 10.6f, -14 },
290 { -15 + 14, -15.2f },
291 { -15 + 17, -15.5f },
292 { -15 + 20, -15.2f },
293 { -15 + 23.4f, -14 },
294 { -15 + 27.5f, -11.5f },
300 { -15 + 27.5f, 11.5f },
306 { -15 + 6.5f, 11.5f },
427 : fConvexOnly(convexOnly) {
434 return SkString(
"convex-polygon-inset");
436 return SkString(
"simple-polygon-offset");
447 *
data = std::make_unique<SkPoint[]>(*numPts);
449 for (
int i = 0;
i < *numPts; ++
i) {
453 for (
int i = 0;
i < *numPts; ++
i) {
461 int numPtsArray[] = { 3, 4, 5, 5, 6, 8, 8, 20, 100 };
465 *numPts = numPtsArray[arrayIndex];
466 if (arrayIndex == 3 || arrayIndex == 6) {
468 width = kMaxPathHeight / 5;
471 *
data = std::make_unique<SkPoint[]>(*numPts);
482 *
data = std::make_unique<SkPoint[]>(*numPts);
484 for (
int i = 0;
i < *numPts; ++
i) {
488 for (
int i = 0;
i < *numPts; ++
i) {
496 int numPtsArray[] = { 5, 7, 8, 20, 100 };
501 *numPts = numPtsArray[arrayIndex];
503 width = kMaxPathHeight / 5;
505 *
data = std::make_unique<SkPoint[]>(*numPts);
515 std::unique_ptr<SkPoint[]>
data(
nullptr);
525 bounds.outset(kMaxOutset, kMaxOutset);
527 if (position->
fX +
bounds.width() > kGMWidth) {
529 position->
fY += kMaxPathHeight;
536 const float insets[] = { 5, 10, 15, 20, 25, 30, 35, 40 };
537 const float offsets[] = { 2, 5, 9, 14, 20, 27, 35, 44, -2, -5, -9 };
538 const SkColor colors[] = { 0xFF901313, 0xFF8D6214, 0xFF698B14, 0xFF1C8914,
539 0xFF148755, 0xFF146C84, 0xFF142482, 0xFF4A1480,
540 0xFF901313, 0xFF8D6214, 0xFF698B14 };
543 paint.setAntiAlias(
true);
545 paint.setStrokeWidth(1);
547 std::unique_ptr<SkPoint[]>
data(
nullptr);
558 for (
int i = 1;
i < numPts; ++
i) {
570 for (
size_t i = 0;
i <
count; ++
i) {
584 path.moveTo(offsetPoly[0]);
585 for (
int j = 1; j < offsetPoly.
size(); ++j) {
586 path.lineTo(offsetPoly[j]);
606 for (
int i = 0;
i < kNumPaths; ++
i) {
612 inline static constexpr int kNumPaths = 20;
613 inline static constexpr int kMaxPathHeight = 100;
614 inline static constexpr int kMaxOutset = 16;
615 inline static constexpr int kGMWidth = 512;
616 inline static constexpr int kGMHeight = 512;
620 using INHERITED =
GM;
625DEF_GM(
return new PolygonOffsetGM(
true);)
626DEF_GM(
return new PolygonOffsetGM(
false);)
bool SkOffsetSimplePolygon(const SkPoint *inputPolygonVerts, int inputPolygonSize, const SkRect &bounds, SkScalar offset, SkTDArray< SkPoint > *offsetPolygon, SkTDArray< int > *polygonIndices)
bool SkInsetConvexPolygon(const SkPoint *inputPolygonVerts, int inputPolygonSize, SkScalar inset, SkTDArray< SkPoint > *insetPolygon)
#define SkDegreesToRadians(degrees)
#define SkScalarSin(radians)
#define SkScalarCos(radians)
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, const SkPaint &paint)
@ kStroke_Style
set to stroke geometry
GM(SkColor backgroundColor=SK_ColorWHITE)
void onDraw(SkCanvas *canvas) override
static void GetConvexPolygon(int index, SkPathDirection dir, std::unique_ptr< SkPoint[]> *data, int *numPts)
SkString getName() const override
SkISize getISize() override
void drawPolygon(SkCanvas *canvas, int index, SkPoint *position)
bool runAsBench() const override
static void GetSimplePolygon(int index, SkPathDirection dir, std::unique_ptr< SkPoint[]> *data, int *numPts)
PolygonOffsetGM(bool convexOnly)
Dart_NativeFunction function
static float min(float r, float g, float b)
const size_t gConvexSizes[]
const SkPoint gPoints14[]
const SkPoint gPoints12[]
const SkPoint gPoints16[]
const SkPoint gPoints10[]
const SkPoint * gSimplePoints[]
const SkPoint gPoints13[]
const SkPoint gPoints15[]
const size_t gSimpleSizes[]
const SkPoint * gConvexPoints[]
const SkPoint gPoints18[]
const SkPoint gPoints17[]
const SkPoint gPoints11[]
Optional< SkRect > bounds
PODArray< SkColor > colors
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
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
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
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
static void create_ngon(int n, SkPoint *pts, SkScalar w, SkScalar h, SkPathDirection dir)
static constexpr SkISize Make(int32_t w, int32_t h)
std::shared_ptr< const fml::Mapping > data