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" |
11 #include "SkTime.h" | 11 #include "SkTime.h" |
12 #include "SkString.h" | 12 #include "SkString.h" |
13 | 13 |
14 #define H 16 | 14 #define H 16 |
15 #define W 16 | 15 #define W 16 |
16 #define STRIDE 2 | 16 #define STRIDE 2 |
17 | 17 |
18 //this function is redefined for sample, test, and bench. is there anywhere | 18 //this function is redefined for sample, test, and bench. is there anywhere |
19 // I can put it to avoid code duplcation? | 19 // I can put it to avoid code duplcation? |
20 static void fillRandomBits( int chars, char* bits ){ | 20 static void fillRandomBits( int chars, char* bits ){ |
21 SkMWCRandom rand(SkTime::GetMSecs()); | 21 SkRandom rand(SkTime::GetMSecs()); |
22 | 22 |
23 for (int i = 0; i < chars; ++i){ | 23 for (int i = 0; i < chars; ++i){ |
24 bits[i] = rand.nextU(); | 24 bits[i] = rand.nextU(); |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 static void path_proc(char* bits, SkPath* path) { | 28 static void path_proc(char* bits, SkPath* path) { |
29 SkPathUtils::BitsToPath_Path(path, bits, H, W, STRIDE); | 29 SkPathUtils::BitsToPath_Path(path, bits, H, W, STRIDE); |
30 } | 30 } |
31 | 31 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 private: | 69 private: |
70 typedef SkBenchmark INHERITED; | 70 typedef SkBenchmark INHERITED; |
71 }; | 71 }; |
72 | 72 |
73 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")); } |
74 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")); } |
75 | 75 |
76 static BenchRegistry PU_Path(PU_path); | 76 static BenchRegistry PU_Path(PU_path); |
77 static BenchRegistry PU_Region(PU_region); | 77 static BenchRegistry PU_Region(PU_region); |
OLD | NEW |