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

Side by Side Diff: bench/SKPBench.cpp

Issue 425393004: SKPs-as-benches in nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more %.2g Created 6 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
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 "SKPBench.h"
9
10 SKPBench::SKPBench(const char* name, const SkPicture* pic, const SkIRect& clip, SkScalar scale)
11 : fPic(SkRef(pic))
12 , fClip(clip)
13 , fScale(scale) {
14 fName.printf("%s_%.2g", name, scale);
15 }
16
17 const char* SKPBench::onGetName() {
18 return fName.c_str();
19 }
20
21 bool SKPBench::isSuitableFor(Backend backend) {
22 return backend != kNonRendering_Backend;
23 }
24
25 SkIPoint SKPBench::onGetSize() {
26 return SkIPoint::Make(fClip.fRight - fClip.fLeft, fClip.fBottom - fClip.fTop );
bsalomon 2014/08/01 13:23:24 fClip.width(), fClip.height()?
mtklein 2014/08/01 13:55:34 Done.
27 }
28
29 void SKPBench::onDraw(const int loops, SkCanvas* canvas) {
30 canvas->save();
31 SkRegion deviceClip;
bsalomon 2014/08/01 13:23:24 No regions, please! The GPU doesn't like them and
mtklein 2014/08/01 13:55:34 Done. Writing output SGTM. Let's follow up.
32 deviceClip.setRect(fClip);
33 canvas->clipRegion(deviceClip);
34
35 canvas->scale(fScale, fScale);
36
37 for (int i = 0; i < loops; i++) {
38 fPic->draw(canvas);
bsalomon 2014/08/01 13:23:24 I'm not sure whether we should have a canvas flush
mtklein 2014/08/01 13:55:34 Good question. Looks like bench_pictures does, so
39 }
40 canvas->restore();
41 }
OLDNEW
« no previous file with comments | « bench/SKPBench.h ('k') | bench/nanobench.cpp » ('j') | bench/nanobench.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698