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

Side by Side Diff: bench/WritePixelsBench.cpp

Issue 99893003: Simplify benchmark internal API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « bench/VertBench.cpp ('k') | bench/WriterBench.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 28 matching lines...) Expand all
39 SK_CRASH(); 39 SK_CRASH();
40 break; 40 break;
41 } 41 }
42 } 42 }
43 43
44 protected: 44 protected:
45 virtual const char* onGetName() SK_OVERRIDE { 45 virtual const char* onGetName() SK_OVERRIDE {
46 return fName.c_str(); 46 return fName.c_str();
47 } 47 }
48 48
49 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 49 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
50 SkISize size = canvas->getDeviceSize(); 50 SkISize size = canvas->getDeviceSize();
51 51
52 canvas->clear(0xFFFF0000); 52 canvas->clear(0xFFFF0000);
53 53
54 SkBitmap bmp; 54 SkBitmap bmp;
55 bmp.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); 55 bmp.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
56 canvas->readPixels(&bmp, 0, 0); 56 canvas->readPixels(&bmp, 0, 0);
57 57
58 for (int loop = 0; loop < this->getLoops(); ++loop) { 58 for (int loop = 0; loop < loops; ++loop) {
59 canvas->writePixels(bmp, 0, 0, fConfig); 59 canvas->writePixels(bmp, 0, 0, fConfig);
60 } 60 }
61 } 61 }
62 62
63 private: 63 private:
64 SkCanvas::Config8888 fConfig; 64 SkCanvas::Config8888 fConfig;
65 SkString fName; 65 SkString fName;
66 66
67 typedef SkBenchmark INHERITED; 67 typedef SkBenchmark INHERITED;
68 }; 68 };
69 69
70 ////////////////////////////////////////////////////////////////////////////// 70 //////////////////////////////////////////////////////////////////////////////
71 71
72 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (SkCanvas::kRGBA_Premul_Config888 8)); ) 72 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (SkCanvas::kRGBA_Premul_Config888 8)); )
73 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (SkCanvas::kRGBA_Unpremul_Config8 888)); ) 73 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (SkCanvas::kRGBA_Unpremul_Config8 888)); )
OLDNEW
« no previous file with comments | « bench/VertBench.cpp ('k') | bench/WriterBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698