23 fName.printf(
"pathops_%s", suffix);
25 fPath1.
addOval({-10, -20, 10, 20});
26 fPath2.
addOval({-20, -10, 20, 10});
39 for (
int i = 0; i < loops; i++) {
40 for (
int j = 0; j < 1000; ++j) {
42 Op(fPath1, fPath2, fOp, &
result);
57 fName.printf(
"pathops_simplify_%s", suffix);
70 for (
int i = 0; i < loops; i++) {
71 for (
int j = 0; j < 100; ++j) {
88 for (
int i = 0; i < 20; ++i) {
97#include
"include/core/SkPathBuilder.h"
99template <size_t N>
struct ArrayPath {
102 int fPIndex = 0, fVIndex = 0;
104 void moveTo(
float x,
float y) {
108 void lineTo(
float x,
float y) {
112 void quadTo(
float x,
float y,
float x1,
float y1) {
115 fPts[fPIndex++] = {x1, y1};
117 void cubicTo(
float x,
float y,
float x1,
float y1,
float x2,
float y2) {
120 fPts[fPIndex++] = {x1, y1};
121 fPts[fPIndex++] = {x2, y2};
123 void incReserve(
int) {}
128 b.incReserve(
N * 12);
133 for (
int i = 1; i <
N; ++i) {
135 b.quadTo(
x,
y,
x,
y);
153 ArrayPath<N*12> fArrays;
157 const char* typenames[] = {
"path",
"snapshot",
"detach",
"arrays" };
159 fName.printf(
"makepath_%s_%s", typenames[(
int)mt], reserve ?
"reserve" :
"noreserve");
168 return fName.c_str();
192 fArrays.fVbs, fArrays.fVIndex,
200 for (
int i = 0; i < loops; i++) {
201 for (
int j = 0; j < 100; ++j) {
205 SkDebugf(
"should never get here!\n");
void run_builder(T &b, bool useReserve, int N)
static SkPath makerects()
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kIntersect_SkPathOp
intersect the two paths
@ kUnion_SkPathOp
union (inclusive-or) the two paths
bool SK_API Simplify(const SkPath &path, SkPath *result)
@ kCubic
SkPath::RawIter returns 4 points.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
PathBuilderBench(MakeType mt, bool reserve)
const char * onGetName() override
void onDelayedSetup() override
void onDraw(int loops, SkCanvas *canvas) override
bool isSuitableFor(Backend backend) override
PathOpsBench(const char suffix[], SkPathOp op)
const char * onGetName() override
bool isSuitableFor(Backend backend) override
void onDraw(int loops, SkCanvas *canvas) override
void onDraw(int loops, SkCanvas *canvas) override
PathOpsSimplifyBench(const char suffix[], const SkPath &path)
const char * onGetName() override
bool isSuitableFor(Backend backend) override
static SkPath Make(const SkPoint[], int pointCount, const uint8_t[], int verbCount, const SkScalar[], int conicWeightCount, SkPathFillType, bool isVolatile=false)
const SkRect & getBounds() const
SkPath & addOval(const SkRect &oval, SkPathDirection dir=SkPathDirection::kCW)