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

Side by Side Diff: bench/WritePixelsBench.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/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 50 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
51 SkISize size = canvas->getDeviceSize(); 51 SkISize size = canvas->getDeviceSize();
52 52
53 canvas->clear(0xFFFF0000); 53 canvas->clear(0xFFFF0000);
54 54
55 SkBitmap bmp; 55 SkBitmap bmp;
56 bmp.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height()); 56 bmp.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
57 canvas->readPixels(&bmp, 0, 0); 57 canvas->readPixels(&bmp, 0, 0);
58 58
59 for (int loop = 0; loop < kLoopCount; ++loop) { 59 for (int loop = 0; loop < this->getLoops(); ++loop) {
60 canvas->writePixels(bmp, 0, 0, fConfig); 60 canvas->writePixels(bmp, 0, 0, fConfig);
61 } 61 }
62 } 62 }
63 63
64 private: 64 private:
65 static const int kLoopCount = SkBENCHLOOP(50);
66
67 SkCanvas::Config8888 fConfig; 65 SkCanvas::Config8888 fConfig;
68 SkString fName; 66 SkString fName;
69 67
70 typedef SkBenchmark INHERITED; 68 typedef SkBenchmark INHERITED;
71 }; 69 };
72 70
73 ////////////////////////////////////////////////////////////////////////////// 71 //////////////////////////////////////////////////////////////////////////////
74 72
75 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (p, SkCanvas::kRGBA_Premul_Config 8888)); ) 73 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (p, SkCanvas::kRGBA_Premul_Config 8888)); )
76 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (p, SkCanvas::kRGBA_Unpremul_Conf ig8888)); ) 74 DEF_BENCH( return SkNEW_ARGS(WritePixelsBench, (p, SkCanvas::kRGBA_Unpremul_Conf ig8888)); )
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