Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1230)

Unified Diff: bench/PathBench.cpp

Issue 1035943002: use new faster/vector impl for chopping conics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix bench Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkGeometry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PathBench.cpp
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index 2e91a0b390808a12758cc1dc1a92dae46405f9d7..a429e2f9728ee001918aa98886754c756b163993 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -806,44 +806,16 @@ private:
#include "SkGeometry.h"
-class ConicBench_Chop5 : public Benchmark {
- SkConic fRQ;
-public:
- ConicBench_Chop5() {
- fRQ.fPts[0].set(0, 0);
- fRQ.fPts[1].set(100, 0);
- fRQ.fPts[2].set(100, 100);
- fRQ.fW = SkScalarCos(SK_ScalarPI/4);
- }
-
-private:
- const char* onGetName() override {
- return "ratquad-chop-0.5";
- }
-
- void onDraw(const int loops, SkCanvas*) override {
- SkConic dst[2];
- for (int i = 0; i < loops; ++i) {
- fRQ.chopAt(0.5f, dst);
- }
- }
-
- typedef Benchmark INHERITED;
-};
-
-class ConicBench_ChopHalf : public Benchmark {
+class ConicBench_Chop : public Benchmark {
protected:
SkConic fRQ, fDst[2];
SkString fName;
- const bool fUseV2;
public:
- ConicBench_ChopHalf(bool useV2) : fUseV2(useV2) {
+ ConicBench_Chop() : fName("conic-chop") {
fRQ.fPts[0].set(0, 0);
fRQ.fPts[1].set(100, 0);
fRQ.fPts[2].set(100, 100);
fRQ.fW = SkScalarCos(SK_ScalarPI/4);
-
- fName.printf("conic-chop-half%d", useV2);
}
bool isSuitableFor(Backend backend) override {
@@ -854,25 +826,19 @@ private:
const char* onGetName() override { return fName.c_str(); }
void onDraw(const int loops, SkCanvas*) override {
- if (fUseV2) {
- for (int i = 0; i < loops; ++i) {
- fRQ.chop2(fDst);
- }
- } else {
- for (int i = 0; i < loops; ++i) {
- fRQ.chop(fDst);
- }
+ for (int i = 0; i < loops; ++i) {
+ fRQ.chop(fDst);
}
}
typedef Benchmark INHERITED;
};
-DEF_BENCH( return new ConicBench_ChopHalf(false); )
-DEF_BENCH( return new ConicBench_ChopHalf(true); )
+DEF_BENCH( return new ConicBench_Chop; )
-class ConicBench_EvalPos : public ConicBench_ChopHalf {
+class ConicBench_EvalPos : public ConicBench_Chop {
+ const bool fUseV2;
public:
- ConicBench_EvalPos(bool useV2) : ConicBench_ChopHalf(useV2) {
+ ConicBench_EvalPos(bool useV2) : fUseV2(useV2) {
fName.printf("conic-eval-pos%d", useV2);
}
void onDraw(const int loops, SkCanvas*) override {
@@ -894,9 +860,10 @@ public:
DEF_BENCH( return new ConicBench_EvalPos(false); )
DEF_BENCH( return new ConicBench_EvalPos(true); )
-class ConicBench_EvalTan : public ConicBench_ChopHalf {
+class ConicBench_EvalTan : public ConicBench_Chop {
+ const bool fUseV2;
public:
- ConicBench_EvalTan(bool useV2) : ConicBench_ChopHalf(useV2) {
+ ConicBench_EvalTan(bool useV2) : fUseV2(useV2) {
fName.printf("conic-eval-tan%d", useV2);
}
void onDraw(const int loops, SkCanvas*) override {
« no previous file with comments | « no previous file | src/core/SkGeometry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698