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

Side by Side Diff: bench/MagnifierBench.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani Created 7 years, 3 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 | « bench/LineBench.cpp ('k') | bench/MathBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkMagnifierImageFilter.h" 10 #include "SkMagnifierImageFilter.h"
(...skipping 25 matching lines...) Expand all
36 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 36 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
37 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; 37 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
38 const int h = fIsSmall ? FILTER_HEIGHT_SMALL : FILTER_HEIGHT_LARGE; 38 const int h = fIsSmall ? FILTER_HEIGHT_SMALL : FILTER_HEIGHT_LARGE;
39 SkPaint paint; 39 SkPaint paint;
40 paint.setImageFilter( 40 paint.setImageFilter(
41 new SkMagnifierImageFilter( 41 new SkMagnifierImageFilter(
42 SkRect::MakeXYWH(SkIntToScalar(w / 4), 42 SkRect::MakeXYWH(SkIntToScalar(w / 4),
43 SkIntToScalar(h / 4), 43 SkIntToScalar(h / 4),
44 SkIntToScalar(w / 2), 44 SkIntToScalar(w / 2),
45 SkIntToScalar(h / 2)), 100))->unref(); 45 SkIntToScalar(h / 2)), 100))->unref();
46 canvas->drawBitmap(fCheckerboard, 0, 0, &paint); 46
47 for (int i = 0; i < this->getLoops(); i++) {
48 canvas->drawBitmap(fCheckerboard, 0, 0, &paint);
49 }
47 } 50 }
48 51
49 private: 52 private:
50 void make_checkerboard() { 53 void make_checkerboard() {
51 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; 54 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
52 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; 55 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
53 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h); 56 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h);
54 fCheckerboard.allocPixels(); 57 fCheckerboard.allocPixels();
55 SkBitmapDevice device(fCheckerboard); 58 SkBitmapDevice device(fCheckerboard);
56 SkCanvas canvas(&device); 59 SkCanvas canvas(&device);
(...skipping 18 matching lines...) Expand all
75 bool fIsSmall; 78 bool fIsSmall;
76 bool fInitialized; 79 bool fInitialized;
77 SkBitmap fCheckerboard; 80 SkBitmap fCheckerboard;
78 typedef SkBenchmark INHERITED; 81 typedef SkBenchmark INHERITED;
79 }; 82 };
80 83
81 /////////////////////////////////////////////////////////////////////////////// 84 ///////////////////////////////////////////////////////////////////////////////
82 85
83 DEF_BENCH( return new MagnifierBench(p, true); ) 86 DEF_BENCH( return new MagnifierBench(p, true); )
84 DEF_BENCH( return new MagnifierBench(p, false); ) 87 DEF_BENCH( return new MagnifierBench(p, false); )
OLDNEW
« no previous file with comments | « bench/LineBench.cpp ('k') | bench/MathBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698