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

Side by Side Diff: skia/ext/image_operations_bench.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « skia/ext/image_operations.cc ('k') | skia/ext/image_operations_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This small program is used to measure the performance of the various 5 // This small program is used to measure the performance of the various
6 // resize algorithms offered by the ImageOperations::Resize function. 6 // resize algorithms offered by the ImageOperations::Resize function.
7 // It will generate an empty source bitmap, and rescale it to specified 7 // It will generate an empty source bitmap, and rescale it to specified
8 // dimensions. It will repeat this operation multiple time to get more accurate 8 // dimensions. It will repeat this operation multiple time to get more accurate
9 // average throughput. Because it uses elapsed time to do its math, it is only 9 // average throughput. Because it uses elapsed time to do its math, it is only
10 // accurate on an idle system (but that approach was deemed more accurate 10 // accurate on an idle system (but that approach was deemed more accurate
(...skipping 25 matching lines...) Expand all
36 }; 36 };
37 #define ADD_METHOD(x) { #x, skia::ImageOperations::RESIZE_##x } 37 #define ADD_METHOD(x) { #x, skia::ImageOperations::RESIZE_##x }
38 const StringMethodPair resize_methods[] = { 38 const StringMethodPair resize_methods[] = {
39 ADD_METHOD(GOOD), 39 ADD_METHOD(GOOD),
40 ADD_METHOD(BETTER), 40 ADD_METHOD(BETTER),
41 ADD_METHOD(BEST), 41 ADD_METHOD(BEST),
42 ADD_METHOD(BOX), 42 ADD_METHOD(BOX),
43 ADD_METHOD(HAMMING1), 43 ADD_METHOD(HAMMING1),
44 ADD_METHOD(LANCZOS2), 44 ADD_METHOD(LANCZOS2),
45 ADD_METHOD(LANCZOS3), 45 ADD_METHOD(LANCZOS3),
46 ADD_METHOD(SUBPIXEL)
47 }; 46 };
48 47
49 // converts a string into one of the image operation method to resize. 48 // converts a string into one of the image operation method to resize.
50 // Returns true on success, false otherwise. 49 // Returns true on success, false otherwise.
51 bool StringToMethod(const std::string& arg, 50 bool StringToMethod(const std::string& arg,
52 skia::ImageOperations::ResizeMethod* method) { 51 skia::ImageOperations::ResizeMethod* method) {
53 for (size_t i = 0; i < arraysize(resize_methods); ++i) { 52 for (size_t i = 0; i < arraysize(resize_methods); ++i) {
54 if (base::strcasecmp(arg.c_str(), resize_methods[i].name) == 0) { 53 if (base::strcasecmp(arg.c_str(), resize_methods[i].name) == 0) {
55 *method = resize_methods[i].method; 54 *method = resize_methods[i].method;
56 return true; 55 return true;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return 1; 281 return 1;
283 } 282 }
284 283
285 if (!bench.Run()) { 284 if (!bench.Run()) {
286 printf("Failed to run benchmark\n"); 285 printf("Failed to run benchmark\n");
287 return 1; 286 return 1;
288 } 287 }
289 288
290 return 0; 289 return 0;
291 } 290 }
OLDNEW
« no previous file with comments | « skia/ext/image_operations.cc ('k') | skia/ext/image_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698