| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkPathUtils.h" | 9 #include "SkPathUtils.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 static void region_proc(char* bits, SkPath* path) { | 32 static void region_proc(char* bits, SkPath* path) { |
| 33 SkPathUtils::BitsToPath_Region(path, bits, H, W, STRIDE); | 33 SkPathUtils::BitsToPath_Region(path, bits, H, W, STRIDE); |
| 34 } | 34 } |
| 35 | 35 |
| 36 /// Emulates the mix of rects blitted by gmail during scrolling | 36 /// Emulates the mix of rects blitted by gmail during scrolling |
| 37 class PathUtilsBench : public SkBenchmark { | 37 class PathUtilsBench : public SkBenchmark { |
| 38 typedef void (*Proc)(char*, SkPath*); | 38 typedef void (*Proc)(char*, SkPath*); |
| 39 | 39 |
| 40 Proc fProc; | 40 Proc fProc; |
| 41 int fH, fW, fStride; | |
| 42 SkString fName; | 41 SkString fName; |
| 43 char* bits[H * STRIDE]; | 42 char* bits[H * STRIDE]; |
| 44 | 43 |
| 45 enum { N = SkBENCHLOOP(20) }; | 44 enum { N = SkBENCHLOOP(20) }; |
| 46 | 45 |
| 47 public: | 46 public: |
| 48 PathUtilsBench(void* param, Proc proc, const char name[]) : INHERITED(param)
{ | 47 PathUtilsBench(void* param, Proc proc, const char name[]) : INHERITED(param)
{ |
| 49 fProc = proc; | 48 fProc = proc; |
| 50 fName.printf("pathUtils_%s", name); | 49 fName.printf("pathUtils_%s", name); |
| 51 | 50 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 typedef SkBenchmark INHERITED; | 70 typedef SkBenchmark INHERITED; |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 static SkBenchmark* PU_path(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, pat
h_proc, "path")); } | 73 static SkBenchmark* PU_path(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, pat
h_proc, "path")); } |
| 75 static SkBenchmark* PU_region(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, r
egion_proc, "region")); } | 74 static SkBenchmark* PU_region(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, r
egion_proc, "region")); } |
| 76 | 75 |
| 77 static BenchRegistry PU_Path(PU_path); | 76 static BenchRegistry PU_Path(PU_path); |
| 78 static BenchRegistry PU_Region(PU_region); | 77 static BenchRegistry PU_Region(PU_region); |
| OLD | NEW |