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
This commit is contained in:
mtklein@google.com 2013-09-13 19:52:27 +00:00
Родитель af54a513a5
Коммит 410e6e80f0
69 изменённых файлов: 788 добавлений и 1005 удалений

Просмотреть файл

@ -24,9 +24,8 @@ class AAClipBench : public SkBenchmark {
bool fDoAA;
public:
AAClipBench(void* param, bool doPath, bool doAA)
: INHERITED(param)
, fDoPath(doPath)
AAClipBench(bool doPath, bool doAA)
: fDoPath(doPath)
, fDoAA(doAA) {
fName.printf("aaclip_%s_%s",
@ -98,10 +97,7 @@ class NestedAAClipBench : public SkBenchmark {
SkPoint fSizes[kNestingDepth+1];
public:
NestedAAClipBench(void* param, bool doAA)
: INHERITED(param)
, fDoAA(doAA) {
NestedAAClipBench(bool doAA) : fDoAA(doAA) {
fName.printf("nested_aaclip_%s", doAA ? "AA" : "BW");
fDrawRect = SkRect::MakeLTRB(0, 0,
@ -184,7 +180,7 @@ class AAClipBuilderBench : public SkBenchmark {
bool fDoAA;
public:
AAClipBuilderBench(void* param, bool doPath, bool doAA) : INHERITED(param) {
AAClipBuilderBench(bool doPath, bool doAA) {
fDoPath = doPath;
fDoAA = doAA;
@ -219,7 +215,7 @@ private:
////////////////////////////////////////////////////////////////////////////////
class AAClipRegionBench : public SkBenchmark {
public:
AAClipRegionBench(void* param) : INHERITED(param) {
AAClipRegionBench() {
SkPath path;
// test conversion of a complex clip to a aaclip
path.addCircle(0, 0, SkIntToScalar(200));
@ -248,31 +244,15 @@ private:
////////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return SkNEW_ARGS(AAClipBuilderBench, (p, false, false)); }
static SkBenchmark* Fact1(void* p) { return SkNEW_ARGS(AAClipBuilderBench, (p, false, true)); }
static SkBenchmark* Fact2(void* p) { return SkNEW_ARGS(AAClipBuilderBench, (p, true, false)); }
static SkBenchmark* Fact3(void* p) { return SkNEW_ARGS(AAClipBuilderBench, (p, true, true)); }
DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (false, false)); )
DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (false, true)); )
DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (true, false)); )
DEF_BENCH( return SkNEW_ARGS(AAClipBuilderBench, (true, true)); )
DEF_BENCH( return SkNEW_ARGS(AAClipRegionBench, ()); )
DEF_BENCH( return SkNEW_ARGS(AAClipBench, (false, false)); )
DEF_BENCH( return SkNEW_ARGS(AAClipBench, (false, true)); )
DEF_BENCH( return SkNEW_ARGS(AAClipBench, (true, false)); )
DEF_BENCH( return SkNEW_ARGS(AAClipBench, (true, true)); )
DEF_BENCH( return SkNEW_ARGS(NestedAAClipBench, (false)); )
DEF_BENCH( return SkNEW_ARGS(NestedAAClipBench, (true)); )
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg2(Fact2);
static BenchRegistry gReg3(Fact3);
static SkBenchmark* Fact01(void* p) { return SkNEW_ARGS(AAClipRegionBench, (p)); }
static BenchRegistry gReg01(Fact01);
static SkBenchmark* Fact000(void* p) { return SkNEW_ARGS(AAClipBench, (p, false, false)); }
static SkBenchmark* Fact001(void* p) { return SkNEW_ARGS(AAClipBench, (p, false, true)); }
static SkBenchmark* Fact002(void* p) { return SkNEW_ARGS(AAClipBench, (p, true, false)); }
static SkBenchmark* Fact003(void* p) { return SkNEW_ARGS(AAClipBench, (p, true, true)); }
static BenchRegistry gReg000(Fact000);
static BenchRegistry gReg001(Fact001);
static BenchRegistry gReg002(Fact002);
static BenchRegistry gReg003(Fact003);
static SkBenchmark* Fact004(void* p) { return SkNEW_ARGS(NestedAAClipBench, (p, false)); }
static SkBenchmark* Fact005(void* p) { return SkNEW_ARGS(NestedAAClipBench, (p, true)); }
static BenchRegistry gReg004(Fact004);
static BenchRegistry gReg005(Fact005);

Просмотреть файл

@ -19,10 +19,10 @@ class BicubicBench : public SkBenchmark {
SkString fName;
public:
BicubicBench(void* param, float x, float y)
: INHERITED(param), fScale(SkSize::Make(SkFloatToScalar(x), SkFloatToScalar(y))) {
BicubicBench(float x, float y)
: fScale(SkSize::Make(SkFloatToScalar(x), SkFloatToScalar(y))) {
fName.printf("bicubic_%gx%g",
SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHeight));
SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHeight));
}
protected:
@ -52,12 +52,7 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* Fact00(void* p) { return new BicubicBench(p, 10.0f, 10.0f); }
static SkBenchmark* Fact01(void* p) { return new BicubicBench(p, 2.5f, 10.0f); }
static SkBenchmark* Fact02(void* p) { return new BicubicBench(p, 10.0f, 2.5f); }
static SkBenchmark* Fact03(void* p) { return new BicubicBench(p, 2.5f, 2.5f); }
static BenchRegistry gReg00(Fact00);
static BenchRegistry gReg01(Fact01);
static BenchRegistry gReg02(Fact02);
static BenchRegistry gReg03(Fact03);
DEF_BENCH( return new BicubicBench(10.0f, 10.0f); )
DEF_BENCH( return new BicubicBench(2.5f, 10.0f); )
DEF_BENCH( return new BicubicBench(10.0f, 2.5f); )
DEF_BENCH( return new BicubicBench(2.5f, 2.5f); )

Просмотреть файл

@ -84,10 +84,9 @@ class BitmapBench : public SkBenchmark {
enum { W = 128 };
enum { H = 128 };
public:
BitmapBench(void* param, bool isOpaque, SkBitmap::Config c,
BitmapBench(bool isOpaque, SkBitmap::Config c,
bool forceUpdate = false, bool bitmapVolatile = false)
: INHERITED(param)
, fIsOpaque(isOpaque)
: fIsOpaque(isOpaque)
, fForceUpdate(forceUpdate)
, fIsVolatile(bitmapVolatile)
, fConfig(c) {
@ -200,9 +199,9 @@ class FilterBitmapBench : public BitmapBench {
uint32_t fFlags;
SkString fFullName;
public:
FilterBitmapBench(void* param, bool isOpaque, SkBitmap::Config c,
FilterBitmapBench(bool isOpaque, SkBitmap::Config c,
bool forceUpdate, bool isVolitile, uint32_t flags)
: INHERITED(param, isOpaque, c, forceUpdate, isVolitile)
: INHERITED(isOpaque, c, forceUpdate, isVolitile)
, fFlags(flags) {
}
@ -279,9 +278,9 @@ private:
SkString fFullName;
SourceAlpha fSourceAlpha;
public:
SourceAlphaBitmapBench(void* param, SourceAlpha alpha, SkBitmap::Config c,
SourceAlphaBitmapBench(SourceAlpha alpha, SkBitmap::Config c,
bool forceUpdate = false, bool bitmapVolatile = false)
: INHERITED(param, false, c, forceUpdate, bitmapVolatile)
: INHERITED(false, c, forceUpdate, bitmapVolatile)
, fSourceAlpha(alpha) {
}
@ -358,31 +357,31 @@ private:
typedef BitmapBench INHERITED;
};
DEF_BENCH( return new BitmapBench(p, false, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kRGB_565_Config); )
DEF_BENCH( return new BitmapBench(p, false, SkBitmap::kIndex8_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kIndex8_Config); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, true); )
DEF_BENCH( return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, false); )
DEF_BENCH( return new BitmapBench(false, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new BitmapBench(true, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new BitmapBench(true, SkBitmap::kRGB_565_Config); )
DEF_BENCH( return new BitmapBench(false, SkBitmap::kIndex8_Config); )
DEF_BENCH( return new BitmapBench(true, SkBitmap::kIndex8_Config); )
DEF_BENCH( return new BitmapBench(true, SkBitmap::kARGB_8888_Config, true, true); )
DEF_BENCH( return new BitmapBench(true, SkBitmap::kARGB_8888_Config, true, false); )
// scale filter -> S32_opaque_D32_filter_DX_{SSE2,SSSE3} and Fact9 is also for S32_D16_filter_DX_SSE2
DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, true, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, false, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(true, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(true, SkBitmap::kARGB_8888_Config, true, true, kScale_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(true, SkBitmap::kARGB_8888_Config, true, false, kScale_Flag | kBilerp_Flag); )
// scale rotate filter -> S32_opaque_D32_filter_DXDY_{SSE2,SSSE3}
DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, true, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(true, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(true, SkBitmap::kARGB_8888_Config, true, true, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(true, SkBitmap::kARGB_8888_Config, true, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); )
DEF_BENCH( return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); )
DEF_BENCH( return new FilterBitmapBench(false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); )
DEF_BENCH( return new FilterBitmapBench(false, SkBitmap::kARGB_8888_Config, false, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); )
// source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon}
DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kOpaque_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kTransparent_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kTwoStripes_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(p, SourceAlphaBitmapBench::kThreeStripes_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kOpaque_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTransparent_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTwoStripes_SourceAlpha, SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kThreeStripes_SourceAlpha, SkBitmap::kARGB_8888_Config); )

Просмотреть файл

@ -48,7 +48,7 @@ class BitmapRectBench : public SkBenchmark {
static const int kWidth = 128;
static const int kHeight = 128;
public:
BitmapRectBench(void* param, U8CPU alpha, bool doFilter, bool slightMatrix) : INHERITED(param) {
BitmapRectBench(U8CPU alpha, bool doFilter, bool slightMatrix) {
fAlpha = SkToU8(alpha);
fDoFilter = doFilter;
fSlightMatrix = slightMatrix;
@ -101,10 +101,10 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, false))
DEF_BENCH(return new BitmapRectBench(p, 0x80, false, false))
DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, false))
DEF_BENCH(return new BitmapRectBench(p, 0x80, true, false))
DEF_BENCH(return new BitmapRectBench(0xFF, false, false))
DEF_BENCH(return new BitmapRectBench(0x80, false, false))
DEF_BENCH(return new BitmapRectBench(0xFF, true, false))
DEF_BENCH(return new BitmapRectBench(0x80, true, false))
DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, true))
DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, true))
DEF_BENCH(return new BitmapRectBench(0xFF, false, true))
DEF_BENCH(return new BitmapRectBench(0xFF, true, true))

Просмотреть файл

@ -20,7 +20,7 @@ class BitmapScaleBench: public SkBenchmark {
SkString fName;
public:
BitmapScaleBench(void *param, int is, int os) : INHERITED(param) {
BitmapScaleBench( int is, int os) {
fInputSize = is;
fOutputSize = os;
@ -88,7 +88,7 @@ private:
class BitmapFilterScaleBench: public BitmapScaleBench {
public:
BitmapFilterScaleBench(void *param, int is, int os) : INHERITED(param, is, os) {
BitmapFilterScaleBench( int is, int os) : INHERITED(is, os) {
setName( "filter" );
}
protected:
@ -103,12 +103,12 @@ private:
typedef BitmapScaleBench INHERITED;
};
DEF_BENCH(return new BitmapFilterScaleBench(p, 10, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 30, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 80, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 80);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 30);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 90, 10);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 256, 64);)
DEF_BENCH(return new BitmapFilterScaleBench(p, 64, 256);)
DEF_BENCH(return new BitmapFilterScaleBench(10, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(30, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(80, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(90, 90);)
DEF_BENCH(return new BitmapFilterScaleBench(90, 80);)
DEF_BENCH(return new BitmapFilterScaleBench(90, 30);)
DEF_BENCH(return new BitmapFilterScaleBench(90, 10);)
DEF_BENCH(return new BitmapFilterScaleBench(256, 64);)
DEF_BENCH(return new BitmapFilterScaleBench(64, 256);)

Просмотреть файл

@ -33,8 +33,7 @@ class BlurBench : public SkBenchmark {
SkString fName;
public:
BlurBench(void* param, SkScalar rad, SkBlurMaskFilter::BlurStyle bs, uint32_t flags = 0)
: INHERITED(param) {
BlurBench(SkScalar rad, SkBlurMaskFilter::BlurStyle bs, uint32_t flags = 0) {
fRadius = rad;
fStyle = bs;
fFlags = flags;
@ -79,32 +78,32 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kSolid_BlurStyle);)
DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kInner_BlurStyle);)
DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
DEF_BENCH(return new BlurBench(p, 0, SkBlurMaskFilter::kNormal_BlurStyle);)
DEF_BENCH(return new BlurBench(0, SkBlurMaskFilter::kNormal_BlurStyle);)

Просмотреть файл

@ -23,8 +23,8 @@
class BlurImageFilterBench : public SkBenchmark {
public:
BlurImageFilterBench(void* param, SkScalar sigmaX, SkScalar sigmaY, bool small) :
INHERITED(param), fIsSmall(small), fInitialized(false), fSigmaX(sigmaX), fSigmaY(sigmaY) {
BlurImageFilterBench(SkScalar sigmaX, SkScalar sigmaY, bool small) :
fIsSmall(small), fInitialized(false), fSigmaX(sigmaX), fSigmaY(sigmaY) {
fName.printf("blur_image_filter_%s_%.2f_%.2f", fIsSmall ? "small" : "large",
SkScalarToFloat(sigmaX), SkScalarToFloat(sigmaY));
}
@ -84,7 +84,7 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, true);)
DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, false);)
DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, true);)
DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, false);)
DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, true);)
DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, false);)
DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, true);)
DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, false);)

Просмотреть файл

@ -26,7 +26,7 @@ class BlurRectBench: public SkBenchmark {
SkString fName;
public:
BlurRectBench(void *param, SkScalar rad) : INHERITED(param) {
BlurRectBench(SkScalar rad) {
fRadius = rad;
if (fRadius > SkIntToScalar(25)) {
@ -76,7 +76,7 @@ private:
class BlurRectDirectBench: public BlurRectBench {
public:
BlurRectDirectBench(void *param, SkScalar rad) : INHERITED(param, rad) {
BlurRectDirectBench(SkScalar rad) : INHERITED(rad) {
SkString name;
if (SkScalarFraction(rad) != 0) {
@ -101,7 +101,7 @@ private:
class BlurRectSeparableBench: public BlurRectBench {
public:
BlurRectSeparableBench(void *param, SkScalar rad) : INHERITED(param, rad) {
BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) {
fSrcMask.fImage = NULL;
}
@ -128,7 +128,7 @@ private:
class BlurRectBoxFilterBench: public BlurRectSeparableBench {
public:
BlurRectBoxFilterBench(void *param, SkScalar rad) : INHERITED(param, rad) {
BlurRectBoxFilterBench(SkScalar rad) : INHERITED(rad) {
SkString name;
if (SkScalarFraction(rad) != 0) {
@ -156,7 +156,7 @@ private:
class BlurRectGaussianBench: public BlurRectSeparableBench {
public:
BlurRectGaussianBench(void *param, SkScalar rad) : INHERITED(param, rad) {
BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) {
SkString name;
if (SkScalarFraction(rad) != 0) {
@ -181,24 +181,24 @@ private:
typedef BlurRectSeparableBench INHERITED;
};
DEF_BENCH(return new BlurRectBoxFilterBench(p, SMALL);)
DEF_BENCH(return new BlurRectBoxFilterBench(p, BIG);)
DEF_BENCH(return new BlurRectBoxFilterBench(p, REALBIG);)
DEF_BENCH(return new BlurRectBoxFilterBench(p, REAL);)
DEF_BENCH(return new BlurRectGaussianBench(p, SMALL);)
DEF_BENCH(return new BlurRectGaussianBench(p, BIG);)
DEF_BENCH(return new BlurRectGaussianBench(p, REALBIG);)
DEF_BENCH(return new BlurRectGaussianBench(p, REAL);)
DEF_BENCH(return new BlurRectDirectBench(p, SMALL);)
DEF_BENCH(return new BlurRectDirectBench(p, BIG);)
DEF_BENCH(return new BlurRectDirectBench(p, REALBIG);)
DEF_BENCH(return new BlurRectDirectBench(p, REAL);)
DEF_BENCH(return new BlurRectBoxFilterBench(SMALL);)
DEF_BENCH(return new BlurRectBoxFilterBench(BIG);)
DEF_BENCH(return new BlurRectBoxFilterBench(REALBIG);)
DEF_BENCH(return new BlurRectBoxFilterBench(REAL);)
DEF_BENCH(return new BlurRectGaussianBench(SMALL);)
DEF_BENCH(return new BlurRectGaussianBench(BIG);)
DEF_BENCH(return new BlurRectGaussianBench(REALBIG);)
DEF_BENCH(return new BlurRectGaussianBench(REAL);)
DEF_BENCH(return new BlurRectDirectBench(SMALL);)
DEF_BENCH(return new BlurRectDirectBench(BIG);)
DEF_BENCH(return new BlurRectDirectBench(REALBIG);)
DEF_BENCH(return new BlurRectDirectBench(REAL);)
DEF_BENCH(return new BlurRectDirectBench(p, kMedium);)
DEF_BENCH(return new BlurRectDirectBench(p, kMedBig);)
DEF_BENCH(return new BlurRectDirectBench(kMedium);)
DEF_BENCH(return new BlurRectDirectBench(kMedBig);)
DEF_BENCH(return new BlurRectBoxFilterBench(p, kMedium);)
DEF_BENCH(return new BlurRectBoxFilterBench(p, kMedBig);)
DEF_BENCH(return new BlurRectBoxFilterBench(kMedium);)
DEF_BENCH(return new BlurRectBoxFilterBench(kMedBig);)
#if 0
// disable Gaussian benchmarks; the algorithm works well enough
@ -206,24 +206,24 @@ DEF_BENCH(return new BlurRectBoxFilterBench(p, kMedBig);)
// to use in production for non-trivial radii, so no real point
// in having the bots benchmark it all the time.
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(1));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(2));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(3));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(4));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(5));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(6));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(7));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(8));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(9));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(10));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(11));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(12));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(13));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(14));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(15));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(16));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(17));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(18));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(19));)
DEF_BENCH(return new BlurRectGaussianBench(p, SkIntToScalar(20));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(1));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(2));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(3));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(4));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(5));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(6));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(7));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(8));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(9));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(10));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(11));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));)
DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));)
#endif

