Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6c3db04

Browse files
Mike KleinSkia Commit-Bot
authored andcommitted
Revert "Add an implementation and log2 variants for Wang's formula"
This reverts commit e278e1c. Reason for revert: i think we need to do that add with an unsigned, or test instead of always += (1<<23)-1. Original change's description: > Add an implementation and log2 variants for Wang's formula > > Wang's formulas for cubics and quadratics (1985) tell us how many line > segments a curve must be chopped into when tessellating. This CL adds > an implementation along with optimized log2 variants, as well as tests > and a benchmark. > > Change-Id: I3f777b8d0312c57c3a1cc24307de5945c70be287 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288321 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Chris Dalton <csmartdalton@google.com> TBR=bsalomon@google.com,brianosman@google.com,csmartdalton@google.com Change-Id: I24dfd8549054b632f38f7b05b4d857b640cf5cd1 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289658 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
1 parent b2365d8 commit 6c3db04

File tree

6 files changed

+2
-497
lines changed

6 files changed

+2
-497
lines changed

bench/TessellatePathBench.cpp

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
#include "bench/Benchmark.h"
99
#include "include/gpu/GrContext.h"
10-
#include "src/core/SkPathPriv.h"
1110
#include "src/gpu/GrContextPriv.h"
1211
#include "src/gpu/GrOpFlushState.h"
1312
#include "src/gpu/tessellate/GrTessellatePathOp.h"
14-
#include "src/gpu/tessellate/GrWangsFormula.h"
1513
#include "tools/ToolUtils.h"
1614

1715
// This is the number of cubics in desk_chalkboard.skp. (There are no quadratics in the chalkboard.)
@@ -53,7 +51,6 @@ class GrTessellatePathOp::TestingOnly_Benchmark : public Benchmark {
5351
class MiddleOutInnerTrianglesBench;
5452
class OuterCubicsBench;
5553
class CubicWedgesBench;
56-
class WangsFormulaBench;
5754

5855
private:
5956
void onDraw(int loops, SkCanvas*) final {
@@ -90,7 +87,7 @@ class GrTessellatePathOp::TestingOnly_Benchmark::MiddleOutInnerTrianglesBench
9087
}
9188
};
9289

93-
DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::MiddleOutInnerTrianglesBench(); );
90+
DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::MiddleOutInnerTrianglesBench(););
9491

9592
class GrTessellatePathOp::TestingOnly_Benchmark::OuterCubicsBench
9693
: public GrTessellatePathOp::TestingOnly_Benchmark {
@@ -104,7 +101,7 @@ class GrTessellatePathOp::TestingOnly_Benchmark::OuterCubicsBench
104101
}
105102
};
106103

107-
DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::OuterCubicsBench(); );
104+
DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::OuterCubicsBench(););
108105

109106
class GrTessellatePathOp::TestingOnly_Benchmark::CubicWedgesBench
110107
: public GrTessellatePathOp::TestingOnly_Benchmark {
@@ -118,40 +115,3 @@ class GrTessellatePathOp::TestingOnly_Benchmark::CubicWedgesBench
118115
};
119116

120117
DEF_BENCH( return new GrTessellatePathOp::TestingOnly_Benchmark::CubicWedgesBench(););
121-
122-
class GrTessellatePathOp::TestingOnly_Benchmark::WangsFormulaBench
123-
: public GrTessellatePathOp::TestingOnly_Benchmark {
124-
public:
125-
WangsFormulaBench(const char* suffix, const SkMatrix& matrix)
126-
: TestingOnly_Benchmark(SkStringPrintf("wangs_formula_cubic_log2%s", suffix).c_str(),
127-
make_cubic_path(), SkMatrix::I())
128-
, fMatrix(matrix) {
129-
}
130-
void runBench(GrOpFlushState* flushState, GrTessellatePathOp* op) override {
131-
int sum = 0;
132-
GrVectorXform xform(fMatrix);
133-
for (auto [verb, pts, w] : SkPathPriv::Iterate(op->fPath)) {
134-
if (verb == SkPathVerb::kCubic) {
135-
sum += GrWangsFormula::cubic_log2(4, pts, xform);
136-
}
137-
}
138-
// Don't let the compiler optimize away GrWangsFormula::cubic_log2.
139-
if (sum <= 0) {
140-
SK_ABORT("sum should be > 0.");
141-
}
142-
}
143-
private:
144-
SkMatrix fMatrix;
145-
};
146-
147-
DEF_BENCH(
148-
return new GrTessellatePathOp::TestingOnly_Benchmark::WangsFormulaBench("", SkMatrix::I());
149-
);
150-
DEF_BENCH(
151-
return new GrTessellatePathOp::TestingOnly_Benchmark::WangsFormulaBench(
152-
"_scale", SkMatrix::MakeScale(1.1f, 0.9f));
153-
);
154-
DEF_BENCH(
155-
return new GrTessellatePathOp::TestingOnly_Benchmark::WangsFormulaBench(
156-
"_affine", SkMatrix::MakeAll(.9f,0.9f,0, 1.1f,1.1f,0, 0,0,1));
157-
);

gn/gpu.gni

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,6 @@ skia_gpu_sources = [
445445
"$_src/gpu/tessellate/GrTessellatePathOp.h",
446446
"$_src/gpu/tessellate/GrTessellationPathRenderer.cpp",
447447
"$_src/gpu/tessellate/GrTessellationPathRenderer.h",
448-
"$_src/gpu/tessellate/GrVectorXform.h",
449-
"$_src/gpu/tessellate/GrWangsFormula.h",
450448

451449
# text
452450
"$_src/gpu/text/GrAtlasManager.cpp",

gn/tests.gni

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,5 +398,4 @@ pathops_tests_sources = [
398398
"$_tests/PathOpsTigerTest.cpp",
399399
"$_tests/PathOpsTightBoundsTest.cpp",
400400
"$_tests/PathOpsTypesTest.cpp",
401-
"$_tests/WangsFormulaTest.cpp",
402401
]

src/gpu/tessellate/GrVectorXform.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/gpu/tessellate/GrWangsFormula.h

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)