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

Side by Side Diff: bench/PictureOverheadBench.cpp

Issue 1379923005: Remove const from `const int loops`. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: n too Created 5 years, 2 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
« no previous file with comments | « bench/PictureNestingBench.cpp ('k') | bench/PicturePlaybackBench.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 2015 Google Inc. 2 * Copyright 2015 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 7
8 // A benchmark designed to isolate the constant overheads of picture recording. 8 // A benchmark designed to isolate the constant overheads of picture recording.
9 // We record an empty picture and a picture with one draw op to force memory all ocation. 9 // We record an empty picture and a picture with one draw op to force memory all ocation.
10 10
11 #include "Benchmark.h" 11 #include "Benchmark.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkPictureRecorder.h" 13 #include "SkPictureRecorder.h"
14 14
15 template <bool kDraw> 15 template <bool kDraw>
16 struct PictureOverheadBench : public Benchmark { 16 struct PictureOverheadBench : public Benchmark {
17 const char* onGetName() override { 17 const char* onGetName() override {
18 return kDraw ? "picture_overhead_draw" : "picture_overhead_nodraw"; 18 return kDraw ? "picture_overhead_draw" : "picture_overhead_nodraw";
19 } 19 }
20 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 20 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
21 21
22 void onDraw(const int loops, SkCanvas*) override { 22 void onDraw(int loops, SkCanvas*) override {
23 SkPictureRecorder rec; 23 SkPictureRecorder rec;
24 for (int i = 0; i < loops; i++) { 24 for (int i = 0; i < loops; i++) {
25 rec.beginRecording(SkRect::MakeWH(2000,3000)); 25 rec.beginRecording(SkRect::MakeWH(2000,3000));
26 if (kDraw) { 26 if (kDraw) {
27 rec.getRecordingCanvas()->drawRect(SkRect::MakeXYWH(10, 10, 1000 , 1000), SkPaint()); 27 rec.getRecordingCanvas()->drawRect(SkRect::MakeXYWH(10, 10, 1000 , 1000), SkPaint());
28 } 28 }
29 SkAutoTUnref<SkPicture> pic(rec.endRecordingAsPicture()); 29 SkAutoTUnref<SkPicture> pic(rec.endRecordingAsPicture());
30 } 30 }
31 } 31 }
32 }; 32 };
33 33
34 DEF_BENCH(return (new PictureOverheadBench<false>);) 34 DEF_BENCH(return (new PictureOverheadBench<false>);)
35 DEF_BENCH(return (new PictureOverheadBench< true>);) 35 DEF_BENCH(return (new PictureOverheadBench< true>);)
OLDNEW
« no previous file with comments | « bench/PictureNestingBench.cpp ('k') | bench/PicturePlaybackBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698