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

Unified Diff: bench/GeometryBench.cpp

Issue 1036753002: SkChopCubicAt2 using Sk2s-- 2x faster (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GeometryBench.cpp
diff --git a/bench/GeometryBench.cpp b/bench/GeometryBench.cpp
index 24d5c34620d154dd64f6e5bbbcbf6ede9471dcfc..9178aa4b510fdfce639e51742367e0baa28136f6 100644
--- a/bench/GeometryBench.cpp
+++ b/bench/GeometryBench.cpp
@@ -134,11 +134,11 @@ DEF_BENCH( return new GeoRectBench_sort; )
class QuadBenchBase : public GeometryBench {
protected:
- SkPoint fPts[3];
+ SkPoint fPts[4];
public:
QuadBenchBase(const char name[]) : GeometryBench(name) {
SkRandom rand;
- for (int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 4; ++i) {
fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1());
}
}
@@ -244,3 +244,35 @@ protected:
};
DEF_BENCH( return new ChopQuadAt1; )
+class ChopCubicAt0 : public QuadBenchBase {
+public:
+ ChopCubicAt0() : QuadBenchBase("chopcubicat0") {}
+protected:
+ void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
+ SkPoint dst[7];
+ for (int outer = 0; outer < loops; ++outer) {
+ SkChopCubicAt(fPts, dst, 0.5f);
+ SkChopCubicAt(fPts, dst, 0.5f);
+ SkChopCubicAt(fPts, dst, 0.5f);
+ SkChopCubicAt(fPts, dst, 0.5f);
+ }
+ }
+};
+DEF_BENCH( return new ChopCubicAt0; )
+
+class ChopCubicAt1 : public QuadBenchBase {
+public:
+ ChopCubicAt1() : QuadBenchBase("chopcubicat1") {}
+protected:
+ void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
+ SkPoint dst[7];
+ for (int outer = 0; outer < loops; ++outer) {
+ SkChopCubicAt2(fPts, dst, 0.5f);
+ SkChopCubicAt2(fPts, dst, 0.5f);
+ SkChopCubicAt2(fPts, dst, 0.5f);
+ SkChopCubicAt2(fPts, dst, 0.5f);
+ }
+ }
+};
+DEF_BENCH( return new ChopCubicAt1; )
+
« 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