From 410e6e80f00a6c660675c80904807a041c7b7d2a Mon Sep 17 00:00:00 2001 From: "mtklein@google.com" Date: Fri, 13 Sep 2013 19:52:27 +0000 Subject: Refactoring: get rid of the SkBenchmark void* parameter. While I was doing massive sed-ing, I also converted every bench to use DEF_BENCH instead of registering the ugly manual way. BUG= R=scroggo@google.com Review URL: https://codereview.chromium.org/23876006 git-svn-id: http://skia.googlecode.com/svn/trunk@11263 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/DashBench.cpp | 70 ++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'bench/DashBench.cpp') diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp index 84fe3ab752..040dfd568d 100644 --- a/bench/DashBench.cpp +++ b/bench/DashBench.cpp @@ -38,8 +38,8 @@ protected: bool fDoClip; public: - DashBench(void* param, const SkScalar intervals[], int count, int width, - bool doClip = false) : INHERITED(param) { + DashBench(const SkScalar intervals[], int count, int width, + bool doClip = false) { fIntervals.append(count, intervals); for (int i = 0; i < count; ++i) { fIntervals[i] *= width; @@ -99,8 +99,8 @@ private: class RectDashBench : public DashBench { public: - RectDashBench(void* param, const SkScalar intervals[], int count, int width) - : INHERITED(param, intervals, count, width) { + RectDashBench(const SkScalar intervals[], int count, int width) + : INHERITED(intervals, count, width) { fName.append("_rect"); } @@ -181,7 +181,7 @@ class MakeDashBench : public SkBenchmark { SkAutoTUnref fPE; public: - MakeDashBench(void* param, void (*proc)(SkPath*), const char name[]) : INHERITED(param) { + MakeDashBench(void (*proc)(SkPath*), const char name[]) { fName.printf("makedash_%s", name); proc(&fPath); @@ -218,7 +218,7 @@ class DashLineBench : public SkBenchmark { SkAutoTUnref fPE; public: - DashLineBench(void* param, SkScalar width, bool isRound) : INHERITED(param) { + DashLineBench(SkScalar width, bool isRound) { fName.printf("dashline_%g_%s", SkScalarToFloat(width), isRound ? "circle" : "square"); fStrokeWidth = width; fIsRound = isRound; @@ -256,8 +256,8 @@ class DrawPointsDashingBench : public SkBenchmark { SkAutoTUnref fPathEffect; public: - DrawPointsDashingBench(void* param, int dashLength, int strokeWidth, bool doAA) - : INHERITED(param) { + DrawPointsDashingBench(int dashLength, int strokeWidth, bool doAA) + { fName.printf("drawpointsdash_%d_%d%s", dashLength, strokeWidth, doAA ? "_aa" : "_bw"); fStrokeWidth = strokeWidth; fDoAA = doAA; @@ -316,7 +316,7 @@ public: return gNames[lt]; } - GiantDashBench(void* param, LineType lt, SkScalar width) : INHERITED(param) { + GiantDashBench(LineType lt, SkScalar width) { fName.printf("giantdashline_%s_%g", LineTypeName(lt), width); fStrokeWidth = width; @@ -380,39 +380,39 @@ static const SkScalar gDots[] = { SK_Scalar1, SK_Scalar1 }; #define PARAM(array) array, SK_ARRAY_COUNT(array) -DEF_BENCH( return new DashBench(p, PARAM(gDots), 0); ) -DEF_BENCH( return new DashBench(p, PARAM(gDots), 1); ) -DEF_BENCH( return new DashBench(p, PARAM(gDots), 1, true); ) -DEF_BENCH( return new DashBench(p, PARAM(gDots), 4); ) -DEF_BENCH( return new MakeDashBench(p, make_poly, "poly"); ) -DEF_BENCH( return new MakeDashBench(p, make_quad, "quad"); ) -DEF_BENCH( return new MakeDashBench(p, make_cubic, "cubic"); ) -DEF_BENCH( return new DashLineBench(p, 0, false); ) -DEF_BENCH( return new DashLineBench(p, SK_Scalar1, false); ) -DEF_BENCH( return new DashLineBench(p, 2 * SK_Scalar1, false); ) -DEF_BENCH( return new DashLineBench(p, 0, true); ) -DEF_BENCH( return new DashLineBench(p, SK_Scalar1, true); ) -DEF_BENCH( return new DashLineBench(p, 2 * SK_Scalar1, true); ) - -DEF_BENCH( return new DrawPointsDashingBench(p, 1, 1, false); ) -DEF_BENCH( return new DrawPointsDashingBench(p, 1, 1, true); ) -DEF_BENCH( return new DrawPointsDashingBench(p, 3, 1, false); ) -DEF_BENCH( return new DrawPointsDashingBench(p, 3, 1, true); ) -DEF_BENCH( return new DrawPointsDashingBench(p, 5, 5, false); ) -DEF_BENCH( return new DrawPointsDashingBench(p, 5, 5, true); ) +DEF_BENCH( return new DashBench(PARAM(gDots), 0); ) +DEF_BENCH( return new DashBench(PARAM(gDots), 1); ) +DEF_BENCH( return new DashBench(PARAM(gDots), 1, true); ) +DEF_BENCH( return new DashBench(PARAM(gDots), 4); ) +DEF_BENCH( return new MakeDashBench(make_poly, "poly"); ) +DEF_BENCH( return new MakeDashBench(make_quad, "quad"); ) +DEF_BENCH( return new MakeDashBench(make_cubic, "cubic"); ) +DEF_BENCH( return new DashLineBench(0, false); ) +DEF_BENCH( return new DashLineBench(SK_Scalar1, false); ) +DEF_BENCH( return new DashLineBench(2 * SK_Scalar1, false); ) +DEF_BENCH( return new DashLineBench(0, true); ) +DEF_BENCH( return new DashLineBench(SK_Scalar1, true); ) +DEF_BENCH( return new DashLineBench(2 * SK_Scalar1, true); ) + +DEF_BENCH( return new DrawPointsDashingBench(1, 1, false); ) +DEF_BENCH( return new DrawPointsDashingBench(1, 1, true); ) +DEF_BENCH( return new DrawPointsDashingBench(3, 1, false); ) +DEF_BENCH( return new DrawPointsDashingBench(3, 1, true); ) +DEF_BENCH( return new DrawPointsDashingBench(5, 5, false); ) +DEF_BENCH( return new DrawPointsDashingBench(5, 5, true); ) /* Disable the GiantDashBench for Android devices until we can better control * the memory usage. (https://code.google.com/p/skia/issues/detail?id=1430) */ #ifndef SK_BUILD_FOR_ANDROID -DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kHori_LineType, 0); ) -DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kVert_LineType, 0); ) -DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kDiag_LineType, 0); ) +DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 0); ) +DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 0); ) +DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 0); ) // pass 2 to explicitly avoid any 1-is-the-same-as-hairline special casing // hori_2 is just too slow to enable at the moment -DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kHori_LineType, 2); ) -DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kVert_LineType, 2); ) -DEF_BENCH( return new GiantDashBench(p, GiantDashBench::kDiag_LineType, 2); ) +DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) +DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) +DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) #endif -- cgit v1.2.3