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

Side by Side Diff: bench/RecordingBench.cpp

Issue 2220273002: update picture recording benchmarks to allow comparison with SkLiteRecorder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more fair comparison this way Created 4 years, 4 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/RecordingBench.h ('k') | bench/nanobench.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 2014 Google Inc. 2 * Copyright 2014 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 #include "RecordingBench.h" 8 #include "RecordingBench.h"
9
10 #include "SkBBHFactory.h" 9 #include "SkBBHFactory.h"
10 #include "SkLiteDL.h"
11 #include "SkLiteRecorder.h"
11 #include "SkPictureRecorder.h" 12 #include "SkPictureRecorder.h"
12 13
13 RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useB BH) 14 RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useB BH, bool lite)
14 : fSrc(SkRef(pic)) 15 : fName(name)
15 , fName(name) 16 , fUseBBH(useBBH)
16 , fUseBBH(useBBH) {} 17 , fLite(lite) {
18 // Flatten the source picture in case it's trivially nested (useless for tim ing).
19 SkPictureRecorder rec;
20 pic->playback(rec.beginRecording(pic->cullRect(), nullptr,
21 SkPictureRecorder::kPlaybackDrawPicture_Rec ordFlag));
22 fSrc = rec.finishRecordingAsPicture();
23 }
17 24
18 const char* RecordingBench::onGetName() { 25 const char* RecordingBench::onGetName() {
19 return fName.c_str(); 26 return fName.c_str();
20 } 27 }
21 28
22 bool RecordingBench::isSuitableFor(Backend backend) { 29 bool RecordingBench::isSuitableFor(Backend backend) {
23 return backend == kNonRendering_Backend; 30 return backend == kNonRendering_Backend;
24 } 31 }
25 32
26 SkIPoint RecordingBench::onGetSize() { 33 SkIPoint RecordingBench::onGetSize() {
27 return SkIPoint::Make(SkScalarCeilToInt(fSrc->cullRect().width()), 34 return SkIPoint::Make(SkScalarCeilToInt(fSrc->cullRect().width()),
28 SkScalarCeilToInt(fSrc->cullRect().height())); 35 SkScalarCeilToInt(fSrc->cullRect().height()));
29 } 36 }
30 37
31 void RecordingBench::onDraw(int loops, SkCanvas*) { 38 void RecordingBench::onDraw(int loops, SkCanvas*) {
32 SkRTreeFactory factory; 39 if (fLite) {
33 const SkScalar w = fSrc->cullRect().width(), 40 SkLiteRecorder rec;
34 h = fSrc->cullRect().height(); 41 while (loops --> 0) {
42 sk_sp<SkLiteDL> dl = SkLiteDL::New(fSrc->cullRect());
43 rec.reset(dl.get());
44 fSrc->playback(&rec);
45 dl->makeThreadsafe();
46 }
35 47
36 uint32_t flags = SkPictureRecorder::kPlaybackDrawPicture_RecordFlag; 48 } else {
37 for (int i = 0; i < loops; i++) { 49 SkRTreeFactory factory;
38 SkPictureRecorder recorder; 50 SkPictureRecorder recorder;
39 fSrc->playback(recorder.beginRecording(w, h, fUseBBH ? &factory : nullpt r, flags)); 51 while (loops --> 0) {
40 (void)recorder.finishRecordingAsPicture(); 52 fSrc->playback(recorder.beginRecording(fSrc->cullRect(), fUseBBH ? & factory : nullptr));
53 (void)recorder.finishRecordingAsPicture();
54 }
41 } 55 }
42 } 56 }
OLDNEW
« no previous file with comments | « bench/RecordingBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698