diff options
author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:09:54 +0000 |
---|---|---|
committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:09:54 +0000 |
commit | fbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (patch) | |
tree | d8b4815d15946c32ee9d254e932411e93be942bb /bench | |
parent | 2abed834789bb64c7da740df4c47efc142b7311a (diff) |
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part I of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6485054
git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench')
-rw-r--r-- | bench/AAClipBench.cpp | 20 | ||||
-rw-r--r-- | bench/BenchGpuTimer_gl.cpp | 6 | ||||
-rw-r--r-- | bench/BenchSysTimer_mach.cpp | 6 | ||||
-rw-r--r-- | bench/BenchSysTimer_windows.cpp | 4 | ||||
-rw-r--r-- | bench/BenchTimer.h | 2 | ||||
-rw-r--r-- | bench/BitmapBench.cpp | 32 | ||||
-rw-r--r-- | bench/BlurBench.cpp | 6 | ||||
-rw-r--r-- | bench/DashBench.cpp | 22 | ||||
-rw-r--r-- | bench/DecodeBench.cpp | 2 | ||||
-rw-r--r-- | bench/DeferredCanvasBench.cpp | 2 | ||||
-rw-r--r-- | bench/GrMemoryPoolBench.cpp | 2 | ||||
-rw-r--r-- | bench/GradientBench.cpp | 10 | ||||
-rw-r--r-- | bench/InterpBench.cpp | 26 | ||||
-rw-r--r-- | bench/MathBench.cpp | 46 | ||||
-rw-r--r-- | bench/MatrixBench.cpp | 28 | ||||
-rw-r--r-- | bench/MemoryBench.cpp | 8 | ||||
-rw-r--r-- | bench/MorphologyBench.cpp | 10 | ||||
-rw-r--r-- | bench/PathBench.cpp | 10 | ||||
-rw-r--r-- | bench/PathIterBench.cpp | 4 | ||||
-rw-r--r-- | bench/RectBench.cpp | 18 | ||||
-rw-r--r-- | bench/RegionBench.cpp | 2 | ||||
-rw-r--r-- | bench/RepeatTileBench.cpp | 8 | ||||
-rw-r--r-- | bench/ShaderMaskBench.cpp | 4 | ||||
-rw-r--r-- | bench/SkBenchmark.h | 6 | ||||
-rw-r--r-- | bench/VertBench.cpp | 4 | ||||
-rw-r--r-- | bench/benchmain.cpp | 30 |
26 files changed, 159 insertions, 159 deletions
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp index ce91b2cf91..f85af68395 100644 --- a/bench/AAClipBench.cpp +++ b/bench/AAClipBench.cpp @@ -28,7 +28,7 @@ class AAClipBench : public SkBenchmark { }; public: - AAClipBench(void* param, bool doPath, bool doAA) + AAClipBench(void* param, bool doPath, bool doAA) : INHERITED(param) , fDoPath(doPath) , fDoAA(doAA) { @@ -37,7 +37,7 @@ public: doPath ? "path" : "rect", doAA ? "AA" : "BW"); - fClipRect.set(SkFloatToScalar(10.5f), SkFloatToScalar(10.5f), + fClipRect.set(SkFloatToScalar(10.5f), SkFloatToScalar(10.5f), SkFloatToScalar(50.5f), SkFloatToScalar(50.5f)); fClipPath.addRoundRect(fClipRect, SkIntToScalar(10), SkIntToScalar(10)); fDrawRect.set(SkIntToScalar(0), SkIntToScalar(0), @@ -57,7 +57,7 @@ protected: // jostle the clip regions each time to prevent caching fClipRect.offset((i % 2) == 0 ? SkIntToScalar(10) : SkIntToScalar(-10), 0); fClipPath.reset(); - fClipPath.addRoundRect(fClipRect, + fClipPath.addRoundRect(fClipRect, SkIntToScalar(5), SkIntToScalar(5)); SkASSERT(fClipPath.isConvex()); @@ -103,14 +103,14 @@ class NestedAAClipBench : public SkBenchmark { SkPoint fSizes[kNestingDepth+1]; public: - NestedAAClipBench(void* param, bool doAA) + NestedAAClipBench(void* param, bool doAA) : INHERITED(param) , fDoAA(doAA) { fName.printf("nested_aaclip_%s", doAA ? "AA" : "BW"); - fDrawRect = SkRect::MakeLTRB(0, 0, - SkIntToScalar(kImageSize), + fDrawRect = SkRect::MakeLTRB(0, 0, + SkIntToScalar(kImageSize), SkIntToScalar(kImageSize)); fSizes[0].set(SkIntToScalar(kImageSize), SkIntToScalar(kImageSize)); @@ -124,13 +124,13 @@ protected: virtual const char* onGetName() { return fName.c_str(); } - void recurse(SkCanvas* canvas, + void recurse(SkCanvas* canvas, int depth, const SkPoint& offset) { canvas->save(); - SkRect temp = SkRect::MakeLTRB(0, 0, + SkRect temp = SkRect::MakeLTRB(0, 0, fSizes[depth].fX, fSizes[depth].fY); temp.offset(offset); @@ -138,8 +138,8 @@ protected: path.addRoundRect(temp, SkIntToScalar(3), SkIntToScalar(3)); SkASSERT(path.isConvex()); - canvas->clipPath(path, - 0 == depth ? SkRegion::kReplace_Op : + canvas->clipPath(path, + 0 == depth ? SkRegion::kReplace_Op : SkRegion::kIntersect_Op, fDoAA); diff --git a/bench/BenchGpuTimer_gl.cpp b/bench/BenchGpuTimer_gl.cpp index 32909832f3..699f5e54cf 100644 --- a/bench/BenchGpuTimer_gl.cpp +++ b/bench/BenchGpuTimer_gl.cpp @@ -17,7 +17,7 @@ BenchGpuTimer::BenchGpuTimer(const SkGLContext* glctx) { fSupported = GrGLGetVersion(glctx->gl()) > GR_GL_VER(3,3) || GrGLHasExtension(glctx->gl(), "GL_ARB_timer_query") || GrGLHasExtension(glctx->gl(), "GL_EXT_timer_query"); - + if (fSupported) { SK_GL(*glctx, GenQueries(1, &fQuery)); } @@ -48,7 +48,7 @@ double BenchGpuTimer::endGpu() { fStarted = false; fContext->makeCurrent(); SK_GL(*fContext, EndQuery(GR_GL_TIME_ELAPSED)); - + GrGLint available = 0; while (!available) { SK_GL(*fContext, GetQueryObjectiv(fQuery, @@ -59,7 +59,7 @@ double BenchGpuTimer::endGpu() { SK_GL(*fContext, GetQueryObjectui64v(fQuery, GR_GL_QUERY_RESULT, &totalGPUTimeElapsed)); - + return totalGPUTimeElapsed / 1000000.0; } else { return 0; diff --git a/bench/BenchSysTimer_mach.cpp b/bench/BenchSysTimer_mach.cpp index c837ca34a0..cf3f1c1f7d 100644 --- a/bench/BenchSysTimer_mach.cpp +++ b/bench/BenchSysTimer_mach.cpp @@ -17,7 +17,7 @@ static time_value_t macCpuTime() { time_value_t none = {0, 0}; return none; } - + task_thread_times_info thread_info_data; mach_msg_type_number_t thread_info_count = TASK_THREAD_TIMES_INFO_COUNT; if (KERN_SUCCESS != task_info(task, @@ -28,7 +28,7 @@ static time_value_t macCpuTime() { time_value_t none = {0, 0}; return none; } - + time_value_add(&thread_info_data.user_time, &thread_info_data.system_time) return thread_info_data.user_time; } @@ -63,7 +63,7 @@ double BenchSysTimer::endCpu() { } double BenchSysTimer::endWall() { uint64_t end_wall = mach_absolute_time(); - + uint64_t elapsed = end_wall - this->fStartWall; mach_timebase_info_data_t sTimebaseInfo; if (KERN_SUCCESS != mach_timebase_info(&sTimebaseInfo)) { diff --git a/bench/BenchSysTimer_windows.cpp b/bench/BenchSysTimer_windows.cpp index 3635ec5470..1c4e4049c8 100644 --- a/bench/BenchSysTimer_windows.cpp +++ b/bench/BenchSysTimer_windows.cpp @@ -49,10 +49,10 @@ double BenchSysTimer::endWall() { if (0 == ::QueryPerformanceCounter(&end_wall)) { end_wall.QuadPart = 0; } - + LARGE_INTEGER ticks_elapsed; ticks_elapsed.QuadPart = end_wall.QuadPart - this->fStartWall.QuadPart; - + LARGE_INTEGER frequency; if (0 == ::QueryPerformanceFrequency(&frequency)) { return 0.0L; diff --git a/bench/BenchTimer.h b/bench/BenchTimer.h index a00707c9dc..70675ad17f 100644 --- a/bench/BenchTimer.h +++ b/bench/BenchTimer.h @@ -30,7 +30,7 @@ public: double fCpu; double fWall; double fGpu; - + private: BenchSysTimer *fSysTimer; #if SK_SUPPORT_GPU diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp index 40a733d35a..5f06f884a8 100644 --- a/bench/BitmapBench.cpp +++ b/bench/BitmapBench.cpp @@ -31,7 +31,7 @@ static void drawIntoBitmap(const SkBitmap& bm) { p.setColor(SK_ColorRED); canvas.drawCircle(SkIntToScalar(w)/2, SkIntToScalar(h)/2, SkIntToScalar(SkMin32(w, h))*3/8, p); - + SkRect r; r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); p.setStyle(SkPaint::kStroke_Style); @@ -52,7 +52,7 @@ static uint8_t compute666Index(SkPMColor c) { int r = SkGetPackedR32(c); int g = SkGetPackedG32(c); int b = SkGetPackedB32(c); - + return convByteTo6(r) * 36 + convByteTo6(g) * 6 + convByteTo6(b); } @@ -74,7 +74,7 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst) { dst->setConfig(SkBitmap::kIndex8_Config, src.width(), src.height()); dst->allocPixels(ctable); ctable->unref(); - + SkAutoLockPixels alps(src); SkAutoLockPixels alpd(*dst); @@ -88,12 +88,12 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst) { } /* Variants for bitmaps - + - src depth (32 w+w/o alpha), 565, 4444, index, a8 - paint options: filtering, dither, alpha - matrix options: translate, scale, rotate, persp - tiling: none, repeat, mirror, clamp - + */ class BitmapBench : public SkBenchmark { @@ -106,7 +106,7 @@ class BitmapBench : public SkBenchmark { enum { N = SkBENCHLOOP(300) }; public: BitmapBench(void* param, bool isOpaque, SkBitmap::Config c, - bool forceUpdate = false, bool bitmapVolatile = false, + bool forceUpdate = false, bool bitmapVolatile = false, int tx = -1, int ty = -1) : INHERITED(param), fIsOpaque(isOpaque), fForceUpdate(forceUpdate), fTileX(tx), fTileY(ty) { const int w = 128; @@ -120,7 +120,7 @@ public: } bm.allocPixels(); bm.eraseColor(isOpaque ? SK_ColorBLACK : 0); - + drawIntoBitmap(bm); if (SkBitmap::kIndex8_Config == c) { @@ -147,7 +147,7 @@ protected: } fName.appendf("_%s%s", gConfigName[fBitmap.config()], fIsOpaque ? "" : "_A"); - if (fForceUpdate) + if (fForceUpdate) fName.append("_update"); if (fBitmap.isVolatile()) fName.append("_volatile"); @@ -165,7 +165,7 @@ protected: const SkBitmap& bitmap = fBitmap; const SkScalar x0 = SkIntToScalar(-bitmap.width() / 2); const SkScalar y0 = SkIntToScalar(-bitmap.height() / 2); - + for (int i = 0; i < N; i++) { SkScalar x = x0 + rand.nextUScalar1() * dim.fX; SkScalar y = y0 + rand.nextUScalar1() * dim.fY; @@ -192,7 +192,7 @@ class FilterBitmapBench : public BitmapBench { enum { N = SkBENCHLOOP(300) }; public: FilterBitmapBench(void* param, bool isOpaque, SkBitmap::Config c, - bool forceUpdate = false, bool bitmapVolatile = false, + bool forceUpdate = false, bool bitmapVolatile = false, int tx = -1, int ty = -1, bool addScale = false, bool addRotate = false, bool addFilter = false) : INHERITED(param, isOpaque, c, forceUpdate, bitmapVolatile, tx, ty) @@ -203,11 +203,11 @@ public: protected: virtual const char* onGetName() { fFullName.set(INHERITED::onGetName()); - if (fScale) + if (fScale) fFullName.append("_scale"); - if (fRotate) + if (fRotate) fFullName.append("_rotate"); - if (fFilter) + if (fFilter) fFullName.append("_filter"); return fFullName.c_str(); @@ -218,7 +218,7 @@ protected: if (fScale) { const SkScalar x = SkIntToScalar(dim.fWidth) / 2; const SkScalar y = SkIntToScalar(dim.fHeight) / 2; - + canvas->translate(x, y); // just enough so we can't take the sprite case canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); @@ -227,7 +227,7 @@ protected: if (fRotate) { const SkScalar x = SkIntToScalar(dim.fWidth) / 2; const SkScalar y = SkIntToScalar(dim.fHeight) / 2; - + canvas->translate(x, y); canvas->rotate(SkIntToScalar(35)); canvas->translate(-x, -y); @@ -251,7 +251,7 @@ static SkBenchmark* Fact6(void* p) { return new BitmapBench(p, true, SkBitmap::k static SkBenchmark* Fact7(void* p) { return new BitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, true); } static SkBenchmark* Fact8(void* p) { return new BitmapBench(p, 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 +// scale filter -> S32_opaque_D32_filter_DX_{SSE2,SSSE3} and Fact9 is also for S32_D16_filter_DX_SSE2 static SkBenchmark* Fact9(void* p) { return new FilterBitmapBench(p, false, SkBitmap::kARGB_8888_Config, false, false, -1, -1, true, false, true); } static SkBenchmark* Fact10(void* p) { return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, false, false, -1, -1, true, false, true); } static SkBenchmark* Fact11(void* p) { return new FilterBitmapBench(p, true, SkBitmap::kARGB_8888_Config, true, true, -1, -1, true, false, true); } diff --git a/bench/BlurBench.cpp b/bench/BlurBench.cpp index de78fe1f9a..371e26db41 100644 --- a/bench/BlurBench.cpp +++ b/bench/BlurBench.cpp @@ -40,12 +40,12 @@ public: fName.printf("blur_%d_%s", SkScalarRound(rad), name); } } - + protected: virtual const char* onGetName() { return fName.c_str(); } - + virtual void onDraw(SkCanvas* canvas) { SkPaint paint; this->setupPaint(&paint); @@ -65,7 +65,7 @@ protected: canvas->drawOval(r, paint); } } - + private: typedef SkBenchmark INHERITED; }; diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp index 215581603e..a47aa71cd8 100644 --- a/bench/DashBench.cpp +++ b/bench/DashBench.cpp @@ -50,7 +50,7 @@ public: fWidth = width; fName.printf("dash_%d_%s", width, doClip ? "clipped" : "noclip"); fDoClip = doClip; - + fPts[0].set(SkIntToScalar(10), SkIntToScalar(10)); fPts[1].set(SkIntToScalar(600), SkIntToScalar(10)); } @@ -106,7 +106,7 @@ public: : INHERITED(param, intervals, count, width) { fName.append("_rect"); } - + protected: virtual void handlePath(SkCanvas* canvas, const SkPath& path, const SkPaint& paint, int N) SK_OVERRIDE { @@ -119,14 +119,14 @@ protected: rect.fTop = pts[0].fY - paint.getStrokeWidth() / 2; rect.fRight = rect.fLeft + SkIntToScalar(fWidth); rect.fBottom = rect.fTop + paint.getStrokeWidth(); - + SkPaint p(paint); p.setStyle(SkPaint::kFill_Style); p.setPathEffect(NULL); - + int count = SkScalarRoundToInt((pts[1].fX - pts[0].fX) / (2*fWidth)); SkScalar dx = SkIntToScalar(2 * fWidth); - + for (int i = 0; i < N*10; ++i) { SkRect r = rect; for (int j = 0; j < count; ++j) { @@ -136,7 +136,7 @@ protected: } } } - + private: typedef DashBench INHERITED; }; @@ -144,7 +144,7 @@ private: static void make_unit_star(SkPath* path, int n) { SkScalar rad = -SK_ScalarPI / 2; const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; - + path->moveTo(0, -SK_Scalar1); for (int i = 1; i < n; i++) { rad += drad; @@ -191,7 +191,7 @@ public: MakeDashBench(void* param, void (*proc)(SkPath*), const char name[]) : INHERITED(param) { fName.printf("makedash_%s", name); proc(&fPath); - + SkScalar vals[] = { SkIntToScalar(4), SkIntToScalar(4) }; fPE.reset(new SkDashPathEffect(vals, 2, 0)); } @@ -200,17 +200,17 @@ protected: virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); } - + virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { SkPath dst; for (int i = 0; i < N; ++i) { SkStrokeRec rec(SkStrokeRec::kHairline_InitStyle); - + fPE->filterPath(&dst, fPath, &rec); dst.rewind(); } } - + private: typedef SkBenchmark INHERITED; }; diff --git a/bench/DecodeBench.cpp b/bench/DecodeBench.cpp index 676169059f..c85b715edb 100644 --- a/bench/DecodeBench.cpp +++ b/bench/DecodeBench.cpp @@ -23,7 +23,7 @@ public: DecodeBench(void* param, SkBitmap::Config c) : SkBenchmark(param) { fFilename = this->findDefine("decode-filename"); fPrefConfig = c; - + const char* fname = NULL; if (fFilename) { fname = strrchr(fFilename, '/'); diff --git a/bench/DeferredCanvasBench.cpp b/bench/DeferredCanvasBench.cpp index 99c07bfe57..15902b9f58 100644 --- a/bench/DeferredCanvasBench.cpp +++ b/bench/DeferredCanvasBench.cpp @@ -95,7 +95,7 @@ protected: canvas.clear(0x0); canvas.setNotificationClient(NULL); } - + private: typedef DeferredCanvasBench INHERITED; SimpleNotificationClient fNotificationClient; diff --git a/bench/GrMemoryPoolBench.cpp b/bench/GrMemoryPoolBench.cpp index 98fd6e5bde..861a43e4fb 100644 --- a/bench/GrMemoryPoolBench.cpp +++ b/bench/GrMemoryPoolBench.cpp @@ -67,7 +67,7 @@ protected: s = 0; } SkFixed del = r.nextSFixed1(); - if (count && + if (count && (kMaxObjects == count || del < delThresh)) { delete objects[count-1]; --count; diff --git a/bench/GradientBench.cpp b/bench/GradientBench.cpp index ac5bbc734a..d7ce74dc8e 100644 --- a/bench/GradientBench.cpp +++ b/bench/GradientBench.cpp @@ -180,7 +180,7 @@ public: { 0, 0 }, { SkIntToScalar(W), SkIntToScalar(H) } }; - + fCount = SkBENCHLOOP(N * gGrads[gradType].fRepeat); fShader = gGrads[gradType].fMaker(pts, gGradData[0], tm, NULL, scale); fGeomType = geomType; @@ -223,16 +223,16 @@ private: class Gradient2Bench : public SkBenchmark { public: Gradient2Bench(void* param) : INHERITED(param) {} - + protected: virtual const char* onGetName() { return "gradient_create"; } - + virtual void onDraw(SkCanvas* canvas) { SkPaint paint; this->setupPaint(&paint); - + const SkRect r = { 0, 0, SkIntToScalar(4), SkIntToScalar(4) }; const SkPoint pts[] = { { 0, 0 }, @@ -252,7 +252,7 @@ protected: canvas->drawRect(r, paint); } } - + private: typedef SkBenchmark INHERITED; }; diff --git a/bench/InterpBench.cpp b/bench/InterpBench.cpp index 85fada3f0e..f8f463b1b5 100644 --- a/bench/InterpBench.cpp +++ b/bench/InterpBench.cpp @@ -45,7 +45,7 @@ private: class Fixed16D16Interp : public InterpBench { public: Fixed16D16Interp(void* param) : INHERITED(param, "16.16") {} - + protected: virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE { SkFixed curr = SkFloatToFixed(fx); @@ -64,27 +64,27 @@ private: class Fixed32D32Interp : public InterpBench { public: Fixed32D32Interp(void* param) : INHERITED(param, "32.32") {} - + protected: virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE { int64_t curr = (int64_t)(fx * 65536 * 655536); int64_t step = (int64_t)(dx * 65536 * 655536); SkFixed tmp; for (int i = 0; i < count; i += 4) { - tmp = (SkFixed)(curr >> 16); - dst[i + 0] = TILE(tmp, count); + tmp = (SkFixed)(curr >> 16); + dst[i + 0] = TILE(tmp, count); curr += step; - tmp = (SkFixed)(curr >> 16); - dst[i + 1] = TILE(tmp, count); + tmp = (SkFixed)(curr >> 16); + dst[i + 1] = TILE(tmp, count); curr += step; - tmp = (SkFixed)(curr >> 16); - dst[i + 2] = TILE(tmp, count); + tmp = (SkFixed)(curr >> 16); + dst[i + 2] = TILE(tmp, count); curr += step; - tmp = (SkFixed)(curr >> 16); - dst[i + 3] = TILE(tmp, count); + tmp = (SkFixed)(curr >> 16); + dst[i + 3] = TILE(tmp, count); curr += step; } } @@ -95,7 +95,7 @@ private: class Fixed16D48Interp : public InterpBench { public: Fixed16D48Interp(void* param) : INHERITED(param, "16.48") {} - + protected: virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE { int64_t curr = (int64_t)(fx * 65536 * 655536 * 65536); @@ -115,7 +115,7 @@ private: class FloatInterp : public InterpBench { public: FloatInterp(void* param) : INHERITED(param, "float") {} - + protected: virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE { SkFixed tmp; @@ -133,7 +133,7 @@ private: class DoubleInterp : public InterpBench { public: DoubleInterp(void* param) : INHERITED(param, "double") {} - + protected: virtual void performTest(int16_t dst[], float fx, float dx, int count) SK_OVERRIDE { double ffx = fx; diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp index 21c113c0ca..414036b6ae 100644 --- a/bench/MathBench.cpp +++ b/bench/MathBench.cpp @@ -32,8 +32,8 @@ public: } } - virtual void performTest(float* SK_RESTRICT dst, - const float* SK_RESTRICT src, + virtual void performTest(float* SK_RESTRICT dst, + const float* SK_RESTRICT src, int count) = 0; protected: @@ -59,11 +59,11 @@ public: MathBenchU32(void* param, const char name[]) : INHERITED(param, name) {} protected: - virtual void performITest(uint32_t* SK_RESTRICT dst, - const uint32_t* SK_RESTRICT src, + virtual void performITest(uint32_t* SK_RESTRICT dst, + const uint32_t* SK_RESTRICT src, int count) = 0; - - virtual void performTest(float* SK_RESTRICT dst, + + virtual void performTest(float* SK_RESTRICT dst, const float* SK_RESTRICT src, int count) SK_OVERRIDE { uint32_t* d = SkTCast<uint32_t*>(dst); @@ -80,8 +80,8 @@ class NoOpMathBench : public MathBench { public: NoOpMathBench(void* param) : INHERITED(param, "noOp") {} protected: - virtual void performTest(float* SK_RESTRICT dst, - const float* SK_RESTRICT src, + virtual void performTest(float* SK_RESTRICT dst, + const float* SK_RESTRICT src, int count) { for (int i = 0; i < count; ++i) { dst[i] = src[i] + 1; @@ -95,8 +95,8 @@ class SlowISqrtMathBench : public MathBench { public: SlowISqrtMathBench(void* param) : INHERITED(param, "slowIsqrt") {} protected: - virtual void performTest(float* SK_RESTRICT dst, - const float* SK_RESTRICT src, + virtual void performTest(float* SK_RESTRICT dst, + const float* SK_RESTRICT src, int count) { for (int i = 0; i < count; ++i) { dst[i] = 1.0f / sk_float_sqrt(src[i]); @@ -120,8 +120,8 @@ class FastISqrtMathBench : public MathBench { public: FastISqrtMathBench(void* param) : INHERITED(param, "fastIsqrt") {} protected: - virtual void performTest(float* SK_RESTRICT dst, - const float* SK_RESTRICT src, + virtual void performTest(float* SK_RESTRICT dst, + const float* SK_RESTRICT src, int count) { for (int i = 0; i < count; ++i) { dst[i] = SkFastInvSqrt(src[i]); @@ -237,7 +237,7 @@ static bool isFinite(const SkRect& r) { // x * 0 will be NaN iff x is infinity or NaN. // a + b will be NaN iff either a or b is NaN. float value = r.fLeft * 0 + r.fTop * 0 + r.fRight * 0 + r.fBottom * 0; - + // value is either NaN or it is finite (zero). // value==value will be true iff value is not NaN return value == value; @@ -291,7 +291,7 @@ protected: } } } - + SkPaint paint; if (paint.getAlpha() == 0) { SkDebugf("%d\n", counter); @@ -301,7 +301,7 @@ protected: virtual const char* onGetName() { return fName; } - + private: IsFiniteProc fProc; const char* fName; @@ -317,21 +317,21 @@ class FloorBench : public SkBenchmark { float fData[ARRAY]; bool fFast; public: - + FloorBench(void* param, bool fast) : INHERITED(param), fFast(fast) { SkRandom rand; - + for (int i = 0; i < ARRAY; ++i) { fData[i] = rand.nextSScalar1(); } - + if (fast) { fName = "floor_fast"; } else { fName = "floor_std"; } } - + virtual void process(float) {} protected: @@ -339,7 +339,7 @@ protected: SkRandom rand; float accum = 0; const float* data = fData; - + if (fFast) { for (int j = 0; j < LOOP; ++j) { for (int i = 0; i < ARRAY; ++i) { @@ -356,14 +356,14 @@ protected: } } } - + virtual const char* onGetName() { return fName; } - + private: const char* fName; - + typedef SkBenchmark INHERITED; }; diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp index b82d7fe1cb..d8e2137913 100644 --- a/bench/MatrixBench.cpp +++ b/bench/MatrixBench.cpp @@ -344,7 +344,7 @@ class ScaleTransDoubleMatrixBench : public MatrixBench { class InvertMapRectMatrixBench : public MatrixBench { public: - InvertMapRectMatrixBench(void* param, const char* name, int flags) + InvertMapRectMatrixBench(void* param, const char* name, int flags) : INHERITED(param, name) , fFlags(flags) { fMatrix.reset(); @@ -381,7 +381,7 @@ protected: fMatrix.setPerspX(fMatrix.getPerspX()); } SkMatrix inv; - bool invertible = + bool invertible = fMatrix.invert(&inv); SkASSERT(invertible); SkRect transformedRect; @@ -406,37 +406,37 @@ static SkBenchmark* M2(void* p) { return new FloatConcatMatrixBench(p); } static SkBenchmark* M3(void* p) { return new FloatDoubleConcatMatrixBench(p); } static SkBenchmark* M4(void* p) { return new DoubleConcatMatrixBench(p); } static SkBenchmark* M5(void* p) { return new GetTypeMatrixBench(p); } -static SkBenchmark* M6(void* p) { - return new InvertMapRectMatrixBench(p, +static SkBenchmark* M6(void* p) { + return new InvertMapRectMatrixBench(p, "invert_maprect_identity", 0); } -static SkBenchmark* M7(void* p) { - return new InvertMapRectMatrixBench(p, - "invert_maprect_rectstaysrect", +static SkBenchmark* M7(void* p) { + return new InvertMapRectMatrixBench(p, + "invert_maprect_rectstaysrect", InvertMapRectMatrixBench::kScale_Flag | InvertMapRectMatrixBench::kTranslate_Flag); } static SkBenchmark* M8(void* p) { - return new InvertMapRectMatrixBench(p, - "invert_maprect_nonpersp", + return new InvertMapRectMatrixBench(p, + "invert_maprect_nonpersp", InvertMapRectMatrixBench::kScale_Flag | InvertMapRectMatrixBench::kRotate_Flag | InvertMapRectMatrixBench::kTranslate_Flag); } -static SkBenchmark* M9(void* p) { - return new InvertMapRectMatrixBench(p, - "invert_maprect_persp", +static SkBenchmark* M9(void* p) { + return new InvertMapRectMatrixBench(p, + "invert_maprect_persp", InvertMapRectMatrixBench::kPerspective_Flag); } static SkBenchmark* M10(void* p) { - return new InvertMapRectMatrixBench(p, + return new InvertMapRectMatrixBench(p, "invert_maprect_typemask_rectstaysrect", InvertMapRectMatrixBench::kUncachedTypeMask_Flag | InvertMapRectMatrixBench::kScale_Flag | InvertMapRectMatrixBench::kTranslate_Flag); } static SkBenchmark* M11(void* p) { - return new InvertMapRectMatrixBench(p, + return new InvertMapRectMatrixBench(p, "invert_maprect_typemask_nonpersp", InvertMapRectMatrixBench::kUncachedTypeMask_Flag | InvertMapRectMatrixBench::kScale_Flag | diff --git a/bench/MemoryBench.cpp b/bench/MemoryBench.cpp index 5fdb7f1d51..d8d60526e8 100644 --- a/bench/MemoryBench.cpp +++ b/bench/MemoryBench.cpp @@ -15,7 +15,7 @@ class ChunkAllocBench : public SkBenchmark { SkString fName; size_t fMinSize; - + enum { N = SkBENCHLOOP(1000) }; @@ -24,12 +24,12 @@ public: fMinSize = minSize; fName.printf("chunkalloc_" SK_SIZE_T_SPECIFIER, minSize); } - + protected: virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); } - + virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { size_t inc = fMinSize >> 4; SkASSERT(inc > 0); @@ -48,7 +48,7 @@ protected: alloc.reset(); } } - + private: typedef SkBenchmark INHERITED; }; diff --git a/bench/MorphologyBench.cpp b/bench/MorphologyBench.cpp index f41e79c24c..b6e9c92287 100644 --- a/bench/MorphologyBench.cpp +++ b/bench/MorphologyBench.cpp @@ -47,12 +47,12 @@ public: fName.printf("morph_%d_%s", SkScalarRound(rad), name); } } - + protected: virtual const char* onGetName() { return fName.c_str(); } - + virtual void onDraw(SkCanvas* canvas) { SkPaint paint; this->setupPaint(&paint); @@ -69,11 +69,11 @@ protected: SkMorphologyImageFilter* mf = NULL; switch (fStyle) { case kDilate_MT: - mf = new SkDilateImageFilter(SkScalarFloorToInt(fRadius), + mf = new SkDilateImageFilter(SkScalarFloorToInt(fRadius), SkScalarFloorToInt(fRadius)); break; case kErode_MT: - mf = new SkErodeImageFilter(SkScalarFloorToInt(fRadius), + mf = new SkErodeImageFilter(SkScalarFloorToInt(fRadius), SkScalarFloorToInt(fRadius)); break; } @@ -82,7 +82,7 @@ protected: canvas->drawOval(r, paint); } } - + private: typedef SkBenchmark INHERITED; }; diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index 61014e832e..2e07f677be 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -82,7 +82,7 @@ private: class TrianglePathBench : public PathBench { public: TrianglePathBench(void* param, Flags flags) : INHERITED(param, flags) {} - + virtual void appendName(SkString* name) SK_OVERRIDE { name->append("triangle"); } @@ -102,7 +102,7 @@ private: class RectPathBench : public PathBench { public: RectPathBench(void* param, Flags flags) : INHERITED(param, flags) {} - + virtual void appendName(SkString* name) SK_OVERRIDE { name->append("rect"); } @@ -117,7 +117,7 @@ private: class OvalPathBench : public PathBench { public: OvalPathBench(void* param, Flags flags) : INHERITED(param, flags) {} - + virtual void appendName(SkString* name) SK_OVERRIDE { name->append("oval"); } @@ -147,7 +147,7 @@ private: class SawToothPathBench : public PathBench { public: SawToothPathBench(void* param, Flags flags) : INHERITED(param, flags) {} - + virtual void appendName(SkString* name) SK_OVERRIDE { name->append("sawtooth"); } @@ -659,7 +659,7 @@ protected: temp.addOval(r, SkPath::kCCW_Direction); temp.arcTo(r, 360, 0, true); temp.close(); - + canvas->drawPath(temp, paint); } } diff --git a/bench/PathIterBench.cpp b/bench/PathIterBench.cpp index 8e4308ef13..189d1b5dce 100644 --- a/bench/PathIterBench.cpp +++ b/bench/PathIterBench.cpp @@ -69,7 +69,7 @@ protected: SkPath::RawIter iter(fPath); SkPath::Verb verb; SkPoint pts[4]; - + while ((verb = iter.next(pts)) != SkPath::kDone_Verb); } } else { @@ -77,7 +77,7 @@ protected: SkPath::Iter iter(fPath, false); SkPath::Verb verb; SkPoint pts[4]; - + while ((verb = iter.next(pts)) != SkPath::kDone_Verb); } } diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp index cef2e22d06..992b8f9858 100644 --- a/bench/RectBench.cpp +++ b/bench/RectBench.cpp @@ -143,7 +143,7 @@ public: SkCanvas::PointMode fMode; const char* fName; - BlitMaskBench(void* param, SkCanvas::PointMode mode, + BlitMaskBench(void* param, SkCanvas::PointMode mode, BlitMaskBench::kMaskType type, const char* name) : RectBench(param, 2), fMode(mode), _type(type) { fName = name; @@ -177,17 +177,17 @@ protected: paint.setShader(s)->unref(); } for (size_t i = 0; i < sizes; i++) { - switch (_type) { - case kMaskOpaque: - color = fColors[i]; - alpha = 0xFF; + switch (_type) { + case kMaskOpaque: + color = fColors[i]; + alpha = 0xFF; break; - case kMaskBlack: + case kMaskBlack: alpha = 0xFF; color = 0xFF000000; break; case kMaskColor: - color = fColors[i]; + color = fColors[i]; alpha = rand.nextU() & 255; break; case KMaskShader: @@ -202,8 +202,8 @@ protected: } virtual const char* onGetName() { return fName; } private: - typedef RectBench INHERITED; - kMaskType _type; + typedef RectBench INHERITED; + kMaskType _type; }; diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp index 5541a5c019..7b9e2d424a 100644 --- a/bench/RegionBench.cpp +++ b/bench/RegionBench.cpp @@ -75,7 +75,7 @@ public: Proc fProc; SkString fName; int fLoopMul; - + enum { W = 1024, H = 768, diff --git a/bench/RepeatTileBench.cpp b/bench/RepeatTileBench.cpp index 8470beddd2..da36205eaf 100644 --- a/bench/RepeatTileBench.cpp +++ b/bench/RepeatTileBench.cpp @@ -27,7 +27,7 @@ static void drawIntoBitmap(const SkBitmap& bm) { p.setColor(SK_ColorRED); canvas.drawCircle(SkIntToScalar(w)/2, SkIntToScalar(h)/2, SkIntToScalar(SkMin32(w, h))*3/8, p); - + SkRect r; r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); p.setStyle(SkPaint::kStroke_Style); @@ -48,7 +48,7 @@ static uint8_t compute666Index(SkPMColor c) { int r = SkGetPackedR32(c); int g = SkGetPackedG32(c); int b = SkGetPackedB32(c); - + return convByteTo6(r) * 36 + convByteTo6(g) * 6 + convByteTo6(b); } @@ -70,7 +70,7 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst) { dst->setConfig(SkBitmap::kIndex8_Config, src.width(), src.height()); dst->allocPixels(ctable); ctable->unref(); - + SkAutoLockPixels alps(src); SkAutoLockPixels alpd(*dst); @@ -100,7 +100,7 @@ public: } bm.allocPixels(); bm.eraseColor(0); - + drawIntoBitmap(bm); if (SkBitmap::kIndex8_Config == c) { diff --git a/bench/ShaderMaskBench.cpp b/bench/ShaderMaskBench.cpp index 0a68b44303..ad27fcbb8b 100644 --- a/bench/ShaderMaskBench.cpp +++ b/bench/ShaderMaskBench.cpp @@ -70,14 +70,14 @@ protected: const SkScalar x0 = SkIntToScalar(-10); const SkScalar y0 = SkIntToScalar(-10); - + paint.setTextSize(SkIntToScalar(12)); for (int i = 0; i < N; i++) { SkScalar x = x0 + rand.nextUScalar1() * dim.fX; SkScalar y = y0 + rand.nextUScalar1() * dim.fY; canvas->drawText(fText.c_str(), fText.size(), x, y, paint); } - + paint.setTextSize(SkIntToScalar(48)); for (int i = 0; i < N/4; i++) { SkScalar x = x0 + rand.nextUScalar1() * dim.fX; diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h index 28314ea11b..a77cb8398b 100644 --- a/bench/SkBenchmark.h +++ b/bench/SkBenchmark.h @@ -55,15 +55,15 @@ public: void setForceAlpha(int alpha) { fForceAlpha = alpha; } - + void setForceAA(bool aa) { fForceAA = aa; } - + void setForceFilter(bool filter) { fForceFilter = filter; } - + void setDither(SkTriState::State state) { fDither = state; } diff --git a/bench/VertBench.cpp b/bench/VertBench.cpp index 98df44929e..e5053d9805 100644 --- a/bench/VertBench.cpp +++ b/bench/VertBench.cpp @@ -39,7 +39,7 @@ class VertBench : public SkBenchmark { idx[0] = n; idx[1] = n + 1; idx[2] = rb + n + 1; idx[3] = n; idx[4] = rb + n + 1; idx[5] = n + rb; } - + public: VertBench(void* param) : INHERITED(param) { const SkScalar dx = SkIntToScalar(W) / COL; @@ -55,7 +55,7 @@ public: pts->set(xx, yy); pts += 1; xx += dx; - + if (x < COL && y < ROW) { load_2_tris(idx, x, y, COL + 1); for (int i = 0; i < 6; i++) { diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index 5865eca71b..dfd39fd5bd 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -105,7 +105,7 @@ static bool equal(const SkBitmap& bm1, const SkBitmap& bm2) { bm1.config() != bm2.config()) { return false; } - + size_t pixelBytes = bm1.width() * bm1.bytesPerPixel(); for (int y = 0; y < bm1.height(); y++) { if (memcmp(bm1.getAddr(0, y), bm2.getAddr(0, y), pixelBytes)) { @@ -122,7 +122,7 @@ public: fBench = BenchRegistry::Head(); fParam = param; } - + SkBenchmark* next() { if (fBench) { BenchRegistry::Factory f = fBench->factory(); @@ -171,7 +171,7 @@ static void saveFile(const char name[], const char config[], const char dir[], if (!bm.copyTo(©, SkBitmap::kARGB_8888_Config)) { return; } - + if (bm.config() == SkBitmap::kA8_Config) { // turn alpha into gray-scale size_t size = copy.getSize() >> 2; @@ -183,7 +183,7 @@ static void saveFile(const char name[], const char config[], const char dir[], *p++ = c | (SK_A32_MASK << SK_A32_SHIFT); } } - + SkString str; make_filename(name, &str); str.appendf("_%s.png", config); @@ -195,11 +195,11 @@ static void saveFile(const char name[], const char config[], const char dir[], static void performClip(SkCanvas* canvas, int w, int h) { SkRect r; - + r.set(SkIntToScalar(10), SkIntToScalar(10), SkIntToScalar(w*2/3), SkIntToScalar(h*2/3)); canvas->clipRect(r, SkRegion::kIntersect_Op); - + r.set(SkIntToScalar(w/3), SkIntToScalar(h/3), SkIntToScalar(w-10), SkIntToScalar(h-10)); canvas->clipRect(r, SkRegion::kXOR_Op); @@ -208,7 +208,7 @@ static void performClip(SkCanvas* canvas, int w, int h) { static void performRotate(SkCanvas* canvas, int w, int h) { const SkScalar x = SkIntToScalar(w) / 2; const SkScalar y = SkIntToScalar(h) / 2; - + canvas->translate(x, y); canvas->rotate(SkIntToScalar(35)); canvas->translate(-x, -y); @@ -217,7 +217,7 @@ static void performRotate(SkCanvas* canvas, int w, int h) { static void performScale(SkCanvas* canvas, int w, int h) { const SkScalar x = SkIntToScalar(w) / 2; const SkScalar y = SkIntToScalar(h) / 2; - + canvas->translate(x, y); // just enough so we can't take the sprite case canvas->scale(SK_Scalar1 * 99/100, SK_Scalar1 * 99/100); @@ -314,7 +314,7 @@ static SkDevice* make_device(SkBitmap::Config config, const SkIPoint& size, SkDevice* device = NULL; SkBitmap bitmap; bitmap.setConfig(config, size.fX, size.fY); - + switch (backend) { case kRaster_Backend: bitmap.allocPixels(); @@ -475,7 +475,7 @@ int main (int argc, char * const argv[]) { Backend backend = kRaster_Backend; // for warning SkTDArray<int> configs; bool userConfig = false; - + char* const* stop = argv + argc; for (++argv; argv < stop; ++argv) { if (strcmp(*argv, "-o") == 0) { @@ -692,7 +692,7 @@ int main (int argc, char * const argv[]) { default: ditherName = "<invalid>"; break; } str.appendf(" dither=%s", ditherName); - + if (hasStrokeWidth) { str.appendf(" strokeWidth=%f", strokeWidth); } else { @@ -753,7 +753,7 @@ int main (int argc, char * const argv[]) { if (dim.fX <= 0 || dim.fY <= 0) { continue; } - + bench->setForceAlpha(forceAlpha); bench->setForceAA(forceAA); bench->setForceFilter(forceFilter); @@ -761,19 +761,19 @@ int main (int argc, char * const argv[]) { if (hasStrokeWidth) { bench->setStrokeWidth(strokeWidth); } - + // only run benchmarks if their name contains matchStr if (skip_name(fMatches, bench->getName())) { continue; } - + { SkString str; str.printf("running bench [%d %d] %28s", dim.fX, dim.fY, bench->getName()); logger.logProgress(str); } - + AutoPrePostDraw appd(bench); for (int x = 0; x < configs.count(); ++x) { |