Просмотреть файл

@ -91,7 +91,7 @@ void gen_paths(const SkTDArray<SkScalar>& topData,
// filling
class ChartBench : public SkBenchmark {
public:
ChartBench(void* param, bool aa) : SkBenchmark(param) {
ChartBench(bool aa) {
fShift = 0;
fAA = aa;
fSize.fWidth = -1;
@ -194,8 +194,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return new ChartBench(p, true); }
static SkBenchmark* Fact1(void* p) { return new ChartBench(p, false); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
DEF_BENCH( return new ChartBench(true); )
DEF_BENCH( return new ChartBench(false); )

Просмотреть файл

@ -28,7 +28,7 @@ class ComputeChecksumBench : public SkBenchmark {
ChecksumType fType;
public:
ComputeChecksumBench(void* param, ChecksumType type) : INHERITED(param), fType(type) {
ComputeChecksumBench(ChecksumType type) : fType(type) {
SkRandom rand;
for (int i = 0; i < U32COUNT; ++i) {
fData[i] = rand.nextU();
@ -88,13 +88,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return new ComputeChecksumBench(p, kChecksum_ChecksumType); }
static SkBenchmark* Fact1(void* p) { return new ComputeChecksumBench(p, kMD5_ChecksumType); }
static SkBenchmark* Fact2(void* p) { return new ComputeChecksumBench(p, kSHA1_ChecksumType); }
static SkBenchmark* Fact3(void* p) { return new ComputeChecksumBench(p, kMurmur3_ChecksumType); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg2(Fact2);
static BenchRegistry gReg3(Fact3);
DEF_BENCH( return new ComputeChecksumBench(kChecksum_ChecksumType); )
DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); )
DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); )
DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); )

Просмотреть файл

@ -456,7 +456,7 @@ class ScrollGmailBench : public SkBenchmark {
N = 431
};
public:
ScrollGmailBench(void* param) : INHERITED(param) { }
ScrollGmailBench() { }
protected:
@ -491,10 +491,6 @@ private:
typedef SkBenchmark INHERITED;
};
static inline SkBenchmark* ScrollGmailFactory(void* p) {
return SkNEW_ARGS(ScrollGmailBench, (p));
}
// Disabled this benchmark: it takes 15x longer than any other benchmark
// and is probably not giving us important information.
//static BenchRegistry gScrollGmailReg(ScrollGmailFactory);
// DEF_BENCH(return SkNEW(ScrollGmailBench));

Просмотреть файл

@ -69,7 +69,7 @@ class CMAPBench : public SkBenchmark {
SkPaint fPaint;
public:
CMAPBench(void* param, TypefaceProc proc, const char name[]) : SkBenchmark(param) {
CMAPBench(TypefaceProc proc, const char name[]) {
fProc = proc;
fName.printf("cmap_%s", name);
@ -96,7 +96,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new CMAPBench(p, containsText_proc, "paint_containsText"); )
DEF_BENCH( return new CMAPBench(p, textToGlyphs_proc, "paint_textToGlyphs"); )
DEF_BENCH( return new CMAPBench(p, charsToGlyphs_proc, "face_charsToGlyphs"); )
DEF_BENCH( return new CMAPBench(p, charsToGlyphsNull_proc, "face_charsToGlyphs_null"); )
DEF_BENCH( return new CMAPBench(containsText_proc, "paint_containsText"); )
DEF_BENCH( return new CMAPBench(textToGlyphs_proc, "paint_textToGlyphs"); )
DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); )
DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null"); )

Просмотреть файл

@ -18,8 +18,7 @@
class ColorFilterBaseBench : public SkBenchmark {
public:
ColorFilterBaseBench(void* param, bool small) : INHERITED(param), fIsSmall(small) {
}
ColorFilterBaseBench(bool small) : fIsSmall(small) { }
protected:
SkRect getFilterRect() const {
@ -64,7 +63,7 @@ private:
class ColorFilterDimBrightBench : public ColorFilterBaseBench {
public:
ColorFilterDimBrightBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterDimBrightBench(bool small) : INHERITED(small) {
}
protected:
@ -94,7 +93,7 @@ private:
class ColorFilterBrightGrayBench : public ColorFilterBaseBench {
public:
ColorFilterBrightGrayBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterBrightGrayBench(bool small) : INHERITED(small) {
}
protected:
@ -121,7 +120,7 @@ private:
class ColorFilterGrayBrightBench : public ColorFilterBaseBench {
public:
ColorFilterGrayBrightBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterGrayBrightBench(bool small) : INHERITED(small) {
}
protected:
@ -148,7 +147,7 @@ private:
class ColorFilterBlueBrightBench : public ColorFilterBaseBench {
public:
ColorFilterBlueBrightBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterBlueBrightBench(bool small) : INHERITED(small) {
}
protected:
@ -175,7 +174,7 @@ private:
class ColorFilterBrightBlueBench : public ColorFilterBaseBench {
public:
ColorFilterBrightBlueBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterBrightBlueBench(bool small) : INHERITED(small) {
}
protected:
@ -202,7 +201,7 @@ private:
class ColorFilterBrightBench : public ColorFilterBaseBench {
public:
ColorFilterBrightBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterBrightBench(bool small) : INHERITED(small) {
}
protected:
@ -228,7 +227,7 @@ private:
class ColorFilterBlueBench : public ColorFilterBaseBench {
public:
ColorFilterBlueBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterBlueBench(bool small) : INHERITED(small) {
}
protected:
@ -254,7 +253,7 @@ private:
class ColorFilterGrayBench : public ColorFilterBaseBench {
public:
ColorFilterGrayBench(void* param, bool small) : INHERITED(param, small) {
ColorFilterGrayBench(bool small) : INHERITED(small) {
}
protected:
@ -280,7 +279,7 @@ private:
class TableColorFilterBench : public ColorFilterBaseBench {
public:
TableColorFilterBench(void* param, bool small) : INHERITED(param, small) {
TableColorFilterBench(bool small) : INHERITED(small) {
}
protected:
@ -317,22 +316,22 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new ColorFilterDimBrightBench(p, true); )
DEF_BENCH( return new ColorFilterBrightGrayBench(p, true); )
DEF_BENCH( return new ColorFilterGrayBrightBench(p, true); )
DEF_BENCH( return new ColorFilterBlueBrightBench(p, true); )
DEF_BENCH( return new ColorFilterBrightBlueBench(p, true); )
DEF_BENCH( return new ColorFilterBrightBench(p, true); )
DEF_BENCH( return new ColorFilterBlueBench(p, true); )
DEF_BENCH( return new ColorFilterGrayBench(p, true); )
DEF_BENCH( return new TableColorFilterBench(p, true); )
DEF_BENCH( return new ColorFilterDimBrightBench(true); )
DEF_BENCH( return new ColorFilterBrightGrayBench(true); )
DEF_BENCH( return new ColorFilterGrayBrightBench(true); )
DEF_BENCH( return new ColorFilterBlueBrightBench(true); )
DEF_BENCH( return new ColorFilterBrightBlueBench(true); )
DEF_BENCH( return new ColorFilterBrightBench(true); )
DEF_BENCH( return new ColorFilterBlueBench(true); )
DEF_BENCH( return new ColorFilterGrayBench(true); )
DEF_BENCH( return new TableColorFilterBench(true); )
DEF_BENCH( return new ColorFilterDimBrightBench(p, false); )
DEF_BENCH( return new ColorFilterBrightGrayBench(p, false); )
DEF_BENCH( return new ColorFilterGrayBrightBench(p, false); )
DEF_BENCH( return new ColorFilterBlueBrightBench(p, false); )
DEF_BENCH( return new ColorFilterBrightBlueBench(p, false); )
DEF_BENCH( return new ColorFilterBrightBench(p, false); )
DEF_BENCH( return new ColorFilterBlueBench(p, false); )
DEF_BENCH( return new ColorFilterGrayBench(p, false); )
DEF_BENCH( return new TableColorFilterBench(p, false); )
DEF_BENCH( return new ColorFilterDimBrightBench(false); )
DEF_BENCH( return new ColorFilterBrightGrayBench(false); )
DEF_BENCH( return new ColorFilterGrayBrightBench(false); )
DEF_BENCH( return new ColorFilterBlueBrightBench(false); )
DEF_BENCH( return new ColorFilterBrightBlueBench(false); )
DEF_BENCH( return new ColorFilterBrightBench(false); )
DEF_BENCH( return new ColorFilterBlueBench(false); )
DEF_BENCH( return new ColorFilterGrayBench(false); )
DEF_BENCH( return new TableColorFilterBench(false); )

Просмотреть файл

@ -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<SkPathEffect> 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<SkPathEffect> 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<SkPathEffect> 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 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(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 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

Просмотреть файл

@ -21,7 +21,7 @@ class DecodeBench : public SkBenchmark {
SkBitmap::Config fPrefConfig;
SkString fName;
public:
DecodeBench(void* param, SkBitmap::Config c) : SkBenchmark(param) {
DecodeBench(SkBitmap::Config c) {
fPrefConfig = c;
const char* fname = strrchr(FLAGS_decodeBenchFilename[0], '/');
@ -51,10 +51,6 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* Fact0(void* p) { return new DecodeBench(p, SkBitmap::kARGB_8888_Config); }
static SkBenchmark* Fact1(void* p) { return new DecodeBench(p, SkBitmap::kRGB_565_Config); }
static SkBenchmark* Fact2(void* p) { return new DecodeBench(p, SkBitmap::kARGB_4444_Config); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg2(Fact2);
DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_8888_Config); )
DEF_BENCH( return new DecodeBench(SkBitmap::kRGB_565_Config); )
DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_4444_Config); )

Просмотреть файл

@ -11,7 +11,7 @@
class DeferredCanvasBench : public SkBenchmark {
public:
DeferredCanvasBench(void* param, const char name[]) : INHERITED(param) {
DeferredCanvasBench(const char name[]) {
fName.printf("deferred_canvas_%s", name);
}
@ -70,8 +70,8 @@ private:
// overhead of SkDeferredCanvas
class DeferredRecordBench : public DeferredCanvasBench {
public:
DeferredRecordBench(void* param)
: INHERITED(param, "record") {
DeferredRecordBench()
: INHERITED("record") {
}
protected:
@ -105,6 +105,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return new DeferredRecordBench(p); }
static BenchRegistry gReg0(Fact0);
DEF_BENCH( return new DeferredRecordBench(); )

Просмотреть файл

@ -21,7 +21,7 @@ class DeferredSurfaceCopyBench : public SkBenchmark {
kSurfaceHeight = 1000,
};
public:
DeferredSurfaceCopyBench(void* param, bool discardableContents) : SkBenchmark(param) {
DeferredSurfaceCopyBench(bool discardableContents) {
fDiscardableContents = discardableContents;
}
@ -78,8 +78,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return new DeferredSurfaceCopyBench(p, false); }
static SkBenchmark* Fact1(void* p) { return new DeferredSurfaceCopyBench(p, true); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
DEF_BENCH( return new DeferredSurfaceCopyBench(false); )
DEF_BENCH( return new DeferredSurfaceCopyBench(true); )

Просмотреть файл

@ -17,8 +17,8 @@
class DisplacementBaseBench : public SkBenchmark {
public:
DisplacementBaseBench(void* param, bool small) :
INHERITED(param), fInitialized(false), fIsSmall(small) {
DisplacementBaseBench(bool small) :
fInitialized(false), fIsSmall(small) {
}
protected:
@ -90,7 +90,7 @@ private:
class DisplacementZeroBench : public DisplacementBaseBench {
public:
DisplacementZeroBench(void* param, bool small) : INHERITED(param, small) {
DisplacementZeroBench(bool small) : INHERITED(small) {
}
protected:
@ -117,7 +117,7 @@ private:
class DisplacementAlphaBench : public DisplacementBaseBench {
public:
DisplacementAlphaBench(void* param, bool small) : INHERITED(param, small) {
DisplacementAlphaBench(bool small) : INHERITED(small) {
}
protected:
@ -143,7 +143,7 @@ private:
class DisplacementFullBench : public DisplacementBaseBench {
public:
DisplacementFullBench(void* param, bool small) : INHERITED(param, small) {
DisplacementFullBench(bool small) : INHERITED(small) {
}
protected:
@ -169,9 +169,9 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new DisplacementZeroBench(p, true); )
DEF_BENCH( return new DisplacementAlphaBench(p, true); )
DEF_BENCH( return new DisplacementFullBench(p, true); )
DEF_BENCH( return new DisplacementZeroBench(p, false); )
DEF_BENCH( return new DisplacementAlphaBench(p, false); )
DEF_BENCH( return new DisplacementFullBench(p, false); )
DEF_BENCH( return new DisplacementZeroBench(true); )
DEF_BENCH( return new DisplacementAlphaBench(true); )
DEF_BENCH( return new DisplacementFullBench(true); )
DEF_BENCH( return new DisplacementZeroBench(false); )
DEF_BENCH( return new DisplacementAlphaBench(false); )
DEF_BENCH( return new DisplacementFullBench(false); )

Просмотреть файл

@ -17,10 +17,7 @@
*/
class FSRectBench : public SkBenchmark {
public:
FSRectBench(void* param)
: INHERITED(param)
, fInit(false) {
}
FSRectBench() : fInit(false) { }
protected:
virtual const char* onGetName() SK_OVERRIDE { return "fullscreen_rects"; }
@ -63,4 +60,4 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH( return SkNEW_ARGS(FSRectBench, (p)); )
DEF_BENCH( return SkNEW_ARGS(FSRectBench, ()); )

Просмотреть файл

@ -25,7 +25,7 @@ static int count_glyphs(const uint16_t start[]) {
class FontCacheBench : public SkBenchmark {
public:
FontCacheBench(void* param) : INHERITED(param) {}
FontCacheBench() {}
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -109,7 +109,7 @@ static void dump_array(const uint16_t array[], int count) {
class FontCacheEfficiency : public SkBenchmark {
public:
FontCacheEfficiency(void* param) : INHERITED(param) {
FontCacheEfficiency() {
if (false) dump_array(NULL, 0);
if (false) rotr(0, 0);
}
@ -152,7 +152,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new FontCacheBench(p); )
DEF_BENCH( return new FontCacheBench(); )
// undefine this to run the efficiency test
//DEF_BENCH( return new FontCacheEfficiency(p); )
//DEF_BENCH( return new FontCacheEfficiency(); )

Просмотреть файл

@ -19,7 +19,7 @@ class FontScalerBench : public SkBenchmark {
SkString fText;
bool fDoLCD;
public:
FontScalerBench(void* param, bool doLCD) : INHERITED(param) {
FontScalerBench(bool doLCD) {
fName.printf("fontscaler_%s", doLCD ? "lcd" : "aa");
fText.set("abcdefghijklmnopqrstuvwxyz01234567890");
fDoLCD = doLCD;
@ -55,8 +55,5 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return SkNEW_ARGS(FontScalerBench, (p, false)); }
static SkBenchmark* Fact1(void* p) { return SkNEW_ARGS(FontScalerBench, (p, true)); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
DEF_BENCH( return SkNEW_ARGS(FontScalerBench, (false)); )
DEF_BENCH( return SkNEW_ARGS(FontScalerBench, (true)); )

Просмотреть файл

@ -27,11 +27,10 @@ public:
kPartial_Clear
};
GameBench(void* param, Type type, Clear clear,
GameBench(Type type, Clear clear,
bool aligned = false, bool useAtlas = false,
bool useDrawVertices = false)
: INHERITED(param)
, fType(type)
: fType(type)
, fClear(clear)
, fAligned(aligned)
, fUseAtlas(useAtlas)
@ -313,27 +312,27 @@ private:
};
// Partial clear
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kScale_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kScale_Type,
GameBench::kPartial_Clear)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
GameBench::kPartial_Clear)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
GameBench::kPartial_Clear, true)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type,
GameBench::kPartial_Clear)); )
// Full clear
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kScale_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kScale_Type,
GameBench::kFull_Clear)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
GameBench::kFull_Clear)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
GameBench::kFull_Clear, true)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type,
GameBench::kFull_Clear)); )
// Atlased
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
GameBench::kFull_Clear, false, true)); )
DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type,
GameBench::kFull_Clear, false, true, true)); )

Просмотреть файл

@ -35,7 +35,7 @@ GrMemoryPool A::gPool(10 * (1 << 10), 10 * (1 << 10));
*/
class GrMemoryPoolBenchStack : public SkBenchmark {
public:
GrMemoryPoolBenchStack(void* param) : INHERITED(param) {
GrMemoryPoolBenchStack() {
fIsRendering = false;
}
protected:
@ -86,7 +86,7 @@ private:
*/
class GrMemoryPoolBenchRandom : public SkBenchmark {
public:
GrMemoryPoolBenchRandom(void* param) : INHERITED(param) {
GrMemoryPoolBenchRandom() {
fIsRendering = false;
}
protected:
@ -123,7 +123,7 @@ class GrMemoryPoolBenchQueue : public SkBenchmark {
M = 4 * (1 << 10),
};
public:
GrMemoryPoolBenchQueue(void* param) : INHERITED(param) {
GrMemoryPoolBenchQueue() {
fIsRendering = false;
}
protected:
@ -151,12 +151,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact1(void* p) { return new GrMemoryPoolBenchStack(p); }
static SkBenchmark* Fact2(void* p) { return new GrMemoryPoolBenchRandom(p); }
static SkBenchmark* Fact3(void* p) { return new GrMemoryPoolBenchQueue(p); }
static BenchRegistry gReg01(Fact1);
static BenchRegistry gReg02(Fact2);
static BenchRegistry gReg03(Fact3);
DEF_BENCH( return new GrMemoryPoolBenchStack(); )
DEF_BENCH( return new GrMemoryPoolBenchRandom(); )
DEF_BENCH( return new GrMemoryPoolBenchQueue(); )
#endif

Просмотреть файл

@ -165,13 +165,13 @@ class GradientBench : public SkBenchmark {
H = 400,
};
public:
GradientBench(void* param, GradType gradType,
GradientBench(GradType gradType,
GradData data = gGradData[0],
SkShader::TileMode tm = SkShader::kClamp_TileMode,
GeomType geomType = kRect_GeomType,
float scale = 1.0f
)
: INHERITED(param) {
{
fName.printf("gradient_%s_%s", gGrads[gradType].fName,
tilemodename(tm));
if (geomType != kRect_GeomType) {
@ -230,7 +230,7 @@ class Gradient2Bench : public SkBenchmark {
bool fHasAlpha;
public:
Gradient2Bench(void* param, bool hasAlpha) : INHERITED(param) {
Gradient2Bench(bool hasAlpha) {
fName.printf("gradient_create_%s", hasAlpha ? "alpha" : "opaque");
fHasAlpha = hasAlpha;
}
@ -269,26 +269,26 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH( return new GradientBench(p, kLinear_GradType); )
DEF_BENCH( return new GradientBench(p, kLinear_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(p, kLinear_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(kLinear_GradType); )
DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(kLinear_GradType, gGradData[0], SkShader::kMirror_TileMode); )
// Draw a radial gradient of radius 1/2 on a rectangle; half the lines should
// be completely pinned, the other half should pe partially pinned
DEF_BENCH( return new GradientBench(p, kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); )
DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kRect_GeomType, 0.5f); )
// Draw a radial gradient on a circle of equal size; all the lines should
// hit the unpinned fast path (so long as GradientBench.W == H)
DEF_BENCH( return new GradientBench(p, kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kOval_GeomType); )
DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kClamp_TileMode, kOval_GeomType); )
DEF_BENCH( return new GradientBench(p, kRadial_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(p, kSweep_GradType); )
DEF_BENCH( return new GradientBench(p, kSweep_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(p, kRadial2_GradType); )
DEF_BENCH( return new GradientBench(p, kRadial2_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(p, kRadial2_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(p, kConical_GradType); )
DEF_BENCH( return new GradientBench(p, kConical_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(kRadial_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(kSweep_GradType); )
DEF_BENCH( return new GradientBench(kSweep_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(kRadial2_GradType); )
DEF_BENCH( return new GradientBench(kRadial2_GradType, gGradData[1]); )
DEF_BENCH( return new GradientBench(kRadial2_GradType, gGradData[0], SkShader::kMirror_TileMode); )
DEF_BENCH( return new GradientBench(kConical_GradType); )
DEF_BENCH( return new GradientBench(kConical_GradType, gGradData[1]); )
DEF_BENCH( return new Gradient2Bench(p, false); )
DEF_BENCH( return new Gradient2Bench(p, true); )
DEF_BENCH( return new Gradient2Bench(false); )
DEF_BENCH( return new Gradient2Bench(true); )

Просмотреть файл

@ -32,7 +32,7 @@ static const int kMaxPathSize = 10;
class HairlinePathBench : public SkBenchmark {
public:
HairlinePathBench(void* param, Flags flags) : INHERITED(param), fFlags(flags) {
HairlinePathBench(Flags flags) : fFlags(flags) {
fPaint.setStyle(SkPaint::kStroke_Style);
fPaint.setStrokeWidth(SkIntToScalar(0));
}
@ -77,7 +77,7 @@ private:
class LinePathBench : public HairlinePathBench {
public:
LinePathBench(void* param, Flags flags) : INHERITED(param, flags) {}
LinePathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("line");
@ -109,7 +109,7 @@ private:
class QuadPathBench : public HairlinePathBench {
public:
QuadPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
QuadPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("quad");
@ -141,7 +141,7 @@ private:
class ConicPathBench : public HairlinePathBench {
public:
ConicPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
ConicPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("conic");
@ -176,7 +176,7 @@ private:
class CubicPathBench : public HairlinePathBench {
public:
CubicPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
CubicPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("cubic");
@ -214,23 +214,23 @@ private:
// FLAG10 - AA, big
// FLAG11 - AA, big
DEF_BENCH( return new LinePathBench(p, FLAGS00); )
DEF_BENCH( return new LinePathBench(p, FLAGS01); )
DEF_BENCH( return new LinePathBench(p, FLAGS10); )
DEF_BENCH( return new LinePathBench(p, FLAGS11); )
DEF_BENCH( return new LinePathBench(FLAGS00); )
DEF_BENCH( return new LinePathBench(FLAGS01); )
DEF_BENCH( return new LinePathBench(FLAGS10); )
DEF_BENCH( return new LinePathBench(FLAGS11); )
DEF_BENCH( return new QuadPathBench(p, FLAGS00); )
DEF_BENCH( return new QuadPathBench(p, FLAGS01); )
DEF_BENCH( return new QuadPathBench(p, FLAGS10); )
DEF_BENCH( return new QuadPathBench(p, FLAGS11); )
DEF_BENCH( return new QuadPathBench(FLAGS00); )
DEF_BENCH( return new QuadPathBench(FLAGS01); )
DEF_BENCH( return new QuadPathBench(FLAGS10); )
DEF_BENCH( return new QuadPathBench(FLAGS11); )
// Don't have default path renderer for conics yet on GPU, so must use AA
// DEF_BENCH( return new ConicPathBench(p, FLAGS00); )
// DEF_BENCH( return new ConicPathBench(p, FLAGS01); )
DEF_BENCH( return new ConicPathBench(p, FLAGS10); )
DEF_BENCH( return new ConicPathBench(p, FLAGS11); )
// DEF_BENCH( return new ConicPathBench(FLAGS00); )
// DEF_BENCH( return new ConicPathBench(FLAGS01); )
DEF_BENCH( return new ConicPathBench(FLAGS10); )
DEF_BENCH( return new ConicPathBench(FLAGS11); )
DEF_BENCH( return new CubicPathBench(p, FLAGS00); )
DEF_BENCH( return new CubicPathBench(p, FLAGS01); )
DEF_BENCH( return new CubicPathBench(p, FLAGS10); )
DEF_BENCH( return new CubicPathBench(p, FLAGS11); )
DEF_BENCH( return new CubicPathBench(FLAGS00); )
DEF_BENCH( return new CubicPathBench(FLAGS01); )
DEF_BENCH( return new CubicPathBench(FLAGS10); )
DEF_BENCH( return new CubicPathBench(FLAGS11); )

Просмотреть файл

@ -17,7 +17,7 @@ class ImageCacheBench : public SkBenchmark {
CACHE_COUNT = 500
};
public:
ImageCacheBench(void* param) : INHERITED(param) , fCache(CACHE_COUNT * 100) {
ImageCacheBench() : fCache(CACHE_COUNT * 100) {
fBM.setConfig(SkBitmap::kARGB_8888_Config, DIM, DIM);
fBM.allocPixels();
}
@ -56,4 +56,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new ImageCacheBench(p); )
DEF_BENCH( return new ImageCacheBench(); )

Просмотреть файл

@ -21,8 +21,7 @@ class SkCanvas;
class ImageDecodeBench : public SkBenchmark {
public:
ImageDecodeBench(void* p, const char* filename)
: INHERITED(p)
, fName("image_decode_")
: fName("image_decode_")
, fFilename(filename)
, fStream()
, fValid(false) {
@ -87,5 +86,5 @@ private:
};
// These are files which call decodePalette
//DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, (p, "/usr/local/google/home/scroggo/Downloads/images/hal_163x90.png")); )
//DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, (p, "/usr/local/google/home/scroggo/Downloads/images/box_19_top-left.png")); )
//DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scroggo/Downloads/images/hal_163x90.png")); )
//DEF_BENCH( return SkNEW_ARGS(ImageDecodeBench, ("/usr/local/google/home/scroggo/Downloads/images/box_19_top-left.png")); )

Просмотреть файл

@ -16,7 +16,7 @@ class InterpBench : public SkBenchmark {
int16_t fDst[kBuffer];
float fFx, fDx;
public:
InterpBench(void* param, const char name[]) : INHERITED(param) {
InterpBench(const char name[]) {
fName.printf("interp_%s", name);
fFx = 3.3f;
fDx = 0.1257f;
@ -45,7 +45,7 @@ private:
class Fixed16D16Interp : public InterpBench {
public:
Fixed16D16Interp(void* param) : INHERITED(param, "16.16") {}
Fixed16D16Interp() : INHERITED("16.16") {}
protected:
virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE {
@ -64,7 +64,7 @@ private:
class Fixed32D32Interp : public InterpBench {
public:
Fixed32D32Interp(void* param) : INHERITED(param, "32.32") {}
Fixed32D32Interp() : INHERITED("32.32") {}
protected:
virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE {
@ -95,7 +95,7 @@ private:
class Fixed16D48Interp : public InterpBench {
public:
Fixed16D48Interp(void* param) : INHERITED(param, "16.48") {}
Fixed16D48Interp() : INHERITED("16.48") {}
protected:
virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE {
@ -115,7 +115,7 @@ private:
class FloatInterp : public InterpBench {
public:
FloatInterp(void* param) : INHERITED(param, "float") {}
FloatInterp() : INHERITED("float") {}
protected:
virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE {
@ -133,7 +133,7 @@ private:
class DoubleInterp : public InterpBench {
public:
DoubleInterp(void* param) : INHERITED(param, "double") {}
DoubleInterp() : INHERITED("double") {}
protected:
virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE {
@ -153,14 +153,8 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* M0(void* p) { return new Fixed16D16Interp(p); }
static SkBenchmark* M1(void* p) { return new Fixed32D32Interp(p); }
static SkBenchmark* M2(void* p) { return new Fixed16D48Interp(p); }
static SkBenchmark* M3(void* p) { return new FloatInterp(p); }
static SkBenchmark* M4(void* p) { return new DoubleInterp(p); }
static BenchRegistry gReg0(M0);
static BenchRegistry gReg1(M1);
static BenchRegistry gReg2(M2);
static BenchRegistry gReg3(M3);
static BenchRegistry gReg4(M4);
DEF_BENCH( return new Fixed16D16Interp(); )
DEF_BENCH( return new Fixed32D32Interp(); )
DEF_BENCH( return new Fixed16D48Interp(); )
DEF_BENCH( return new FloatInterp(); )
DEF_BENCH( return new DoubleInterp(); )

Просмотреть файл

@ -17,8 +17,7 @@
class LightingBaseBench : public SkBenchmark {
public:
LightingBaseBench(void* param, bool small) : INHERITED(param), fIsSmall(small) {
}
LightingBaseBench(bool small) : fIsSmall(small) { }
protected:
void draw(SkCanvas* canvas, SkImageFilter* imageFilter) const {
@ -98,7 +97,7 @@ protected:
class LightingPointLitDiffuseBench : public LightingBaseBench {
public:
LightingPointLitDiffuseBench(void* param, bool small) : INHERITED(param, small) {
LightingPointLitDiffuseBench(bool small) : INHERITED(small) {
}
protected:
@ -117,7 +116,7 @@ private:
class LightingDistantLitDiffuseBench : public LightingBaseBench {
public:
LightingDistantLitDiffuseBench(void* param, bool small) : INHERITED(param, small) {
LightingDistantLitDiffuseBench(bool small) : INHERITED(small) {
}
protected:
@ -136,7 +135,7 @@ private:
class LightingSpotLitDiffuseBench : public LightingBaseBench {
public:
LightingSpotLitDiffuseBench(void* param, bool small) : INHERITED(param, small) {
LightingSpotLitDiffuseBench(bool small) : INHERITED(small) {
}
protected:
@ -156,7 +155,7 @@ private:
class LightingPointLitSpecularBench : public LightingBaseBench {
public:
LightingPointLitSpecularBench(void* param, bool small) : INHERITED(param, small) {
LightingPointLitSpecularBench(bool small) : INHERITED(small) {
}
protected:
@ -175,7 +174,7 @@ private:
class LightingDistantLitSpecularBench : public LightingBaseBench {
public:
LightingDistantLitSpecularBench(void* param, bool small) : INHERITED(param, small) {
LightingDistantLitSpecularBench(bool small) : INHERITED(small) {
}
protected:
@ -194,7 +193,7 @@ private:
class LightingSpotLitSpecularBench : public LightingBaseBench {
public:
LightingSpotLitSpecularBench(void* param, bool small) : INHERITED(param, small) {
LightingSpotLitSpecularBench(bool small) : INHERITED(small) {
}
protected:
@ -214,15 +213,15 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new LightingPointLitDiffuseBench(p, true); )
DEF_BENCH( return new LightingPointLitDiffuseBench(p, false); )
DEF_BENCH( return new LightingDistantLitDiffuseBench(p, true); )
DEF_BENCH( return new LightingDistantLitDiffuseBench(p, false); )
DEF_BENCH( return new LightingSpotLitDiffuseBench(p, true); )
DEF_BENCH( return new LightingSpotLitDiffuseBench(p, false); )
DEF_BENCH( return new LightingPointLitSpecularBench(p, true); )
DEF_BENCH( return new LightingPointLitSpecularBench(p, false); )
DEF_BENCH( return new LightingDistantLitSpecularBench(p, true); )
DEF_BENCH( return new LightingDistantLitSpecularBench(p, false); )
DEF_BENCH( return new LightingSpotLitSpecularBench(p, true); )
DEF_BENCH( return new LightingSpotLitSpecularBench(p, false); )
DEF_BENCH( return new LightingPointLitDiffuseBench(true); )
DEF_BENCH( return new LightingPointLitDiffuseBench(false); )
DEF_BENCH( return new LightingDistantLitDiffuseBench(true); )
DEF_BENCH( return new LightingDistantLitDiffuseBench(false); )
DEF_BENCH( return new LightingSpotLitDiffuseBench(true); )
DEF_BENCH( return new LightingSpotLitDiffuseBench(false); )
DEF_BENCH( return new LightingPointLitSpecularBench(true); )
DEF_BENCH( return new LightingPointLitSpecularBench(false); )
DEF_BENCH( return new LightingDistantLitSpecularBench(true); )
DEF_BENCH( return new LightingDistantLitSpecularBench(false); )
DEF_BENCH( return new LightingSpotLitSpecularBench(true); )
DEF_BENCH( return new LightingSpotLitSpecularBench(false); )

Просмотреть файл

@ -26,7 +26,7 @@ class LineBench : public SkBenchmark {
SkPoint fPts[PTS];
public:
LineBench(void* param, SkScalar width, bool doAA) : INHERITED(param) {
LineBench(SkScalar width, bool doAA) {
fStrokeWidth = width;
fDoAA = doAA;
fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW");
@ -59,8 +59,8 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH(return new LineBench(p, 0, false);)
DEF_BENCH(return new LineBench(p, SK_Scalar1, false);)
DEF_BENCH(return new LineBench(p, 0, true);)
DEF_BENCH(return new LineBench(p, SK_Scalar1/2, true);)
DEF_BENCH(return new LineBench(p, SK_Scalar1, true);)
DEF_BENCH(return new LineBench(0, false);)
DEF_BENCH(return new LineBench(SK_Scalar1, false);)
DEF_BENCH(return new LineBench(0, true);)
DEF_BENCH(return new LineBench(SK_Scalar1/2, true);)
DEF_BENCH(return new LineBench(SK_Scalar1, true);)

Просмотреть файл

@ -17,8 +17,8 @@
class MagnifierBench : public SkBenchmark {
public:
MagnifierBench(void* param, bool small) :
INHERITED(param), fIsSmall(small), fInitialized(false) {
MagnifierBench(bool small) :
fIsSmall(small), fInitialized(false) {
}
protected:
@ -83,5 +83,5 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new MagnifierBench(p, true); )
DEF_BENCH( return new MagnifierBench(p, false); )
DEF_BENCH( return new MagnifierBench(true); )
DEF_BENCH( return new MagnifierBench(false); )

Просмотреть файл

@ -22,7 +22,7 @@ class MathBench : public SkBenchmark {
SkString fName;
float fSrc[kBuffer], fDst[kBuffer];
public:
MathBench(void* param, const char name[]) : INHERITED(param) {
MathBench(const char name[]) {
fName.printf("math_%s", name);
SkRandom rand;
@ -57,7 +57,7 @@ private:
class MathBenchU32 : public MathBench {
public:
MathBenchU32(void* param, const char name[]) : INHERITED(param, name) {}
MathBenchU32(const char name[]) : INHERITED(name) {}
protected:
virtual void performITest(uint32_t* SK_RESTRICT dst,
@ -79,7 +79,7 @@ private:
class NoOpMathBench : public MathBench {
public:
NoOpMathBench(void* param) : INHERITED(param, "noOp") {}
NoOpMathBench() : INHERITED("noOp") {}
protected:
virtual void performTest(float* SK_RESTRICT dst,
const float* SK_RESTRICT src,
@ -94,7 +94,7 @@ private:
class SlowISqrtMathBench : public MathBench {
public:
SlowISqrtMathBench(void* param) : INHERITED(param, "slowIsqrt") {}
SlowISqrtMathBench() : INHERITED("slowIsqrt") {}
protected:
virtual void performTest(float* SK_RESTRICT dst,
const float* SK_RESTRICT src,
@ -119,7 +119,7 @@ static inline float SkFastInvSqrt(float x) {
class FastISqrtMathBench : public MathBench {
public:
FastISqrtMathBench(void* param) : INHERITED(param, "fastIsqrt") {}
FastISqrtMathBench() : INHERITED("fastIsqrt") {}
protected:
virtual void performTest(float* SK_RESTRICT dst,
const float* SK_RESTRICT src,
@ -144,7 +144,7 @@ static inline uint32_t QMul64(uint32_t value, U8CPU alpha) {
class QMul64Bench : public MathBenchU32 {
public:
QMul64Bench(void* param) : INHERITED(param, "qmul64") {}
QMul64Bench() : INHERITED("qmul64") {}
protected:
virtual void performITest(uint32_t* SK_RESTRICT dst,
const uint32_t* SK_RESTRICT src,
@ -159,7 +159,7 @@ private:
class QMul32Bench : public MathBenchU32 {
public:
QMul32Bench(void* param) : INHERITED(param, "qmul32") {}
QMul32Bench() : INHERITED("qmul32") {}
protected:
virtual void performITest(uint32_t* SK_RESTRICT dst,
const uint32_t* SK_RESTRICT src,
@ -251,7 +251,7 @@ class IsFiniteBench : public SkBenchmark {
float fData[N];
public:
IsFiniteBench(void* param, int index) : INHERITED(param) {
IsFiniteBench(int index) {
SkRandom rand;
for (int i = 0; i < N; ++i) {
@ -318,7 +318,7 @@ class FloorBench : public SkBenchmark {
bool fFast;
public:
FloorBench(void* param, bool fast) : INHERITED(param), fFast(fast) {
FloorBench(bool fast) : fFast(fast) {
SkRandom rand;
for (int i = 0; i < ARRAY; ++i) {
@ -376,9 +376,7 @@ class CLZBench : public SkBenchmark {
bool fUsePortable;
public:
CLZBench(void* param, bool usePortable)
: INHERITED(param)
, fUsePortable(usePortable) {
CLZBench(bool usePortable) : fUsePortable(usePortable) {
SkRandom rand;
for (int i = 0; i < ARRAY; ++i) {
@ -436,9 +434,7 @@ class NormalizeBench : public SkBenchmark {
SkVector fVec[ARRAY];
public:
NormalizeBench(void* param)
: INHERITED(param) {
NormalizeBench() {
SkRandom rand;
for (int i = 0; i < ARRAY; ++i) {
fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1());
@ -483,7 +479,7 @@ class FixedMathBench : public SkBenchmark {
SkFixed fResult[N];
public:
FixedMathBench(void* param) : INHERITED(param) {
FixedMathBench() {
SkRandom rand;
for (int i = 0; i < this->getLoops(); ++i) {
fData[i%N] = rand.nextSScalar1();
@ -516,26 +512,26 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new NoOpMathBench(p); )
DEF_BENCH( return new SlowISqrtMathBench(p); )
DEF_BENCH( return new FastISqrtMathBench(p); )
DEF_BENCH( return new QMul64Bench(p); )
DEF_BENCH( return new QMul32Bench(p); )
DEF_BENCH( return new NoOpMathBench(); )
DEF_BENCH( return new SlowISqrtMathBench(); )
DEF_BENCH( return new FastISqrtMathBench(); )
DEF_BENCH( return new QMul64Bench(); )
DEF_BENCH( return new QMul32Bench(); )
DEF_BENCH( return new IsFiniteBench(p, -1); )
DEF_BENCH( return new IsFiniteBench(p, 0); )
DEF_BENCH( return new IsFiniteBench(p, 1); )
DEF_BENCH( return new IsFiniteBench(p, 2); )
DEF_BENCH( return new IsFiniteBench(p, 3); )
DEF_BENCH( return new IsFiniteBench(p, 4); )
DEF_BENCH( return new IsFiniteBench(p, 5); )
DEF_BENCH( return new IsFiniteBench(-1); )
DEF_BENCH( return new IsFiniteBench(0); )
DEF_BENCH( return new IsFiniteBench(1); )
DEF_BENCH( return new IsFiniteBench(2); )
DEF_BENCH( return new IsFiniteBench(3); )
DEF_BENCH( return new IsFiniteBench(4); )
DEF_BENCH( return new IsFiniteBench(5); )
DEF_BENCH( return new FloorBench(p, false); )
DEF_BENCH( return new FloorBench(p, true); )
DEF_BENCH( return new FloorBench(false); )
DEF_BENCH( return new FloorBench(true); )
DEF_BENCH( return new CLZBench(p, false); )
DEF_BENCH( return new CLZBench(p, true); )
DEF_BENCH( return new CLZBench(false); )
DEF_BENCH( return new CLZBench(true); )
DEF_BENCH( return new NormalizeBench(p); )
DEF_BENCH( return new NormalizeBench(); )
DEF_BENCH( return new FixedMathBench(p); )
DEF_BENCH( return new FixedMathBench(); )

Просмотреть файл

@ -13,7 +13,7 @@
class Matrix44Bench : public SkBenchmark {
SkString fName;
public:
Matrix44Bench(void* param, const char name[]) : INHERITED(param) {
Matrix44Bench(const char name[]) {
fName.printf("matrix44_%s", name);
fIsRendering = false;
}
@ -39,7 +39,7 @@ private:
class EqualsMatrix44Bench : public Matrix44Bench {
public:
EqualsMatrix44Bench(void* param) : INHERITED(param, "equals") {
EqualsMatrix44Bench() : INHERITED("equals") {
fM1.set(0, 0, 0);
fM2.set(3, 3, 0);
}
@ -58,7 +58,7 @@ private:
class SetIdentityMatrix44Bench : public Matrix44Bench {
public:
SetIdentityMatrix44Bench(void* param) : INHERITED(param, "setidentity") {
SetIdentityMatrix44Bench() : INHERITED("setidentity") {
double rowMajor[16] =
{ 1, 2, 3, 4,
5, 6, 7, 8,
@ -79,7 +79,7 @@ private:
class PreScaleMatrix44Bench : public Matrix44Bench {
public:
PreScaleMatrix44Bench(void* param) : INHERITED(param, "prescale") {
PreScaleMatrix44Bench() : INHERITED("prescale") {
fX = fY = fZ = SkDoubleToMScalar(1.5);
}
protected:
@ -97,7 +97,7 @@ private:
class InvertMatrix44Bench : public Matrix44Bench {
public:
InvertMatrix44Bench(void* param) : INHERITED(param, "invert") {
InvertMatrix44Bench() : INHERITED("invert") {
fM0.set(0, 0, -1.1);
fM0.set(0, 1, 2.1);
fM0.set(0, 2, -3.1);
@ -128,7 +128,7 @@ private:
class InvertAffineMatrix44Bench : public Matrix44Bench {
public:
InvertAffineMatrix44Bench(void* param) : INHERITED(param, "invertaffine") {
InvertAffineMatrix44Bench() : INHERITED("invertaffine") {
fM0.set(0, 0, -1.1);
fM0.set(0, 1, 2.1);
fM0.set(0, 2, -3.1);
@ -156,7 +156,7 @@ private:
class InvertScaleTranslateMatrix44Bench : public Matrix44Bench {
public:
InvertScaleTranslateMatrix44Bench(void* param) : INHERITED(param, "invertscaletranslate") {
InvertScaleTranslateMatrix44Bench() : INHERITED("invertscaletranslate") {
fM0.set(0, 0, -1.1);
fM0.set(0, 3, 4.1);
@ -179,7 +179,7 @@ private:
class InvertTranslateMatrix44Bench : public Matrix44Bench {
public:
InvertTranslateMatrix44Bench(void* param) : INHERITED(param, "inverttranslate") {
InvertTranslateMatrix44Bench() : INHERITED("inverttranslate") {
fM0.set(0, 3, 4.1);
fM0.set(1, 3, 8.1);
fM0.set(2, 3, -12.1);
@ -197,7 +197,7 @@ private:
class PostScaleMatrix44Bench : public Matrix44Bench {
public:
PostScaleMatrix44Bench(void* param) : INHERITED(param, "postscale") {
PostScaleMatrix44Bench() : INHERITED("postscale") {
fX = fY = fZ = SkDoubleToMScalar(1.5);
}
protected:
@ -215,7 +215,7 @@ private:
class SetConcatMatrix44Bench : public Matrix44Bench {
public:
SetConcatMatrix44Bench(void* param) : INHERITED(param, "setconcat") {
SetConcatMatrix44Bench() : INHERITED("setconcat") {
fX = fY = fZ = SkDoubleToMScalar(1.5);
fM1.setScale(fX, fY, fZ);
fM2.setTranslate(fX, fY, fZ);
@ -235,7 +235,7 @@ private:
class GetTypeMatrix44Bench : public Matrix44Bench {
public:
GetTypeMatrix44Bench(void* param) : INHERITED(param, "gettype") {}
GetTypeMatrix44Bench() : INHERITED("gettype") {}
protected:
// Putting random generation of the matrix inside performTest()
// would help us avoid anomalous runs, but takes up 25% or
@ -251,13 +251,13 @@ private:
typedef Matrix44Bench INHERITED;
};
DEF_BENCH( return new SetIdentityMatrix44Bench(p); )
DEF_BENCH( return new EqualsMatrix44Bench(p); )
DEF_BENCH( return new PreScaleMatrix44Bench(p); )
DEF_BENCH( return new PostScaleMatrix44Bench(p); )
DEF_BENCH( return new InvertMatrix44Bench(p); )
DEF_BENCH( return new InvertAffineMatrix44Bench(p); )
DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(p); )
DEF_BENCH( return new InvertTranslateMatrix44Bench(p); )
DEF_BENCH( return new SetConcatMatrix44Bench(p); )
DEF_BENCH( return new GetTypeMatrix44Bench(p); )
DEF_BENCH( return new SetIdentityMatrix44Bench(); )
DEF_BENCH( return new EqualsMatrix44Bench(); )
DEF_BENCH( return new PreScaleMatrix44Bench(); )
DEF_BENCH( return new PostScaleMatrix44Bench(); )
DEF_BENCH( return new InvertMatrix44Bench(); )
DEF_BENCH( return new InvertAffineMatrix44Bench(); )
DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(); )
DEF_BENCH( return new InvertTranslateMatrix44Bench(); )
DEF_BENCH( return new SetConcatMatrix44Bench(); )
DEF_BENCH( return new GetTypeMatrix44Bench(); )

Просмотреть файл

@ -14,7 +14,7 @@
class MatrixBench : public SkBenchmark {
SkString fName;
public:
MatrixBench(void* param, const char name[]) : INHERITED(param) {
MatrixBench(const char name[]) {
fName.printf("matrix_%s", name);
fIsRendering = false;
}
@ -52,7 +52,7 @@ int gMatrixBench_NonStaticGlobal;
class EqualsMatrixBench : public MatrixBench {
public:
EqualsMatrixBench(void* param) : INHERITED(param, "equals") {}
EqualsMatrixBench() : INHERITED("equals") {}
protected:
virtual void performTest() {
SkMatrix m0, m1, m2;
@ -70,7 +70,7 @@ private:
class ScaleMatrixBench : public MatrixBench {
public:
ScaleMatrixBench(void* param) : INHERITED(param, "scale") {
ScaleMatrixBench() : INHERITED("scale") {
fSX = fSY = SkFloatToScalar(1.5f);
fM0.reset();
fM1.setScale(fSX, fSY);
@ -103,7 +103,7 @@ template <typename T> void init9(T array[9]) {
// using floating point precision only.
class FloatConcatMatrixBench : public MatrixBench {
public:
FloatConcatMatrixBench(void* p) : INHERITED(p, "concat_floatfloat") {
FloatConcatMatrixBench() : INHERITED("concat_floatfloat") {
init9(mya);
init9(myb);
init9(myr);
@ -146,7 +146,7 @@ static inline float SkDoubleToFloat(double x) {
// intermediate results during computations.
class FloatDoubleConcatMatrixBench : public MatrixBench {
public:
FloatDoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_floatdouble") {
FloatDoubleConcatMatrixBench() : INHERITED("concat_floatdouble") {
init9(mya);
init9(myb);
init9(myr);
@ -184,7 +184,7 @@ private:
// using double precision only.
class DoubleConcatMatrixBench : public MatrixBench {
public:
DoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_double") {
DoubleConcatMatrixBench() : INHERITED("concat_double") {
init9(mya);
init9(myb);
init9(myr);
@ -220,8 +220,8 @@ private:
class GetTypeMatrixBench : public MatrixBench {
public:
GetTypeMatrixBench(void* param)
: INHERITED(param, "gettype") {
GetTypeMatrixBench()
: INHERITED("gettype") {
fArray[0] = (float) fRnd.nextS();
fArray[1] = (float) fRnd.nextS();
fArray[2] = (float) fRnd.nextS();
@ -265,7 +265,7 @@ private:
class ScaleTransMixedMatrixBench : public MatrixBench {
public:
ScaleTransMixedMatrixBench(void* p) : INHERITED(p, "scaletrans_mixed") {
ScaleTransMixedMatrixBench() : INHERITED("scaletrans_mixed") {
fMatrix.setAll(fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1(),
fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1(),
fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1());
@ -306,7 +306,7 @@ class ScaleTransMixedMatrixBench : public MatrixBench {
class ScaleTransDoubleMatrixBench : public MatrixBench {
public:
ScaleTransDoubleMatrixBench(void* p) : INHERITED(p, "scaletrans_double") {
ScaleTransDoubleMatrixBench() : INHERITED("scaletrans_double") {
init9(fMatrix);
int i;
for (i = 0; i < kCount; i++) {
@ -346,7 +346,7 @@ class ScaleTransDoubleMatrixBench : public MatrixBench {
class DecomposeMatrixBench : public MatrixBench {
public:
DecomposeMatrixBench(void* param) : INHERITED(param, "decompose") {}
DecomposeMatrixBench() : INHERITED("decompose") {}
protected:
virtual void onPreDraw() {
@ -374,8 +374,8 @@ private:
class InvertMapRectMatrixBench : public MatrixBench {
public:
InvertMapRectMatrixBench(void* param, const char* name, int flags)
: INHERITED(param, name)
InvertMapRectMatrixBench(const char* name, int flags)
: INHERITED(name)
, fFlags(flags) {
fMatrix.reset();
fIteration = 0;
@ -429,47 +429,47 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new EqualsMatrixBench(p); )
DEF_BENCH( return new ScaleMatrixBench(p); )
DEF_BENCH( return new FloatConcatMatrixBench(p); )
DEF_BENCH( return new FloatDoubleConcatMatrixBench(p); )
DEF_BENCH( return new DoubleConcatMatrixBench(p); )
DEF_BENCH( return new GetTypeMatrixBench(p); )
DEF_BENCH( return new DecomposeMatrixBench(p); )
DEF_BENCH( return new EqualsMatrixBench(); )
DEF_BENCH( return new ScaleMatrixBench(); )
DEF_BENCH( return new FloatConcatMatrixBench(); )
DEF_BENCH( return new FloatDoubleConcatMatrixBench(); )
DEF_BENCH( return new DoubleConcatMatrixBench(); )
DEF_BENCH( return new GetTypeMatrixBench(); )
DEF_BENCH( return new DecomposeMatrixBench(); )
DEF_BENCH( return new InvertMapRectMatrixBench(p, "invert_maprect_identity", 0); )
DEF_BENCH( return new InvertMapRectMatrixBench("invert_maprect_identity", 0); )
DEF_BENCH(return new InvertMapRectMatrixBench(p,
DEF_BENCH(return new InvertMapRectMatrixBench(
"invert_maprect_rectstaysrect",
InvertMapRectMatrixBench::kScale_Flag |
InvertMapRectMatrixBench::kTranslate_Flag); )
DEF_BENCH(return new InvertMapRectMatrixBench(p,
DEF_BENCH(return new InvertMapRectMatrixBench(
"invert_maprect_translate",
InvertMapRectMatrixBench::kTranslate_Flag); )
DEF_BENCH(return new InvertMapRectMatrixBench(p,
DEF_BENCH(return new InvertMapRectMatrixBench(
"invert_maprect_nonpersp",
InvertMapRectMatrixBench::kScale_Flag |
InvertMapRectMatrixBench::kRotate_Flag |
InvertMapRectMatrixBench::kTranslate_Flag); )
DEF_BENCH( return new InvertMapRectMatrixBench(p,
DEF_BENCH( return new InvertMapRectMatrixBench(
"invert_maprect_persp",
InvertMapRectMatrixBench::kPerspective_Flag); )
DEF_BENCH( return new InvertMapRectMatrixBench(p,
DEF_BENCH( return new InvertMapRectMatrixBench(
"invert_maprect_typemask_rectstaysrect",
InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
InvertMapRectMatrixBench::kScale_Flag |
InvertMapRectMatrixBench::kTranslate_Flag); )
DEF_BENCH( return new InvertMapRectMatrixBench(p,
DEF_BENCH( return new InvertMapRectMatrixBench(
"invert_maprect_typemask_nonpersp",
InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
InvertMapRectMatrixBench::kScale_Flag |
InvertMapRectMatrixBench::kRotate_Flag |
InvertMapRectMatrixBench::kTranslate_Flag); )
DEF_BENCH( return new ScaleTransMixedMatrixBench(p); )
DEF_BENCH( return new ScaleTransDoubleMatrixBench(p); )
DEF_BENCH( return new ScaleTransMixedMatrixBench(); )
DEF_BENCH( return new ScaleTransDoubleMatrixBench(); )

Просмотреть файл

@ -13,8 +13,8 @@
class MatrixConvolutionBench : public SkBenchmark {
public:
MatrixConvolutionBench(void* param, SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha)
: INHERITED(param), fName("matrixconvolution") {
MatrixConvolutionBench(SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha)
: fName("matrixconvolution") {
SkISize kernelSize = SkISize::Make(3, 3);
SkScalar kernel[9] = {
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
@ -54,12 +54,7 @@ private:
SkString fName;
};
static SkBenchmark* Fact00(void* p) { return new MatrixConvolutionBench(p, SkMatrixConvolutionImageFilter::kClamp_TileMode, true); }
static SkBenchmark* Fact01(void* p) { return new MatrixConvolutionBench(p, SkMatrixConvolutionImageFilter::kRepeat_TileMode, true); }
static SkBenchmark* Fact02(void* p) { return new MatrixConvolutionBench(p, SkMatrixConvolutionImageFilter::kClampToBlack_TileMode, true); }
static SkBenchmark* Fact03(void* p) { return new MatrixConvolutionBench(p, SkMatrixConvolutionImageFilter::kClampToBlack_TileMode, false); }
static BenchRegistry gReg00(Fact00);
static BenchRegistry gReg01(Fact01);
static BenchRegistry gReg02(Fact02);
static BenchRegistry gReg03(Fact03);
DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kClamp_TileMode, true); )
DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kRepeat_TileMode, true); )
DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kClampToBlack_TileMode, true); )
DEF_BENCH( return new MatrixConvolutionBench(SkMatrixConvolutionImageFilter::kClampToBlack_TileMode, false); )

Просмотреть файл

@ -16,7 +16,7 @@ class ChunkAllocBench : public SkBenchmark {
SkString fName;
size_t fMinSize;
public:
ChunkAllocBench(void* param, size_t minSize) : INHERITED(param) {
ChunkAllocBench(size_t minSize) {
fMinSize = minSize;
fName.printf("chunkalloc_" SK_SIZE_T_SPECIFIER, minSize);
fIsRendering = false;
@ -50,8 +50,5 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* F0(void* p) { return new ChunkAllocBench(p, 64); }
static SkBenchmark* F1(void* p) { return new ChunkAllocBench(p, 8*1024); }
static BenchRegistry gR0(F0);
static BenchRegistry gR1(F1);
DEF_BENCH( return new ChunkAllocBench(64); )
DEF_BENCH( return new ChunkAllocBench(8*1024); )

Просмотреть файл

@ -28,7 +28,7 @@ protected:
};
public:
MemsetBench(void* param, MemsetType type, size_t minSize, size_t maxSize) : INHERITED(param) {
MemsetBench(MemsetType type, size_t minSize, size_t maxSize) {
SkASSERT((minSize < maxSize) && (maxSize <= kBufferSize));
fMinSize = minSize;
fMaxSize = maxSize;
@ -57,8 +57,8 @@ private:
class Memset32Bench : public MemsetBench {
uint32_t kBuffer[kBufferSize + 3];
public:
Memset32Bench(void* param, size_t minSize, size_t maxSize)
: INHERITED(param, MEMSET32, minSize, maxSize) {}
Memset32Bench(size_t minSize, size_t maxSize)
: INHERITED(MEMSET32, minSize, maxSize) {}
protected:
virtual void performTest() SK_OVERRIDE {
@ -76,8 +76,8 @@ private:
class Memset16Bench : public MemsetBench {
uint16_t kBuffer[kBufferSize + 7];
public:
Memset16Bench(void* param, size_t minSize, size_t maxSize)
: INHERITED(param, MEMSET16, minSize, maxSize) {}
Memset16Bench(size_t minSize, size_t maxSize)
: INHERITED(MEMSET16, minSize, maxSize) {}
protected:
virtual void performTest() SK_OVERRIDE {
@ -96,18 +96,18 @@ private:
typedef MemsetBench INHERITED;
};
DEF_BENCH(return new Memset32Bench(p, 1, 600);)
DEF_BENCH(return new Memset32Bench(p, 600, 800);)
DEF_BENCH(return new Memset32Bench(p, 800, 1000);)
DEF_BENCH(return new Memset32Bench(p, 1000, 2000);)
DEF_BENCH(return new Memset32Bench(p, 2000, 3000);)
DEF_BENCH(return new Memset32Bench(p, 3000, 4000);)
DEF_BENCH(return new Memset32Bench(p, 4000, 5000);)
DEF_BENCH(return new Memset32Bench(1, 600);)
DEF_BENCH(return new Memset32Bench(600, 800);)
DEF_BENCH(return new Memset32Bench(800, 1000);)
DEF_BENCH(return new Memset32Bench(1000, 2000);)
DEF_BENCH(return new Memset32Bench(2000, 3000);)
DEF_BENCH(return new Memset32Bench(3000, 4000);)
DEF_BENCH(return new Memset32Bench(4000, 5000);)
DEF_BENCH(return new Memset16Bench(p, 1, 600);)
DEF_BENCH(return new Memset16Bench(p, 600, 800);)
DEF_BENCH(return new Memset16Bench(p, 800, 1000);)
DEF_BENCH(return new Memset16Bench(p, 1000, 2000);)
DEF_BENCH(return new Memset16Bench(p, 2000, 3000);)
DEF_BENCH(return new Memset16Bench(p, 3000, 4000);)
DEF_BENCH(return new Memset16Bench(p, 4000, 5000);)
DEF_BENCH(return new Memset16Bench(1, 600);)
DEF_BENCH(return new Memset16Bench(600, 800);)
DEF_BENCH(return new Memset16Bench(800, 1000);)
DEF_BENCH(return new Memset16Bench(1000, 2000);)
DEF_BENCH(return new Memset16Bench(2000, 3000);)
DEF_BENCH(return new Memset16Bench(3000, 4000);)
DEF_BENCH(return new Memset16Bench(4000, 5000);)

Просмотреть файл

@ -17,8 +17,7 @@
class MergeBench : public SkBenchmark {
public:
MergeBench(void* param, bool small) : INHERITED(param), fIsSmall(small), fInitialized(false) {
}
MergeBench(bool small) : fIsSmall(small), fInitialized(false) { }
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -98,5 +97,5 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new MergeBench(p, true); )
DEF_BENCH( return new MergeBench(p, false); )
DEF_BENCH( return new MergeBench(true); )
DEF_BENCH( return new MergeBench(false); )

Просмотреть файл

@ -36,8 +36,8 @@ class MorphologyBench : public SkBenchmark {
SkString fName;
public:
MorphologyBench(void* param, SkScalar rad, MorphologyType style)
: INHERITED(param) {
MorphologyBench(SkScalar rad, MorphologyType style)
{
fRadius = rad;
fStyle = style;
const char* name = rad > 0 ? gStyleName[style] : "none";
@ -87,30 +87,17 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* Fact00(void* p) { return new MorphologyBench(p, SMALL, kErode_MT); }
static SkBenchmark* Fact01(void* p) { return new MorphologyBench(p, SMALL, kDilate_MT); }
static SkBenchmark* Fact10(void* p) { return new MorphologyBench(p, BIG, kErode_MT); }
static SkBenchmark* Fact11(void* p) { return new MorphologyBench(p, BIG, kDilate_MT); }
static SkBenchmark* Fact20(void* p) { return new MorphologyBench(p, REAL, kErode_MT); }
static SkBenchmark* Fact21(void* p) { return new MorphologyBench(p, REAL, kDilate_MT); }
static SkBenchmark* FactNone(void* p) { return new MorphologyBench(p, 0, kErode_MT); }
// Fixed point can be 100x slower than float on these tests, causing
// bench to timeout.
#ifndef SK_SCALAR_IS_FIXED
DEF_BENCH( return new MorphologyBench(SMALL, kErode_MT); )
DEF_BENCH( return new MorphologyBench(SMALL, kDilate_MT); )
static BenchRegistry gReg00(Fact00);
static BenchRegistry gReg01(Fact01);
DEF_BENCH( return new MorphologyBench(BIG, kErode_MT); )
DEF_BENCH( return new MorphologyBench(BIG, kDilate_MT); )
static BenchRegistry gReg10(Fact10);
static BenchRegistry gReg11(Fact11);
static BenchRegistry gReg20(Fact20);
static BenchRegistry gReg21(Fact21);
static BenchRegistry gRegNone(FactNone);
DEF_BENCH( return new MorphologyBench(REAL, kErode_MT); )
DEF_BENCH( return new MorphologyBench(REAL, kDilate_MT); )
DEF_BENCH( return new MorphologyBench(0, kErode_MT); )
#endif

Просмотреть файл

@ -9,7 +9,7 @@
class MutexBench : public SkBenchmark {
public:
MutexBench(void* param) : INHERITED(param) {
MutexBench() {
fIsRendering = false;
}
protected:
@ -31,6 +31,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact(void* p) { return new MutexBench(p); }
static BenchRegistry gReg01(Fact);
DEF_BENCH( return new MutexBench(); )

Просмотреть файл

@ -30,7 +30,7 @@ class PathBench : public SkBenchmark {
SkString fName;
Flags fFlags;
public:
PathBench(void* param, Flags flags) : INHERITED(param), fFlags(flags) {
PathBench(Flags flags) : fFlags(flags) {
fPaint.setStyle(flags & kStroke_Flag ? SkPaint::kStroke_Style :
SkPaint::kFill_Style);
fPaint.setStrokeWidth(SkIntToScalar(5));
@ -79,7 +79,7 @@ private:
class TrianglePathBench : public PathBench {
public:
TrianglePathBench(void* param, Flags flags) : INHERITED(param, flags) {}
TrianglePathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("triangle");
@ -99,7 +99,7 @@ private:
class RectPathBench : public PathBench {
public:
RectPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
RectPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("rect");
@ -114,7 +114,7 @@ private:
class OvalPathBench : public PathBench {
public:
OvalPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
OvalPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("oval");
@ -129,7 +129,7 @@ private:
class CirclePathBench: public PathBench {
public:
CirclePathBench(void* param, Flags flags) : INHERITED(param, flags) {}
CirclePathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("circle");
@ -144,7 +144,7 @@ private:
class SawToothPathBench : public PathBench {
public:
SawToothPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
SawToothPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("sawtooth");
@ -174,9 +174,7 @@ private:
class LongCurvedPathBench : public PathBench {
public:
LongCurvedPathBench(void * param, Flags flags)
: INHERITED(param, flags) {
}
LongCurvedPathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("long_curved");
@ -199,9 +197,7 @@ private:
class LongLinePathBench : public PathBench {
public:
LongLinePathBench(void * param, Flags flags)
: INHERITED(param, flags) {
}
LongLinePathBench(Flags flags) : INHERITED(flags) {}
virtual void appendName(SkString* name) SK_OVERRIDE {
name->append("long_line");
@ -220,7 +216,7 @@ private:
class RandomPathBench : public SkBenchmark {
public:
RandomPathBench(void* param) : INHERITED(param) {
RandomPathBench() {
fIsRendering = false;
}
@ -321,7 +317,7 @@ private:
class PathCreateBench : public RandomPathBench {
public:
PathCreateBench(void* param) : INHERITED(param) {
PathCreateBench() {
}
protected:
@ -358,7 +354,7 @@ private:
class PathCopyBench : public RandomPathBench {
public:
PathCopyBench(void* param) : INHERITED(param) {
PathCopyBench() {
}
protected:
@ -398,10 +394,7 @@ private:
class PathTransformBench : public RandomPathBench {
public:
PathTransformBench(bool inPlace, void* param)
: INHERITED(param)
, fInPlace(inPlace) {
}
PathTransformBench(bool inPlace) : fInPlace(inPlace) {}
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -454,9 +447,7 @@ private:
class PathEqualityBench : public RandomPathBench {
public:
PathEqualityBench(void* param)
: INHERITED(param) {
}
PathEqualityBench() { }
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -509,9 +500,7 @@ public:
kReversePathTo_AddType,
};
SkBench_AddPathTest(AddType type, void* param)
: INHERITED(param)
, fType(type) {
SkBench_AddPathTest(AddType type) : fType(type) {
fMatrix.setRotate(60 * SK_Scalar1);
}
@ -621,7 +610,7 @@ protected:
Flags fFlags;
public:
CirclesBench(void* param, Flags flags) : INHERITED(param), fFlags(flags) {
CirclesBench(Flags flags) : fFlags(flags) {
fName.printf("circles_%s", fFlags & kStroke_Flag ? "stroke" : "fill");
}
@ -681,7 +670,7 @@ protected:
SkString fName;
public:
ArbRoundRectBench(void* param, bool zeroRad) : INHERITED(param), fZeroRad(zeroRad) {
ArbRoundRectBench(bool zeroRad) : fZeroRad(zeroRad) {
if (zeroRad) {
fName.printf("zeroradroundrect");
} else {
@ -782,7 +771,7 @@ public:
kOval_Type,
};
ConservativelyContainsBench(void* param, Type type) : INHERITED(param) {
ConservativelyContainsBench(Type type) {
fIsRendering = false;
fParity = false;
fName = "conservatively_contains_";
@ -858,7 +847,7 @@ private:
class ConicBench_Chop5 : public SkBenchmark {
SkConic fRQ;
public:
ConicBench_Chop5(void* param) : INHERITED(param) {
ConicBench_Chop5() {
fRQ.fPts[0].set(0, 0);
fRQ.fPts[1].set(100, 0);
fRQ.fPts[2].set(100, 100);
@ -883,7 +872,7 @@ private:
class ConicBench_ChopHalf : public SkBenchmark {
SkConic fRQ;
public:
ConicBench_ChopHalf(void* param) : INHERITED(param) {
ConicBench_ChopHalf() {
fRQ.fPts[0].set(0, 0);
fRQ.fPts[1].set(100, 0);
fRQ.fPts[2].set(100, 100);
@ -920,7 +909,7 @@ static void rand_conic(SkConic* conic, SkRandom& rand) {
class ConicBench : public SkBenchmark {
public:
ConicBench(void* param) : INHERITED(param) {
ConicBench() {
SkRandom rand;
for (int i = 0; i < CONICS; ++i) {
rand_conic(&fConics[i], rand);
@ -940,7 +929,7 @@ private:
class ConicBench_ComputeError : public ConicBench {
public:
ConicBench_ComputeError(void* param) : INHERITED(param) {}
ConicBench_ComputeError() {}
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -962,7 +951,7 @@ private:
class ConicBench_asQuadTol : public ConicBench {
public:
ConicBench_asQuadTol(void* param) : INHERITED(param) {}
ConicBench_asQuadTol() {}
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -983,7 +972,7 @@ private:
class ConicBench_quadPow2 : public ConicBench {
public:
ConicBench_quadPow2(void* param) : INHERITED(param) {}
ConicBench_quadPow2() {}
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -1010,57 +999,57 @@ const SkSize ConservativelyContainsBench::kQueryMax = SkSize::Make(SkIntToScalar
const SkRect ConservativelyContainsBench::kBaseRect = SkRect::MakeXYWH(SkIntToScalar(25), SkIntToScalar(25), SkIntToScalar(50), SkIntToScalar(50));
const SkScalar ConservativelyContainsBench::kRRRadii[2] = {SkIntToScalar(5), SkIntToScalar(10)};
DEF_BENCH( return new TrianglePathBench(p, FLAGS00); )
DEF_BENCH( return new TrianglePathBench(p, FLAGS01); )
DEF_BENCH( return new TrianglePathBench(p, FLAGS10); )
DEF_BENCH( return new TrianglePathBench(p, FLAGS11); )
DEF_BENCH( return new TrianglePathBench(FLAGS00); )
DEF_BENCH( return new TrianglePathBench(FLAGS01); )
DEF_BENCH( return new TrianglePathBench(FLAGS10); )
DEF_BENCH( return new TrianglePathBench(FLAGS11); )
DEF_BENCH( return new RectPathBench(p, FLAGS00); )
DEF_BENCH( return new RectPathBench(p, FLAGS01); )
DEF_BENCH( return new RectPathBench(p, FLAGS10); )
DEF_BENCH( return new RectPathBench(p, FLAGS11); )
DEF_BENCH( return new RectPathBench(FLAGS00); )
DEF_BENCH( return new RectPathBench(FLAGS01); )
DEF_BENCH( return new RectPathBench(FLAGS10); )
DEF_BENCH( return new RectPathBench(FLAGS11); )
DEF_BENCH( return new OvalPathBench(p, FLAGS00); )
DEF_BENCH( return new OvalPathBench(p, FLAGS01); )
DEF_BENCH( return new OvalPathBench(p, FLAGS10); )
DEF_BENCH( return new OvalPathBench(p, FLAGS11); )
DEF_BENCH( return new OvalPathBench(FLAGS00); )
DEF_BENCH( return new OvalPathBench(FLAGS01); )
DEF_BENCH( return new OvalPathBench(FLAGS10); )
DEF_BENCH( return new OvalPathBench(FLAGS11); )
DEF_BENCH( return new CirclePathBench(p, FLAGS00); )
DEF_BENCH( return new CirclePathBench(p, FLAGS01); )
DEF_BENCH( return new CirclePathBench(p, FLAGS10); )
DEF_BENCH( return new CirclePathBench(p, FLAGS11); )
DEF_BENCH( return new CirclePathBench(FLAGS00); )
DEF_BENCH( return new CirclePathBench(FLAGS01); )
DEF_BENCH( return new CirclePathBench(FLAGS10); )
DEF_BENCH( return new CirclePathBench(FLAGS11); )
DEF_BENCH( return new SawToothPathBench(p, FLAGS00); )
DEF_BENCH( return new SawToothPathBench(p, FLAGS01); )
DEF_BENCH( return new SawToothPathBench(FLAGS00); )
DEF_BENCH( return new SawToothPathBench(FLAGS01); )
DEF_BENCH( return new LongCurvedPathBench(p, FLAGS00); )
DEF_BENCH( return new LongCurvedPathBench(p, FLAGS01); )
DEF_BENCH( return new LongLinePathBench(p, FLAGS00); )
DEF_BENCH( return new LongLinePathBench(p, FLAGS01); )
DEF_BENCH( return new LongCurvedPathBench(FLAGS00); )
DEF_BENCH( return new LongCurvedPathBench(FLAGS01); )
DEF_BENCH( return new LongLinePathBench(FLAGS00); )
DEF_BENCH( return new LongLinePathBench(FLAGS01); )
DEF_BENCH( return new PathCreateBench(p); )
DEF_BENCH( return new PathCopyBench(p); )
DEF_BENCH( return new PathTransformBench(true, p); )
DEF_BENCH( return new PathTransformBench(false, p); )
DEF_BENCH( return new PathEqualityBench(p); )
DEF_BENCH( return new PathCreateBench(); )
DEF_BENCH( return new PathCopyBench(); )
DEF_BENCH( return new PathTransformBench(true); )
DEF_BENCH( return new PathTransformBench(false); )
DEF_BENCH( return new PathEqualityBench(); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAdd_AddType, p); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAddTrans_AddType, p); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAddMatrix_AddType, p); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kPathTo_AddType, p); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kReverseAdd_AddType, p); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kReversePathTo_AddType, p); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAdd_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAddTrans_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kAddMatrix_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kPathTo_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kReverseAdd_AddType); )
DEF_BENCH( return new SkBench_AddPathTest(SkBench_AddPathTest::kReversePathTo_AddType); )
DEF_BENCH( return new CirclesBench(p, FLAGS00); )
DEF_BENCH( return new CirclesBench(p, FLAGS01); )
DEF_BENCH( return new ArbRoundRectBench(p, false); )
DEF_BENCH( return new ArbRoundRectBench(p, true); )
DEF_BENCH( return new ConservativelyContainsBench(p, ConservativelyContainsBench::kRect_Type); )
DEF_BENCH( return new ConservativelyContainsBench(p, ConservativelyContainsBench::kRoundRect_Type); )
DEF_BENCH( return new ConservativelyContainsBench(p, ConservativelyContainsBench::kOval_Type); )
DEF_BENCH( return new CirclesBench(FLAGS00); )
DEF_BENCH( return new CirclesBench(FLAGS01); )
DEF_BENCH( return new ArbRoundRectBench(false); )
DEF_BENCH( return new ArbRoundRectBench(true); )
DEF_BENCH( return new ConservativelyContainsBench(ConservativelyContainsBench::kRect_Type); )
DEF_BENCH( return new ConservativelyContainsBench(ConservativelyContainsBench::kRoundRect_Type); )
DEF_BENCH( return new ConservativelyContainsBench(ConservativelyContainsBench::kOval_Type); )
DEF_BENCH( return new ConicBench_Chop5(p) )
DEF_BENCH( return new ConicBench_ChopHalf(p) )
DEF_BENCH( return new ConicBench_ComputeError(p) )
DEF_BENCH( return new ConicBench_asQuadTol(p) )
DEF_BENCH( return new ConicBench_quadPow2(p) )
DEF_BENCH( return new ConicBench_Chop5() )
DEF_BENCH( return new ConicBench_ChopHalf() )
DEF_BENCH( return new ConicBench_ComputeError() )
DEF_BENCH( return new ConicBench_asQuadTol() )
DEF_BENCH( return new ConicBench_quadPow2() )

Просмотреть файл

@ -31,7 +31,7 @@ class PathIterBench : public SkBenchmark {
bool fRaw;
public:
PathIterBench(void* param, bool raw) : INHERITED(param) {
PathIterBench(bool raw) {
fName.printf("pathiter_%s", raw ? "raw" : "consume");
fRaw = raw;
@ -89,8 +89,5 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* F0(void* p) { return new PathIterBench(p, false); }
static SkBenchmark* F1(void* p) { return new PathIterBench(p, true); }
static BenchRegistry gR0(F0);
static BenchRegistry gR1(F1);
DEF_BENCH( return new PathIterBench(false); )
DEF_BENCH( return new PathIterBench(true); )

Просмотреть файл

@ -42,7 +42,7 @@ class PathUtilsBench : public SkBenchmark {
char* bits[H * STRIDE];
public:
PathUtilsBench(void* param, Proc proc, const char name[]) : INHERITED(param) {
PathUtilsBench(Proc proc, const char name[]) {
fProc = proc;
fName.printf("pathUtils_%s", name);
@ -68,8 +68,5 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* PU_path(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, path_proc, "path")); }
static SkBenchmark* PU_region(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, region_proc, "region")); }
static BenchRegistry PU_Path(PU_path);
static BenchRegistry PU_Region(PU_region);
DEF_BENCH( return SkNEW_ARGS(PathUtilsBench, (path_proc, "path")); )
DEF_BENCH( return SkNEW_ARGS(PathUtilsBench, (region_proc, "region")); )

Просмотреть файл

@ -12,7 +12,7 @@ class PerlinNoiseBench : public SkBenchmark {
SkISize fSize;
public:
PerlinNoiseBench(void* param) : INHERITED(param) {
PerlinNoiseBench() {
fSize = SkISize::Make(80, 80);
}
@ -59,4 +59,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new PerlinNoiseBench(p); )
DEF_BENCH( return new PerlinNoiseBench(); )

Просмотреть файл

@ -18,7 +18,7 @@
class PicturePlaybackBench : public SkBenchmark {
public:
PicturePlaybackBench(void* param, const char name[]) : INHERITED(param) {
PicturePlaybackBench(const char name[]) {
fName.printf("picture_playback_%s", name);
fPictureWidth = SkIntToScalar(PICTURE_WIDTH);
fPictureHeight = SkIntToScalar(PICTURE_HEIGHT);
@ -69,7 +69,7 @@ private:
class TextPlaybackBench : public PicturePlaybackBench {
public:
TextPlaybackBench(void* param) : INHERITED(param, "drawText") { }
TextPlaybackBench() : INHERITED("drawText") { }
protected:
virtual void recordCanvas(SkCanvas* canvas) {
SkPaint paint;
@ -92,8 +92,8 @@ private:
class PosTextPlaybackBench : public PicturePlaybackBench {
public:
PosTextPlaybackBench(void* param, bool drawPosH)
: INHERITED(param, drawPosH ? "drawPosTextH" : "drawPosText")
PosTextPlaybackBench(bool drawPosH)
: INHERITED(drawPosH ? "drawPosTextH" : "drawPosText")
, fDrawPosH(drawPosH) { }
protected:
virtual void recordCanvas(SkCanvas* canvas) {
@ -136,10 +136,6 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return new TextPlaybackBench(p); }
static SkBenchmark* Fact1(void* p) { return new PosTextPlaybackBench(p, true); }
static SkBenchmark* Fact2(void* p) { return new PosTextPlaybackBench(p, false); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg2(Fact2);
DEF_BENCH( return new TextPlaybackBench(); )
DEF_BENCH( return new PosTextPlaybackBench(true); )
DEF_BENCH( return new PosTextPlaybackBench(false); )

Просмотреть файл

@ -16,7 +16,7 @@
class PictureRecordBench : public SkBenchmark {
public:
PictureRecordBench(void* param, const char name[]) : INHERITED(param) {
PictureRecordBench(const char name[]) {
fName.printf("picture_record_%s", name);
fPictureWidth = SkIntToScalar(PICTURE_WIDTH);
fPictureHeight = SkIntToScalar(PICTURE_HEIGHT);
@ -61,8 +61,8 @@ private:
*/
class DictionaryRecordBench : public PictureRecordBench {
public:
DictionaryRecordBench(void* param)
: INHERITED(param, "dictionaries") { }
DictionaryRecordBench()
: INHERITED("dictionaries") { }
protected:
virtual void recordCanvas(SkCanvas* canvas) {
@ -123,8 +123,8 @@ private:
*/
class UniquePaintDictionaryRecordBench : public PictureRecordBench {
public:
UniquePaintDictionaryRecordBench(void* param)
: INHERITED(param, "unique_paint_dictionary") { }
UniquePaintDictionaryRecordBench()
: INHERITED("unique_paint_dictionary") { }
protected:
virtual void recordCanvas(SkCanvas* canvas) {
@ -150,8 +150,8 @@ private:
*/
class RecurringPaintDictionaryRecordBench : public PictureRecordBench {
public:
RecurringPaintDictionaryRecordBench(void* param)
: INHERITED(param, "recurring_paint_dictionary") {
RecurringPaintDictionaryRecordBench()
: INHERITED("recurring_paint_dictionary") {
SkRandom rand;
for (int i = 0; i < ObjCount; i++) {
fPaint[i].setColor(rand.nextU());
@ -176,10 +176,6 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact0(void* p) { return new DictionaryRecordBench(p); }
static SkBenchmark* Fact1(void* p) { return new UniquePaintDictionaryRecordBench(p); }
static SkBenchmark* Fact2(void* p) { return new RecurringPaintDictionaryRecordBench(p); }
static BenchRegistry gReg0(Fact0);
static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg2(Fact2);
DEF_BENCH( return new DictionaryRecordBench(); )
DEF_BENCH( return new UniquePaintDictionaryRecordBench(); )
DEF_BENCH( return new RecurringPaintDictionaryRecordBench(); )

Просмотреть файл

@ -13,8 +13,7 @@
class PremulAndUnpremulAlphaOpsBench : public SkBenchmark {
public:
PremulAndUnpremulAlphaOpsBench(void* param, SkCanvas::Config8888 config)
: INHERITED(param) {
PremulAndUnpremulAlphaOpsBench(SkCanvas::Config8888 config) {
fUnPremulConfig = config;
fName.printf("premul_and_unpremul_alpha_%s",
(config == SkCanvas::kRGBA_Unpremul_Config8888) ?
@ -60,14 +59,6 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* fact0(void* p) {
return new PremulAndUnpremulAlphaOpsBench(p,
SkCanvas::kRGBA_Unpremul_Config8888);
}
static SkBenchmark* fact1(void* p) {
return new PremulAndUnpremulAlphaOpsBench(p,
SkCanvas::kNative_Unpremul_Config8888);
}
static BenchRegistry gReg0(fact0);
static BenchRegistry gReg1(fact1);
DEF_BENCH(return new PremulAndUnpremulAlphaOpsBench(SkCanvas::kRGBA_Unpremul_Config8888));
DEF_BENCH(return new PremulAndUnpremulAlphaOpsBench(SkCanvas::kNative_Unpremul_Config8888));

Просмотреть файл

@ -23,10 +23,9 @@ typedef SkIRect (*MakeRectProc)(SkRandom&, int, int);
// Time how long it takes to build an R-Tree either bulk-loaded or not
class BBoxBuildBench : public SkBenchmark {
public:
BBoxBuildBench(void* param, const char* name, MakeRectProc proc, bool bulkLoad,
BBoxBuildBench(const char* name, MakeRectProc proc, bool bulkLoad,
SkBBoxHierarchy* tree)
: INHERITED(param)
, fTree(tree)
: fTree(tree)
, fProc(proc)
, fBulkLoad(bulkLoad) {
fName.append("rtree_");
@ -73,10 +72,9 @@ public:
kFull_QueryType // queries that cover everything
};
BBoxQueryBench(void* param, const char* name, MakeRectProc proc, bool bulkLoad,
BBoxQueryBench(const char* name, MakeRectProc proc, bool bulkLoad,
QueryType q, SkBBoxHierarchy* tree)
: INHERITED(param)
, fTree(tree)
: fTree(tree)
, fProc(proc)
, fBulkLoad(bulkLoad)
, fQuery(q) {
@ -210,102 +208,82 @@ static inline SkIRect make_large_rects(SkRandom& rand, int index, int numRects)
///////////////////////////////////////////////////////////////////////////////
static inline SkBenchmark* Fact0(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "XYordered", &make_XYordered_rects, false,
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, false,
SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact1(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "XYordered", &make_XYordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, true,
SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact2(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "(unsorted)XYordered", &make_XYordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)XYordered", &make_XYordered_rects, true,
SkRTree::Create(5, 16, 1, false)));
}
static inline SkBenchmark* Fact3(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "XYordered", &make_XYordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("XYordered", &make_XYordered_rects, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact4(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "(unsorted)XYordered", &make_XYordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)XYordered", &make_XYordered_rects, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
}
)
static inline SkBenchmark* Fact5(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "YXordered", &make_YXordered_rects, false,
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects, false,
SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact6(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "YXordered", &make_YXordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects, true,
SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact7(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "(unsorted)YXordered", &make_YXordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)YXordered", &make_YXordered_rects, true,
SkRTree::Create(5, 16, 1, false)));
}
static inline SkBenchmark* Fact8(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "YXordered", &make_YXordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("YXordered", &make_YXordered_rects, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact9(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "(unsorted)YXordered", &make_YXordered_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)YXordered", &make_YXordered_rects, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
}
)
static inline SkBenchmark* Fact10(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "random", &make_random_rects, false,
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects, false,
SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact11(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "random", &make_random_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects, true,
SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact12(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "(unsorted)random", &make_random_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)random", &make_random_rects, true,
SkRTree::Create(5, 16, 1, false)));
}
static inline SkBenchmark* Fact13(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "random", &make_random_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("random", &make_random_rects, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact14(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "(unsorted)random", &make_random_rects, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)random", &make_random_rects, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
}
)
static inline SkBenchmark* Fact15(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "concentric",
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("concentric",
&make_concentric_rects_increasing, true, SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact16(void* p) {
return SkNEW_ARGS(BBoxBuildBench, (p, "(unsorted)concentric",
)
DEF_BENCH(
return SkNEW_ARGS(BBoxBuildBench, ("(unsorted)concentric",
&make_concentric_rects_increasing, true, SkRTree::Create(5, 16, 1, false)));
}
static inline SkBenchmark* Fact17(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "concentric", &make_concentric_rects_increasing, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_increasing, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)));
}
static inline SkBenchmark* Fact18(void* p) {
return SkNEW_ARGS(BBoxQueryBench, (p, "(unsorted)concentric", &make_concentric_rects_increasing, true,
)
DEF_BENCH(
return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_rects_increasing, true,
BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
}
static BenchRegistry gReg18(Fact18);
static BenchRegistry gReg17(Fact17);
static BenchRegistry gReg16(Fact16);
static BenchRegistry gReg15(Fact15);
static BenchRegistry gReg14(Fact14);
static BenchRegistry gReg13(Fact13);
static BenchRegistry gReg12(Fact12);
static BenchRegistry gReg11(Fact11);
static BenchRegistry gReg10(Fact10);
static BenchRegistry gReg9(Fact9);
static BenchRegistry gReg8(Fact8);
static BenchRegistry gReg7(Fact7);
static BenchRegistry gReg6(Fact6);
static BenchRegistry gReg5(Fact5);
static BenchRegistry gReg4(Fact4);
static BenchRegistry gReg3(Fact3);
static BenchRegistry gReg2(Fact2);
static BenchRegistry gReg1(Fact1);
static BenchRegistry gReg0(Fact0);
)

Просмотреть файл

@ -17,7 +17,7 @@
*/
class ReadPixBench : public SkBenchmark {
public:
ReadPixBench(void* param) : INHERITED(param) {}
ReadPixBench() {}
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -64,5 +64,4 @@ private:
////////////////////////////////////////////////////////////////////////////////
static SkBenchmark* fact(void* p) { return new ReadPixBench(p); }
static BenchRegistry gReg(fact);
DEF_BENCH( return new ReadPixBench(); )

Просмотреть файл

@ -26,9 +26,8 @@ public:
SkRect fRects[N];
SkColor fColors[N];
RectBench(void* param, int shift, int stroke = 0)
: INHERITED(param)
, fShift(shift)
RectBench(int shift, int stroke = 0)
: fShift(shift)
, fStroke(stroke) {
SkRandom rand;
const SkScalar offset = SK_Scalar1/3;
@ -81,7 +80,7 @@ private:
class SrcModeRectBench : public RectBench {
public:
SrcModeRectBench(void* param) : INHERITED(param, 1, 0) {
SrcModeRectBench() : INHERITED(1, 0) {
fMode = SkXfermode::Create(SkXfermode::kSrc_Mode);
}
@ -112,7 +111,7 @@ private:
class OvalBench : public RectBench {
public:
OvalBench(void* param, int shift, int stroke = 0) : RectBench(param, shift, stroke) {}
OvalBench(int shift, int stroke = 0) : RectBench(shift, stroke) {}
protected:
virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
c->drawOval(r, p);
@ -122,7 +121,7 @@ protected:
class RRectBench : public RectBench {
public:
RRectBench(void* param, int shift, int stroke = 0) : RectBench(param, shift, stroke) {}
RRectBench(int shift, int stroke = 0) : RectBench(shift, stroke) {}
protected:
virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) {
c->drawRoundRect(r, r.width() / 4, r.height() / 4, p);
@ -135,8 +134,9 @@ public:
SkCanvas::PointMode fMode;
const char* fName;
PointsBench(void* param, SkCanvas::PointMode mode, const char* name) :
RectBench(param, 2), fMode(mode) {
PointsBench(SkCanvas::PointMode mode, const char* name)
: RectBench(2)
, fMode(mode) {
fName = name;
}
@ -174,7 +174,7 @@ public:
H = 480,
};
AARectBench(void* param, bool rotate) : INHERITED(param), fRotate(rotate) {}
AARectBench(bool rotate) : fRotate(rotate) {}
protected:
@ -236,9 +236,9 @@ public:
SkCanvas::PointMode fMode;
const char* fName;
BlitMaskBench(void* param, SkCanvas::PointMode mode,
BlitMaskBench(SkCanvas::PointMode mode,
BlitMaskBench::kMaskType type, const char* name) :
RectBench(param, 2), fMode(mode), _type(type) {
RectBench(2), fMode(mode), _type(type) {
fName = name;
}
@ -302,42 +302,42 @@ private:
};
DEF_BENCH( return SkNEW_ARGS(RectBench, (p, 1)); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (p, 1, 4)); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (p, 3)); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (p, 3, 4)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (p, 1)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (p, 3)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (p, 1, 4)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (p, 3, 4)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (p, 1)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (p, 1, 4)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (p, 3)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (p, 3, 4)); )
DEF_BENCH( return SkNEW_ARGS(PointsBench, (p, SkCanvas::kPoints_PointMode, "points")); )
DEF_BENCH( return SkNEW_ARGS(PointsBench, (p, SkCanvas::kLines_PointMode, "lines")); )
DEF_BENCH( return SkNEW_ARGS(PointsBench, (p, SkCanvas::kPolygon_PointMode, "polygon")); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (1)); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (1, 4)); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (3)); )
DEF_BENCH( return SkNEW_ARGS(RectBench, (3, 4)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (1)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (3)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (1, 4)); )
DEF_BENCH( return SkNEW_ARGS(OvalBench, (3, 4)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (1)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (1, 4)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (3)); )
DEF_BENCH( return SkNEW_ARGS(RRectBench, (3, 4)); )
DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPoints_PointMode, "points")); )
DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kLines_PointMode, "lines")); )
DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPolygon_PointMode, "polygon")); )
DEF_BENCH( return SkNEW_ARGS(SrcModeRectBench, (p)); )
DEF_BENCH( return SkNEW_ARGS(SrcModeRectBench, ()); )
DEF_BENCH( return SkNEW_ARGS(AARectBench, (p, false)); )
DEF_BENCH( return SkNEW_ARGS(AARectBench, (p, true)); )
DEF_BENCH( return SkNEW_ARGS(AARectBench, (false)); )
DEF_BENCH( return SkNEW_ARGS(AARectBench, (true)); )
/* init the blitmask bench
*/
DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
(p, SkCanvas::kPoints_PointMode,
(SkCanvas::kPoints_PointMode,
BlitMaskBench::kMaskOpaque, "maskopaque")
); )
DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
(p, SkCanvas::kPoints_PointMode,
(SkCanvas::kPoints_PointMode,
BlitMaskBench::kMaskBlack, "maskblack")
); )
DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
(p, SkCanvas::kPoints_PointMode,
(SkCanvas::kPoints_PointMode,
BlitMaskBench::kMaskColor, "maskcolor")
); )
DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
(p, SkCanvas::kPoints_PointMode,
(SkCanvas::kPoints_PointMode,
BlitMaskBench::KMaskShader, "maskshader")
); )

Просмотреть файл

@ -16,7 +16,7 @@
// to create an inner blurred rect
class RectoriBench : public SkBenchmark {
public:
RectoriBench(void* param) : INHERITED(param) {}
RectoriBench() {}
protected:
@ -102,5 +102,4 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH( return SkNEW_ARGS(RectoriBench, (p)); )
DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); )

Просмотреть файл

@ -16,7 +16,7 @@ enum {
class RefCntBench_Stack : public SkBenchmark {
public:
RefCntBench_Stack(void* param) : INHERITED(param) {
RefCntBench_Stack() {
fIsRendering = false;
}
protected:
@ -53,7 +53,7 @@ SK_DEFINE_INST_COUNT(PlacedRefCnt)
class RefCntBench_Heap : public SkBenchmark {
public:
RefCntBench_Heap(void* param) : INHERITED(param) {
RefCntBench_Heap() {
fIsRendering = false;
}
protected:
@ -79,7 +79,7 @@ private:
class RefCntBench_New : public SkBenchmark {
public:
RefCntBench_New(void* param) : INHERITED(param) {
RefCntBench_New() {
fIsRendering = false;
}
protected:
@ -106,7 +106,7 @@ private:
class WeakRefCntBench_Stack : public SkBenchmark {
public:
WeakRefCntBench_Stack(void* param) : INHERITED(param) {
WeakRefCntBench_Stack() {
fIsRendering = false;
}
protected:
@ -136,7 +136,7 @@ public:
class WeakRefCntBench_Heap : public SkBenchmark {
public:
WeakRefCntBench_Heap(void* param) : INHERITED(param) {
WeakRefCntBench_Heap() {
fIsRendering = false;
}
protected:
@ -162,7 +162,7 @@ private:
class WeakRefCntBench_New : public SkBenchmark {
public:
WeakRefCntBench_New(void* param) : INHERITED(param) {
WeakRefCntBench_New() {
fIsRendering = false;
}
protected:
@ -187,18 +187,10 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact00(void* p) { return new RefCntBench_Stack(p); }
static SkBenchmark* Fact01(void* p) { return new RefCntBench_Heap(p); }
static SkBenchmark* Fact02(void* p) { return new RefCntBench_New(p); }
DEF_BENCH( return new RefCntBench_Stack(); )
DEF_BENCH( return new RefCntBench_Heap(); )
DEF_BENCH( return new RefCntBench_New(); )
static SkBenchmark* Fact10(void* p) { return new WeakRefCntBench_Stack(p); }
static SkBenchmark* Fact11(void* p) { return new WeakRefCntBench_Heap(p); }
static SkBenchmark* Fact12(void* p) { return new WeakRefCntBench_New(p); }
static BenchRegistry gReg00(Fact00);
static BenchRegistry gReg01(Fact01);
static BenchRegistry gReg02(Fact02);
static BenchRegistry gReg10(Fact10);
static BenchRegistry gReg11(Fact11);
static BenchRegistry gReg12(Fact12);
DEF_BENCH( return new WeakRefCntBench_Stack(); )
DEF_BENCH( return new WeakRefCntBench_Heap(); )
DEF_BENCH( return new WeakRefCntBench_New(); )

Просмотреть файл

@ -88,7 +88,7 @@ public:
return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1);
}
RegionBench(void* param, int count, Proc proc, const char name[]) : INHERITED(param) {
RegionBench(int count, Proc proc, const char name[]) {
fProc = proc;
fName.printf("region_%s_%d", name, count);
@ -116,22 +116,12 @@ private:
#define SMALL 16
static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, union_proc, "union")); }
static SkBenchmark* gF1(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sect_proc, "intersect")); }
static SkBenchmark* gF2(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diff_proc, "difference")); }
static SkBenchmark* gF3(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diffrect_proc, "differencerect")); }
static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diffrectbig_proc, "differencerectbig")); }
static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect")); }
static SkBenchmark* gF6(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrgn_proc, "intersectsrgn")); }
static SkBenchmark* gF7(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrect_proc, "intersectsrect")); }
static SkBenchmark* gF8(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsxy_proc, "containsxy")); }
static BenchRegistry gR0(gF0);
static BenchRegistry gR1(gF1);
static BenchRegistry gR2(gF2);
static BenchRegistry gR3(gF3);
static BenchRegistry gR4(gF4);
static BenchRegistry gR5(gF5);
static BenchRegistry gR6(gF6);
static BenchRegistry gR7(gF7);
static BenchRegistry gR8(gF8);
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, union_proc, "union")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, sect_proc, "intersect")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, diff_proc, "difference")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, diffrect_proc, "differencerect")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, diffrectbig_proc, "differencerectbig")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, containsrect_proc, "containsrect")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, sectsrgn_proc, "intersectsrgn")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, sectsrect_proc, "intersectsrect")); )
DEF_BENCH( return SkNEW_ARGS(RegionBench, (SMALL, containsxy_proc, "containsxy")); )

Просмотреть файл

@ -33,7 +33,7 @@ public:
return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT);
}
RegionContainBench(void* param, Proc proc, const char name[]) : INHERITED(param) {
RegionContainBench(Proc proc, const char name[]) {
fProc = proc;
fName.printf("region_contains_%s", name);
@ -62,6 +62,4 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionContainBench, (p, sect_proc, "sect")); }
static BenchRegistry gR0(gF0);
DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); )

Просмотреть файл

@ -90,7 +90,7 @@ class RepeatTileBench : public SkBenchmark {
bool fIsOpaque;
SkBitmap::Config fConfig;
public:
RepeatTileBench(void* param, SkBitmap::Config c, bool isOpaque = false) : INHERITED(param) {
RepeatTileBench(SkBitmap::Config c, bool isOpaque = false) {
const int w = 50;
const int h = 50;
fConfig = c;
@ -143,7 +143,7 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_8888_Config, true))
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kARGB_8888_Config, false))
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kRGB_565_Config))
DEF_BENCH(return new RepeatTileBench(p, SkBitmap::kIndex8_Config))
DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, true))
DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, false))
DEF_BENCH(return new RepeatTileBench(SkBitmap::kRGB_565_Config))
DEF_BENCH(return new RepeatTileBench(SkBitmap::kIndex8_Config))

Просмотреть файл

@ -14,7 +14,7 @@
class ScalarBench : public SkBenchmark {
SkString fName;
public:
ScalarBench(void* param, const char name[]) : INHERITED(param) {
ScalarBench(const char name[]) {
fName.printf("scalar_%s", name);
fIsRendering = false;
}
@ -62,7 +62,7 @@ template <typename T> void init9(T array[9]) {
class FloatComparisonBench : public ScalarBench {
public:
FloatComparisonBench(void* param) : INHERITED(param, "compare_float") {
FloatComparisonBench() : INHERITED("compare_float") {
init9(fArray);
}
protected:
@ -78,8 +78,8 @@ private:
class ForcedIntComparisonBench : public ScalarBench {
public:
ForcedIntComparisonBench(void* param)
: INHERITED(param, "compare_forced_int") {
ForcedIntComparisonBench()
: INHERITED("compare_forced_int") {
init9(fArray);
}
protected:
@ -99,7 +99,7 @@ private:
class IsFiniteScalarBench : public ScalarBench {
public:
IsFiniteScalarBench(void* param) : INHERITED(param, "isfinite") {
IsFiniteScalarBench() : INHERITED("isfinite") {
SkRandom rand;
for (size_t i = 0; i < ARRAY_N; ++i) {
fArray[i] = rand.nextSScalar1();
@ -137,7 +137,7 @@ class RectBoundsBench : public SkBenchmark {
SkPoint fPts[PTS];
public:
RectBoundsBench(void* param) : INHERITED(param) {
RectBoundsBench() {
SkRandom rand;
for (int i = 0; i < PTS; ++i) {
fPts[i].fX = rand.nextSScalar1();
@ -164,12 +164,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* S0(void* p) { return new FloatComparisonBench(p); }
static SkBenchmark* S1(void* p) { return new ForcedIntComparisonBench(p); }
static SkBenchmark* S2(void* p) { return new RectBoundsBench(p); }
static SkBenchmark* S3(void* p) { return new IsFiniteScalarBench(p); }
static BenchRegistry gReg0(S0);
static BenchRegistry gReg1(S1);
static BenchRegistry gReg2(S2);
static BenchRegistry gReg3(S3);
DEF_BENCH( return new FloatComparisonBench(); )
DEF_BENCH( return new ForcedIntComparisonBench(); )
DEF_BENCH( return new RectBoundsBench(); )
DEF_BENCH( return new IsFiniteScalarBench(); )

Просмотреть файл

@ -38,7 +38,7 @@ class ShaderMaskBench : public SkBenchmark {
SkString fName;
FontQuality fFQ;
public:
ShaderMaskBench(void* param, bool isOpaque, FontQuality fq) : INHERITED(param) {
ShaderMaskBench(bool isOpaque, FontQuality fq) {
fFQ = fq;
fText.set(STR);
@ -91,16 +91,9 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact00(void* p) { return new ShaderMaskBench(p, true, kBW); }
static SkBenchmark* Fact01(void* p) { return new ShaderMaskBench(p, false, kBW); }
static SkBenchmark* Fact10(void* p) { return new ShaderMaskBench(p, true, kAA); }
static SkBenchmark* Fact11(void* p) { return new ShaderMaskBench(p, false, kAA); }
static SkBenchmark* Fact20(void* p) { return new ShaderMaskBench(p, true, kLCD); }
static SkBenchmark* Fact21(void* p) { return new ShaderMaskBench(p, false, kLCD); }
static BenchRegistry gReg00(Fact00);
static BenchRegistry gReg01(Fact01);
static BenchRegistry gReg10(Fact10);
static BenchRegistry gReg11(Fact11);
static BenchRegistry gReg20(Fact20);
static BenchRegistry gReg21(Fact21);
DEF_BENCH( return new ShaderMaskBench(true, kBW); )
DEF_BENCH( return new ShaderMaskBench(false, kBW); )
DEF_BENCH( return new ShaderMaskBench(true, kAA); )
DEF_BENCH( return new ShaderMaskBench(false, kAA); )
DEF_BENCH( return new ShaderMaskBench(true, kLCD); )
DEF_BENCH( return new ShaderMaskBench(false, kLCD); )

Просмотреть файл

@ -15,7 +15,7 @@ SK_DEFINE_INST_COUNT(SkBenchmark)
template BenchRegistry* BenchRegistry::gHead;
SkBenchmark::SkBenchmark(void* /*ignored*/) {
SkBenchmark::SkBenchmark() {
fForceAlpha = 0xFF;
fForceAA = true;
fDither = SkTriState::kDefault;

Просмотреть файл

@ -13,16 +13,16 @@
#include "SkTRegistry.h"
#define DEF_BENCH(code) \
static SkBenchmark* SK_MACRO_APPEND_LINE(F_)(void* p) { code; } \
static SkBenchmark* SK_MACRO_APPEND_LINE(F_)() { code; } \
static BenchRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_));
/*
* With the above macros, you can register benches as follows (at the bottom
* of your .cpp)
*
* DEF_BENCH(new MyBenchmark(p, ...))
* DEF_BENCH(new MyBenchmark(p, ...))
* DEF_BENCH(new MyBenchmark(p, ...))
* DEF_BENCH(return new MyBenchmark(...))
* DEF_BENCH(return new MyBenchmark(...))
* DEF_BENCH(return new MyBenchmark(...))
*/
@ -43,7 +43,7 @@ class SkBenchmark : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkBenchmark)
SkBenchmark(void* defineDict);
SkBenchmark();
const char* getName();
SkIPoint getSize();
@ -129,6 +129,6 @@ private:
typedef SkRefCnt INHERITED;
};
typedef SkTRegistry<SkBenchmark*(*)(void*)> BenchRegistry;
typedef SkTRegistry<SkBenchmark*(*)()> BenchRegistry;
#endif

Просмотреть файл

@ -104,7 +104,7 @@ class SortBench : public SkBenchmark {
SortProc fSortProc;
public:
SortBench(void* param, Type t, int n, SortType s) : INHERITED(param) {
SortBench(Type t, int n, SortType s) {
if (n > MAX) {
n = MAX;
}
@ -138,32 +138,32 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* NewSkQSort(void* param, Type t) {
return new SortBench(param, t, N, kSKQSort);
static SkBenchmark* NewSkQSort(Type t) {
return new SortBench(t, N, kSKQSort);
}
static SkBenchmark* NewSkHeap(void* param, Type t) {
return new SortBench(param, t, N, kSKHeap);
static SkBenchmark* NewSkHeap(Type t) {
return new SortBench(t, N, kSKHeap);
}
static SkBenchmark* NewQSort(void* param, Type t) {
return new SortBench(param, t, N, kQSort);
static SkBenchmark* NewQSort(Type t) {
return new SortBench(t, N, kQSort);
}
DEF_BENCH( return NewSkQSort(p, kRand); )
DEF_BENCH( return NewSkHeap(p, kRand); )
DEF_BENCH( return NewQSort(p, kRand); )
DEF_BENCH( return NewSkQSort(kRand); )
DEF_BENCH( return NewSkHeap(kRand); )
DEF_BENCH( return NewQSort(kRand); )
DEF_BENCH( return NewSkQSort(p, kRandN); )
DEF_BENCH( return NewSkHeap(p, kRandN); )
DEF_BENCH( return NewQSort(p, kRandN); )
DEF_BENCH( return NewSkQSort(kRandN); )
DEF_BENCH( return NewSkHeap(kRandN); )
DEF_BENCH( return NewQSort(kRandN); )
DEF_BENCH( return NewSkQSort(p, kFore); )
DEF_BENCH( return NewSkHeap(p, kFore); )
DEF_BENCH( return NewQSort(p, kFore); )
DEF_BENCH( return NewSkQSort(kFore); )
DEF_BENCH( return NewSkHeap(kFore); )
DEF_BENCH( return NewQSort(kFore); )
DEF_BENCH( return NewSkQSort(p, kBack); )
DEF_BENCH( return NewSkHeap(p, kBack); )
DEF_BENCH( return NewQSort(p, kBack); )
DEF_BENCH( return NewSkQSort(kBack); )
DEF_BENCH( return NewSkHeap(kBack); )
DEF_BENCH( return NewQSort(kBack); )
DEF_BENCH( return NewSkQSort(p, kSame); )
DEF_BENCH( return NewSkHeap(p, kSame); )
DEF_BENCH( return NewQSort(p, kSame); )
DEF_BENCH( return NewSkQSort(kSame); )
DEF_BENCH( return NewSkHeap(kSame); )
DEF_BENCH( return NewQSort(kSame); )

Просмотреть файл

@ -59,7 +59,7 @@ class StrokeRRectBench : public SkBenchmark {
RRectRec fRec;
DrawProc fProc;
public:
StrokeRRectBench(void* param, SkPaint::Join j, DrawProc proc) : SkBenchmark(param) {
StrokeRRectBench(SkPaint::Join j, DrawProc proc) {
static const char* gJoinName[] = {
"miter", "round", "bevel"
};
@ -91,14 +91,14 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kRound_Join, draw_rect); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kBevel_Join, draw_rect); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kMiter_Join, draw_rect); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rect); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rect); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rect); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kRound_Join, draw_rrect); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kBevel_Join, draw_rrect); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kMiter_Join, draw_rrect); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rrect); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_rrect); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_rrect); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kRound_Join, draw_oval); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kBevel_Join, draw_oval); )
DEF_BENCH( return new StrokeRRectBench(p, SkPaint::kMiter_Join, draw_oval); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_oval); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kBevel_Join, draw_oval); )
DEF_BENCH( return new StrokeRRectBench(SkPaint::kMiter_Join, draw_oval); )

Просмотреть файл

@ -28,10 +28,6 @@ public:
static const int kNumRows = 48;
static const int kNumCols = 32;
TableBench(void* param)
: INHERITED(param) {
}
protected:
virtual const char* onGetName() {
return "tablebench";
@ -73,6 +69,4 @@ private:
typedef SkBenchmark INHERITED;
};
static SkBenchmark* gFactory(void* p) { return new TableBench(p); }
static BenchRegistry gRegistry(gFactory);
DEF_BENCH( return new TableBench(); )

Просмотреть файл

@ -46,8 +46,8 @@ class TextBench : public SkBenchmark {
bool fDoPos;
SkPoint* fPos;
public:
TextBench(void* param, const char text[], int ps,
SkColor color, FontQuality fq, bool doPos = false) : INHERITED(param) {
TextBench(const char text[], int ps,
SkColor color, FontQuality fq, bool doPos = false) {
fPos = NULL;
fFQ = fq;
fDoPos = doPos;
@ -130,30 +130,16 @@ private:
#define STR "Hamburgefons"
static SkBenchmark* Fact01(void* p) { return new TextBench(p, STR, 16, 0xFF000000, kBW); }
static SkBenchmark* Fact02(void* p) { return new TextBench(p, STR, 16, 0xFFFF0000, kBW); }
static SkBenchmark* Fact03(void* p) { return new TextBench(p, STR, 16, 0x88FF0000, kBW); }
DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW); )
DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kBW); )
DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kBW); )
static SkBenchmark* Fact11(void* p) { return new TextBench(p, STR, 16, 0xFF000000, kAA); }
static SkBenchmark* Fact12(void* p) { return new TextBench(p, STR, 16, 0xFFFF0000, kAA); }
static SkBenchmark* Fact13(void* p) { return new TextBench(p, STR, 16, 0x88FF0000, kAA); }
DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA); )
DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kAA); )
DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kAA); )
static SkBenchmark* Fact21(void* p) { return new TextBench(p, STR, 16, 0xFF000000, kLCD); }
static SkBenchmark* Fact22(void* p) { return new TextBench(p, STR, 16, 0xFFFF0000, kLCD); }
static SkBenchmark* Fact23(void* p) { return new TextBench(p, STR, 16, 0x88FF0000, kLCD); }
DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kLCD); )
DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kLCD); )
DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kLCD); )
static SkBenchmark* Fact111(void* p) { return new TextBench(p, STR, 16, 0xFF000000, kAA, true); }
static BenchRegistry gReg01(Fact01);
static BenchRegistry gReg02(Fact02);
static BenchRegistry gReg03(Fact03);
static BenchRegistry gReg11(Fact11);
static BenchRegistry gReg12(Fact12);
static BenchRegistry gReg13(Fact13);
static BenchRegistry gReg21(Fact21);
static BenchRegistry gReg22(Fact22);
static BenchRegistry gReg23(Fact23);
static BenchRegistry gReg111(Fact111);
DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA, true); )

Просмотреть файл

@ -38,14 +38,12 @@ class ConstXTileBench : public SkBenchmark {
static const int kHeight = 300;
public:
ConstXTileBench(void* param,
SkShader::TileMode xTile,
ConstXTileBench(SkShader::TileMode xTile,
SkShader::TileMode yTile,
bool doFilter,
bool doTrans,
bool doScale)
: INHERITED(param)
, fDoFilter(doFilter)
: fDoFilter(doFilter)
, fDoTrans(doTrans)
, fDoScale(doScale) {
SkBitmap bm;
@ -118,18 +116,18 @@ private:
typedef SkBenchmark INHERITED;
};
DEF_BENCH(return new ConstXTileBench(p, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, false, false, true))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, false, false, false))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, false, false, true))
DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, false, false, true))
DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, false, false, false))
DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, false, false, true))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, true, false, false))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, true, false, true))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, true, false, false))
DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, true, false, false))
DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, true, false, true))
DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, true, false, false))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, false, true, true))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, false, true, false))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, false, true, true))
DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, false, true, true))
DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, false, true, false))
DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, false, true, true))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, true, true, false))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, true, true, true))
DEF_BENCH(return new ConstXTileBench(p, SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, true, true, false))
DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, true, true, false))
DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, true, true, true))
DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirror_TileMode, true, true, false))

Просмотреть файл

@ -39,7 +39,7 @@ class VertBench : public SkBenchmark {
}
public:
VertBench(void* param) : INHERITED(param) {
VertBench() {
const SkScalar dx = SkIntToScalar(W) / COL;
const SkScalar dy = SkIntToScalar(H) / COL;
@ -92,6 +92,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
static SkBenchmark* Fact(void* p) { return SkNEW_ARGS(VertBench, (p)); }
static BenchRegistry gReg(Fact);
DEF_BENCH( return SkNEW_ARGS(VertBench, ()); )

Просмотреть файл

@ -13,9 +13,8 @@
class WritePixelsBench : public SkBenchmark {
public:
WritePixelsBench(void* param, SkCanvas::Config8888 config)
: INHERITED(param)
, fConfig(config)
WritePixelsBench(SkCanvas::Config8888 config)
: fConfig(config)
, fName("writepix") {
switch (config) {
case SkCanvas::kNative_Premul_Config8888:
@ -70,5 +69,5 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (p, SkCanvas::kRGBA_Premul_Config8888)); )
DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (p, SkCanvas::kRGBA_Unpremul_Config8888)); )
DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (SkCanvas::kRGBA_Premul_Config8888)); )
DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (SkCanvas::kRGBA_Unpremul_Config8888)); )

Просмотреть файл

@ -12,9 +12,7 @@
class WriterBench : public SkBenchmark {
public:
WriterBench(void* param) : INHERITED(param) {
fIsRendering = false;
}
WriterBench() { fIsRendering = false; }
protected:
virtual const char* onGetName() SK_OVERRIDE {
@ -38,5 +36,4 @@ private:
////////////////////////////////////////////////////////////////////////////////
static SkBenchmark* fact(void* p) { return new WriterBench(p); }
static BenchRegistry gReg(fact);
DEF_BENCH( return new WriterBench(); )

Просмотреть файл

@ -17,14 +17,13 @@
// Benchmark that draws non-AA rects with an SkXfermode::Mode
class XfermodeBench : public SkBenchmark {
public:
XfermodeBench(void* param, SkXfermode::Mode mode) : SkBenchmark(param) {
XfermodeBench(SkXfermode::Mode mode) {
fXfermode.reset(SkXfermode::Create(mode));
SkASSERT(NULL != fXfermode.get() || SkXfermode::kSrcOver_Mode == mode);
fName.printf("Xfermode_%s", SkXfermode::ModeName(mode));
}
XfermodeBench(void* param, SkXfermode* xferMode, const char* name)
: SkBenchmark(param) {
XfermodeBench(SkXfermode* xferMode, const char* name) {
SkASSERT(NULL != xferMode);
fXfermode.reset(xferMode);
fName.printf("Xfermode_%s", name);
@ -68,8 +67,8 @@ private:
#define CONCAT_I(x, y) x ## y
#define CONCAT(x, y) CONCAT_I(x, y) // allow for macro expansion
#define BENCH(...) \
static SkBenchmark* CONCAT(Fact, __LINE__)(void *p) { return new XfermodeBench(p, __VA_ARGS__); };\
static BenchRegistry CONCAT(gReg, __LINE__)(CONCAT(Fact, __LINE__));
DEF_BENCH( return new XfermodeBench(__VA_ARGS__); );\
BENCH(SkXfermode::kClear_Mode)
BENCH(SkXfermode::kSrc_Mode)

Просмотреть файл

@ -57,7 +57,7 @@ public:
if (fBench) {
BenchRegistry::Factory f = fBench->factory();
fBench = fBench->next();
return f(NULL);
return f();
}
return NULL;
}