Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: bench/nanobench.cpp

Issue 1018953003: Add SkEncodedFormat, used by SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use a common enum for SkImageEncoder and SkImageDecoder and SkCodec Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | include/core/SkEncodedFormat.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | include/core/SkEncodedFormat.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698