OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
8 #include <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "Benchmark.h" | 10 #include "Benchmark.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 SkString dir = SkOSPath::Dirname(filename.c_str()); | 153 SkString dir = SkOSPath::Dirname(filename.c_str()); |
154 if (!sk_mkdir(dir.c_str())) { | 154 if (!sk_mkdir(dir.c_str())) { |
155 SkDebugf("Can't make dir %s.\n", dir.c_str()); | 155 SkDebugf("Can't make dir %s.\n", dir.c_str()); |
156 return false; | 156 return false; |
157 } | 157 } |
158 SkFILEWStream stream(filename.c_str()); | 158 SkFILEWStream stream(filename.c_str()); |
159 if (!stream.isValid()) { | 159 if (!stream.isValid()) { |
160 SkDebugf("Can't write %s.\n", filename.c_str()); | 160 SkDebugf("Can't write %s.\n", filename.c_str()); |
161 return false; | 161 return false; |
162 } | 162 } |
163 if (!SkImageEncoder::EncodeStream(&stream, bmp, SkImageEncoder::kPNG_Type, 1
00)) { | 163 if (!SkImageEncoder::EncodeStream(&stream, bmp, kPNG_SkEncodedFormat, 100))
{ |
164 SkDebugf("Can't encode a PNG.\n"); | 164 SkDebugf("Can't encode a PNG.\n"); |
165 return false; | 165 return false; |
166 } | 166 } |
167 return true; | 167 return true; |
168 } | 168 } |
169 | 169 |
170 static int kFailedLoops = -2; | 170 static int kFailedLoops = -2; |
171 static int cpu_bench(const double overhead, Benchmark* bench, SkCanvas* canvas,
double* samples) { | 171 static int cpu_bench(const double overhead, Benchmark* bench, SkCanvas* canvas,
double* samples) { |
172 // First figure out approximately how many loops of bench it takes to make o
verhead negligible. | 172 // First figure out approximately how many loops of bench it takes to make o
verhead negligible. |
173 double bench_plus_overhead = 0.0; | 173 double bench_plus_overhead = 0.0; |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 896 |
897 return 0; | 897 return 0; |
898 } | 898 } |
899 | 899 |
900 #if !defined SK_BUILD_FOR_IOS | 900 #if !defined SK_BUILD_FOR_IOS |
901 int main(int argc, char** argv) { | 901 int main(int argc, char** argv) { |
902 SkCommandLineFlags::Parse(argc, argv); | 902 SkCommandLineFlags::Parse(argc, argv); |
903 return nanobench_main(); | 903 return nanobench_main(); |
904 } | 904 } |
905 #endif | 905 #endif |
OLD | NEW |