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

Side by Side Diff: bench/RecordingBench.cpp

Issue 559153002: Measure picture recording speed in nanobench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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
« 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
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "RecordingBench.h"
9
10 #include "SkBBHFactory.h"
11 #include "SkPictureRecorder.h"
12
13 static const int kTileSize = 256;
14
15 RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useB BH)
16 : fSrc(SkRef(pic))
17 , fName(name)
18 , fUseBBH(useBBH) {}
19
20 const char* RecordingBench::onGetName() {
21 return fName.c_str();
22 }
23
24 bool RecordingBench::isSuitableFor(Backend backend) {
25 return backend == kNonRendering_Backend;
26 }
27
28 SkIPoint RecordingBench::onGetSize() {
29 return SkIPoint::Make(SkScalarCeilToInt(fSrc->cullRect().width()),
30 SkScalarCeilToInt(fSrc->cullRect().height()));
31 }
32
33 void RecordingBench::onDraw(const int loops, SkCanvas*) {
34 SkTileGridFactory::TileGridInfo info;
35 info.fTileInterval.set(kTileSize, kTileSize);
36 info.fMargin.setEmpty();
37 info.fOffset.setZero();
38 SkTileGridFactory factory(info);
39
40 const SkScalar w = fSrc->cullRect().width(),
41 h = fSrc->cullRect().height();
42
43 for (int i = 0; i < loops; i++) {
44 SkPictureRecorder recorder;
45 fSrc->playback(recorder.beginRecording(w, h, fUseBBH ? &factory : NULL)) ;
46 SkDELETE(recorder.endRecording());
47 }
48 }
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