32#define FLAGS00 Flags(0)
33#define FLAGS01 Flags(kStroke_Flag)
34#define FLAGS10 Flags(kBig_Flag)
35#define FLAGS11 Flags(kStroke_Flag | kBig_Flag)
55 fName.printf(
"path_%s_%s_",
73 for (
int i = 0;
i < loops;
i++) {
87 name->append(
"triangle");
90 static const int gCoord[] = {
107 name->append(
"rect");
110 SkRect r = { 10, 10, 20, 20 };
126 suffix.printf(
"rotated_rect_%s_%d", fAA ?
"aa" :
"noaa", fDegrees);
131 SkRect r = { 10, 10, 20, 20 };
135 path->transform(rotateMatrix);
140 paint->setAntiAlias(fAA);
153 name->append(
"oval");
156 SkRect r = { 10, 10, 23, 20 };
168 name->append(
"circle");
183 name->append(
"nonaacircle");
188 paint->setAntiAlias(
false);
201 name->append(
"concave_aaa");
205 path->moveTo(10, 10);
206 path->lineTo(15, 10);
208 path->lineTo(40, 40);
222 name->append(
"convex_aaa");
226 path->moveTo(10, 10);
227 path->lineTo(15, 10);
228 path->lineTo(40, 50);
241 name->append(
"sawtooth");
251 for (
int i = 0;
i < 32;
i++) {
257 path->lineTo(
x,
y + 2 * dy);
258 path->lineTo(x0,
y + 2 * dy);
271 name->append(
"long_curved");
276 for (
i = 0;
i < 100;
i++) {
292 name->append(
"long_line");
297 for (
size_t i = 1;
i < 100;
i++) {
315 bool allowMoves =
true,
322 fVerbCnts.
reset(kNumVerbCnts);
323 for (
int i = 0;
i < kNumVerbCnts; ++
i) {
324 fVerbCnts[
i] = fRandom.
nextRangeU(minVerbs, maxVerbs + 1);
326 fVerbs.
reset(kNumVerbs);
327 for (
int i = 0;
i < kNumVerbs; ++
i) {
332 fPoints.
reset(kNumPoints);
333 for (
int i = 0;
i < kNumPoints; ++
i) {
347 int vCount = fVerbCnts[(fCurrPath++) & (kNumVerbCnts - 1)];
348 for (
int v = 0; v < vCount; ++v) {
349 int verb = fVerbs[(fCurrVerb++) & (kNumVerbs - 1)];
352 path->moveTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
355 path->lineTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
358 path->quadTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
359 fPoints[(fCurrPoint + 1) & (kNumPoints - 1)]);
363 path->conicTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
364 fPoints[(fCurrPoint + 1) & (kNumPoints - 1)],
369 path->cubicTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
370 fPoints[(fCurrPoint + 1) & (kNumPoints - 1)],
371 fPoints[(fCurrPoint + 2) & (kNumPoints - 1)]);
393 kNumVerbCnts = 1 << 5,
414 return "path_create";
422 for (
int i = 0;
i < loops; ++
i) {
448 fPaths.
reset(kPathCnt);
449 fCopies.
reset(kPathCnt);
450 for (
int i = 0;
i < kPathCnt; ++
i) {
456 for (
int i = 0;
i < loops; ++
i) {
457 int idx =
i & (kPathCnt - 1);
458 fCopies[idx] = fPaths[idx];
479 return fInPlace ?
"path_transform_in_place" :
"path_transform_copy";
485 fPaths.
reset(kPathCnt);
486 for (
int i = 0;
i < kPathCnt; ++
i) {
491 fTransformed.
reset(kPathCnt);
497 for (
int i = 0;
i < loops; ++
i) {
498 fPaths[
i & (kPathCnt - 1)].
transform(fMatrix);
501 for (
int i = 0;
i < loops; ++
i) {
502 int idx =
i & (kPathCnt - 1);
503 fPaths[idx].transform(fMatrix, &fTransformed[idx]);
527 return "path_equality_50%";
533 fPaths.
reset(kPathCnt);
534 fCopies.
reset(kPathCnt);
535 for (
int i = 0;
i < kPathCnt; ++
i) {
537 fCopies[
i] = fPaths[
i];
543 for (
int i = 0;
i < loops; ++
i) {
544 int idx =
i & (kPathCnt - 1);
545 fParity ^= (fPaths[idx] == fCopies[idx & ~0x1]);
578 return "path_add_path";
580 return "path_add_path_trans";
582 return "path_add_path_matrix";
584 return "path_reverse_add_path";
586 return "path_reverse_path_to";
597 fPaths0.
reset(kPathCnt);
598 fPaths1.
reset(kPathCnt);
599 for (
int i = 0;
i < kPathCnt; ++
i) {
609 for (
int i = 0;
i < loops; ++
i) {
610 int idx =
i & (kPathCnt - 1);
612 result.addPath(fPaths1[idx]);
616 for (
int i = 0;
i < loops; ++
i) {
617 int idx =
i & (kPathCnt - 1);
623 for (
int i = 0;
i < loops; ++
i) {
624 int idx =
i & (kPathCnt - 1);
626 result.addPath(fPaths1[idx], fMatrix);
630 for (
int i = 0;
i < loops; ++
i) {
631 int idx =
i & (kPathCnt - 1);
633 result.reverseAddPath(fPaths1[idx]);
637 for (
int i = 0;
i < loops; ++
i) {
638 int idx =
i & (kPathCnt - 1);
640 result.reversePathTo(fPaths1[idx]);
678 paint.setAntiAlias(
true);
687 for (
int i = 0;
i < loops; ++
i) {
701 temp.
arcTo(r, 0, 0,
false);
703 temp.
arcTo(r, 360, 0,
true);
747 arcRect.
setLTRB(-rx, -ry, rx, ry);
784 for (
int i = 0;
i < loops; ++
i) {
787 paint.setAntiAlias(
true);
828 fName =
"conservatively_contains_";
835 fName.
append(
"round_rect");
836 fPath.
addRoundRect(kBaseRect, kRRRadii[0], kRRRadii[1]);
850 const char* onGetName()
override {
851 return fName.
c_str();
854 void onDraw(
int loops,
SkCanvas*)
override {
855 for (
int i = 0;
i < loops; ++
i) {
856 const SkRect&
rect = fQueryRects[
i % kQueryRectCnt];
861 void onDelayedSetup()
override {
862 fQueryRects.
resize(kQueryRectCnt);
865 for (
int i = 0;
i < kQueryRectCnt; ++
i) {
880 static const SkRect kBounds;
881 static const SkSize kQueryMin;
882 static const SkSize kQueryMax;
883 static const SkRect kBaseRect;
915 const char* onGetName()
override {
return fName.
c_str(); }
917 void onDraw(
int loops,
SkCanvas*)
override {
918 for (
int i = 0;
i < loops; ++
i) {
931 fName.printf(
"conic-eval-pos%d", useV2);
935 for (
int i = 0;
i < loops; ++
i) {
936 for (
int j = 0; j < 1000; ++j) {
941 for (
int i = 0;
i < loops; ++
i) {
942 for (
int j = 0; j < 1000; ++j) {
956 fName.printf(
"conic-eval-tan%d", useV2);
960 for (
int i = 0;
i < loops; ++
i) {
961 for (
int j = 0; j < 1000; ++j) {
966 for (
int i = 0;
i < loops; ++
i) {
967 for (
int j = 0; j < 1000; ++j) {
990 paint.setAntiAlias(
true);
992 paint.setStrokeWidth(2);
995 path.moveTo(-100, 1);
996 path.cubicTo(-101, 1, -118, -47, -138, -44);
1000 6222222.5f, 28333.334f, 0.0f, 0.0f, 1.0f);
1001 for (
int i = 0;
i < loops; ++
i) {
1016 for (
int i = 0;
i < 3; ++
i) {
1055 return "conic-compute-error";
1060 for (
int i = 0;
i < loops; ++
i) {
1061 for (
int j = 0; j <
CONICS; ++j) {
1077 return "conic-asQuadTol";
1081 for (
int i = 0;
i < loops; ++
i) {
1082 for (
int j = 0; j <
CONICS; ++j) {
1098 return "conic-quadPow2";
1102 for (
int i = 0;
i < loops; ++
i) {
1103 for (
int j = 0; j <
CONICS; ++j) {
1126 for (
int i = 0;
i <
N; ++
i) {
1145 for (
int i = 0;
i < loops*100; ++
i) {
1222#include
"include/pathops/SkPathOps.h"
1223#include
"src/core/SkPathPriv.h"
1247 fName.printf(
"convex_path_%d_%d_%d_%d",
w,
h, forceConcave, aa);
1262 return fName.c_str();
1267 paint.setAntiAlias(fAA);
1269 for (
int i = 0;
i < loops; ++
i) {
1270 for (
int inner = 0; inner < 100; ++inner) {
static void rand_conic(SkConic *conic, SkRandom &rand)
DEF_BENCH(return new RotatedRectBench(FLAGS00, false, 45))
#define SkDEBUGFAIL(message)
constexpr SkColor SK_ColorBLACK
bool SK_API TightBounds(const SkPath &path, SkRect *result)
#define INHERITED(method,...)
#define SkScalarCos(radians)
AAAConcavePathBench(Flags flags)
void appendName(SkString *name) override
void makePath(SkPath *path) override
void appendName(SkString *name) override
AAAConvexPathBench(Flags flags)
void makePath(SkPath *path) override
static void make_arb_round_rect(SkPath *path, const SkRect &r, SkScalar xCorner, SkScalar yCorner)
const char * onGetName() override
ArbRoundRectBench(bool zeroRad)
void onDraw(int loops, SkCanvas *canvas) override
static void add_corner_arc(SkPath *path, const SkRect &rect, SkScalar xIn, SkScalar yIn, int startAngle)
virtual void setupPaint(SkPaint *paint)
void makePath(SkPath *path) override
void appendName(SkString *name) override
CirclePathBench(Flags flags)
void onDraw(int loops, SkCanvas *canvas) override
const char * onGetName() override
CirclesBench(Flags flags)
void onDraw(int loops, SkCanvas *canvas) override
CommonConvexBench(int w, int h, bool forceConcave, bool aa)
const char * onGetName() override
bool isSuitableFor(Backend backend) override
void onDraw(int loops, SkCanvas *) override
const char * onGetName() override
ConicBench_ComputeError()
void onDraw(int loops, SkCanvas *) override
ConicBench_EvalPos(bool useV2)
ConicBench_EvalTan(bool useV2)
void onDraw(int loops, SkCanvas *) override
const char * onGetName() override
void onDraw(int loops, SkCanvas *) override
void onDraw(int loops, SkCanvas *) override
const char * onGetName() override
const char * onGetName() override
void onDraw(int loops, SkCanvas *) override
bool isSuitableFor(Backend backend) override
ConservativelyContainsBench(Type type)
bool isSuitableFor(Backend backend) override
void appendName(SkString *name) override
LongCurvedPathBench(Flags flags)
void makePath(SkPath *path) override
int complexity() override
int complexity() override
void makePath(SkPath *path) override
LongLinePathBench(Flags flags)
void appendName(SkString *name) override
void appendName(SkString *name) override
void setupPaint(SkPaint *paint) override
NonAACirclePathBench(Flags flags)
void appendName(SkString *name) override
void makePath(SkPath *path) override
OvalPathBench(Flags flags)
const char * onGetName() override
virtual void appendName(SkString *)=0
void onDraw(int loops, SkCanvas *canvas) override
virtual void makePath(SkPath *)=0
void onDelayedSetup() override
const char * onGetName() override
void onDraw(int loops, SkCanvas *) override
void onDelayedSetup() override
void onDraw(int loops, SkCanvas *) override
const char * onGetName() override
const char * onGetName() override
void onDraw(int loops, SkCanvas *) override
void onDelayedSetup() override
void makePath(SkPath *path)
void createData(int minVerbs, int maxVerbs, bool allowMoves=true, SkRect *bounds=nullptr)
bool isSuitableFor(Backend backend) override
void finishedMakingPaths()
void restartMakingPaths()
void appendName(SkString *name) override
void makePath(SkPath *path) override
RectPathBench(Flags flags)
void makePath(SkPath *path) override
void appendName(SkString *name) override
RotatedRectBench(Flags flags, bool aa, int degrees)
void setupPaint(SkPaint *paint) override
void makePath(SkPath *path) override
SawToothPathBench(Flags flags)
void appendName(SkString *name) override
int complexity() override
const char * onGetName() override
SkBench_AddPathTest(AddType type)
void onDraw(int loops, SkCanvas *) override
void onDelayedSetup() override
void drawPath(const SkPath &path, const SkPaint &paint)
static SkScalar ComputeResScaleForStroking(const SkMatrix &matrix)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
void setStyle(Style style)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setStrokeJoin(Join join)
@ kBevel_Join
connects outside edges
void setStrokeWidth(SkScalar width)
static void SetConvexity(const SkPath &path, SkPathConvexity c)
bool conservativelyContainsRect(const SkRect &rect) const
SkPath & arcTo(const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
SkPath & addRRect(const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
SkPath & addRoundRect(const SkRect &rect, SkScalar rx, SkScalar ry, SkPathDirection dir=SkPathDirection::kCW)
SkPath & addOval(const SkRect &oval, SkPathDirection dir=SkPathDirection::kCW)
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
bool isRect(SkRect *rect, bool *isClosed=nullptr, SkPathDirection *direction=nullptr) const
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
uint32_t nextULessThan(uint32_t count)
uint32_t nextRangeU(uint32_t min, uint32_t max)
void printf(const char format[],...) SK_PRINTF_LIKE(2
void append(const char text[])
const char * c_str() const
bool isSuitableFor(Backend backend) override
void onDraw(int loops, SkCanvas *canvas) override
const char * onGetName() override
TightBoundsBench(SkRect(*proc)(const SkPath &), const char suffix[])
void makePath(SkPath *path) override
TrianglePathBench(Flags flags)
void appendName(SkString *name) override
void reset(size_t count=0)
FlutterSemanticsFlag flags
static float min(float r, float g, float b)
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
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
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
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
SkVector evalTangentAt(SkScalar t) const
int SK_SPI computeQuadPOW2(SkScalar tol) const
void computeAsQuadError(SkVector *err) const
void evalAt(SkScalar t, SkPoint *pos, SkVector *tangent=nullptr) const
bool asQuadTol(SkScalar tol) const
void chop(SkConic dst[2]) const
void set(float x, float y)
SkScalar fBottom
larger y-axis bounds
void setXYWH(float x, float y, float width, float height)
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
void offset(float dx, float dy)
constexpr float height() const
void setLTRB(float left, float top, float right, float bottom)
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
SkScalar fTop
smaller y-axis bounds