16#if defined(SK_ENABLE_SVG)
23 "svg or skp for the IntersectionTree bench to sniff paths from.");
50 for (
int i = 0;
i < loops; ++
i) {
60 while (rectCount > 0) {
62 int collidedCount = 0;
63 for (
int i = 0;
i < rectCount; ++
i) {
64 if (!intersectionTree.
add(rects[
i])) {
65 collided[collidedCount++] = rects[
i];
72 rectCount = collidedCount;
89 fName.
printf(
"IntersectionTree_%i", numRandomRects);
95 for (
int i = 0;
i < fNumRandomRects; ++
i) {
103 const int fNumRandomRects;
109 if (FLAGS_intersectionTreeFile.isEmpty()) {
112 const char* filename = strrchr(FLAGS_intersectionTreeFile[0],
'/');
116 filename = FLAGS_intersectionTreeFile[0];
118 fName.
printf(
"IntersectionTree_file_%s", filename);
123 if (FLAGS_intersectionTreeFile.isEmpty()) {
130 if (FLAGS_intersectionTreeFile.isEmpty()) {
139 if (
path.isConvex()) {
142 int numVerbs =
path.countVerbs();
144 float gpuFragmentWork = drawBounds.
height() * drawBounds.
width();
145 float cpuTessellationWork = numVerbs *
SkNextLog2(numVerbs);
146 constexpr static float kCpuWeight = 512;
147 constexpr static float kMinNumPixelsToTriangulate = 256 * 256;
148 if (cpuTessellationWork * kCpuWeight + kMinNumPixelsToTriangulate < gpuFragmentWork) {
153 const char*
path = FLAGS_intersectionTreeFile[0];
154 if (
const char*
ext = strrchr(
path,
'.');
ext && !strcmp(
ext,
".svg")) {
155#if defined(SK_ENABLE_SVG)
158 SK_ABORT(
"must compile with svg backend to process svgs");
163 SkDebugf(
">> Found %i stencil/cover paths in %s <<\n",
164 rects->
size(), FLAGS_intersectionTreeFile[0]);
167 void onPerCanvasPostDraw(
SkCanvas*)
override {
168 if (FLAGS_intersectionTreeFile.isEmpty()) {
171 SkDebugf(
">> Reordered %s into %i different stencil/cover draws <<\n",
172 FLAGS_intersectionTreeFile[0],
fNumTrees);
static DEFINE_string(intersectionTreeFile, "", "svg or skp for the IntersectionTree bench to sniff paths from.")
#define SK_ABORT(message,...)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static int SkNextLog2(uint32_t value)
void swap(sk_sp< T > &a, sk_sp< T > &b)
T * makeArray(size_t count)
@ kStroke_Style
set to stroke geometry
float nextRangeF(float min, float max)
void printf(const char format[],...) SK_PRINTF_LIKE(2
const char * c_str() const
const char * onGetName() final
bool isSuitableFor(Backend backend) override
void onDraw(int loops, SkCanvas *) final
virtual void gatherRects(TArray< SkRect > *rects)=0
void onDelayedSetup() final
SkArenaAlloc fAlignedAllocator
RandomIntersectionBench(int numRandomRects)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
unsigned useCenter Optional< SkMatrix > matrix
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
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
constexpr float height() const
constexpr float width() const