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

Unified Diff: bench/GeometryBench.cpp

Issue 1011493003: alt SkEvalQuadAt that returns its answer, using Sk2f (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 fd86effc342fb4efcf546fb02b9cb56dd2754887..1d8575735f76ab64264b76bf4645f73883eb59d8 100644
--- a/bench/GeometryBench.cpp
+++ b/bench/GeometryBench.cpp
@@ -129,3 +129,49 @@ DEF_BENCH( return new GeoRectBench_intersect_rect; )
DEF_BENCH( return new GeoRectBench_Intersects; )
DEF_BENCH( return new GeoRectBench_sort; )
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class EvalQuadAt0 : public GeometryBench {
+ SkPoint fPts[3];
+public:
+ EvalQuadAt0() : GeometryBench("evalquadat0") {
+ SkRandom rand;
+ for (int i = 0; i < 3; ++i) {
+ fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1());
+ }
+ }
+
+protected:
+ void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
+ SkPoint result;
+ for (int outer = 0; outer < loops; ++outer) {
+ for (int i = 0; i < 10000; ++i) {
mtklein 2015/03/19 17:06:25 Might want to drop these inner loops?
+ SkEvalQuadAt(fPts, 0.5f, &result);
+ }
+ }
+ }
+};
+DEF_BENCH( return new EvalQuadAt0; )
+
+class EvalQuadAt1 : public GeometryBench {
+ SkPoint fPts[3];
+public:
+ EvalQuadAt1() : GeometryBench("evalquadat1") {
+ SkRandom rand;
+ for (int i = 0; i < 3; ++i) {
+ fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1());
+ }
+ }
+
+protected:
+ void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
+ for (int outer = 0; outer < loops; ++outer) {
+ for (int i = 0; i < 10000; ++i) {
+ SkEvalQuadAt(fPts, 0.5f);
+ }
+ }
+ }
+};
+DEF_BENCH( return new EvalQuadAt1; )
+
« 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