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

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

Issue 331283002: stop calling deprecated setConfig (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + android typo Created 6 years, 6 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 | Annotate | Revision Log
« 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 if (fNeedHelp == true) { 223 if (fNeedHelp == true) {
224 return false; 224 return false;
225 } 225 }
226 return true; 226 return true;
227 } 227 }
228 228
229 // actual benchmark. 229 // actual benchmark.
230 bool Benchmark::Run() const { 230 bool Benchmark::Run() const {
231 SkBitmap source; 231 SkBitmap source;
232 source.setConfig(SkBitmap::kARGB_8888_Config, 232 source.allocN32Pixels(source_.width(), source_.height());
233 source_.width(), source_.height());
234 source.allocPixels();
235 source.eraseARGB(0, 0, 0, 0); 233 source.eraseARGB(0, 0, 0, 0);
236 234
237 SkBitmap dest; 235 SkBitmap dest;
238 236
239 const base::TimeTicks start = base::TimeTicks::Now(); 237 const base::TimeTicks start = base::TimeTicks::Now();
240 238
241 for (int i = 0; i < num_iterations_; ++i) { 239 for (int i = 0; i < num_iterations_; ++i) {
242 dest = skia::ImageOperations::Resize(source, 240 dest = skia::ImageOperations::Resize(source,
243 method_, 241 method_,
244 dest_.width(), dest_.height()); 242 dest_.width(), dest_.height());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return 1; 282 return 1;
285 } 283 }
286 284
287 if (!bench.Run()) { 285 if (!bench.Run()) {
288 printf("Failed to run benchmark\n"); 286 printf("Failed to run benchmark\n");
289 return 1; 287 return 1;
290 } 288 }
291 289
292 return 0; 290 return 0;
293 } 291 }
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