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

Side by Side Diff: bench/SKPBench.h

Issue 1203193002: Add loopSKP flag to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 6 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/SKPAnimationBench.cpp ('k') | bench/SKPBench.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 #ifndef SKPBench_DEFINED 8 #ifndef SKPBench_DEFINED
9 #define SKPBench_DEFINED 9 #define SKPBench_DEFINED
10 10
11 #include "Benchmark.h" 11 #include "Benchmark.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkPicture.h" 13 #include "SkPicture.h"
14 14
15 /** 15 /**
16 * Runs an SkPicture as a benchmark by repeatedly drawing it scaled inside a dev ice clip. 16 * Runs an SkPicture as a benchmark by repeatedly drawing it scaled inside a dev ice clip.
17 */ 17 */
18 class SKPBench : public Benchmark { 18 class SKPBench : public Benchmark {
19 public: 19 public:
20 SKPBench(const char* name, const SkPicture*, const SkIRect& devClip, SkScala r scale, 20 SKPBench(const char* name, const SkPicture*, const SkIRect& devClip, SkScala r scale,
21 bool useMultiPictureDraw); 21 bool useMultiPictureDraw, bool doLooping);
22 ~SKPBench() override; 22 ~SKPBench() override;
23 23
24 int calculateLoops(int defaultLoops) const override {
25 return fDoLooping ? defaultLoops : 1;
26 }
27
24 protected: 28 protected:
25 const char* onGetName() override; 29 const char* onGetName() override;
26 const char* onGetUniqueName() override; 30 const char* onGetUniqueName() override;
27 void onPerCanvasPreDraw(SkCanvas*) override; 31 void onPerCanvasPreDraw(SkCanvas*) override;
28 void onPerCanvasPostDraw(SkCanvas*) override; 32 void onPerCanvasPostDraw(SkCanvas*) override;
29 bool isSuitableFor(Backend backend) override; 33 bool isSuitableFor(Backend backend) override;
30 void onDraw(const int loops, SkCanvas* canvas) override; 34 void onDraw(const int loops, SkCanvas* canvas) override;
31 SkIPoint onGetSize() override; 35 SkIPoint onGetSize() override;
32 36
33 virtual void drawMPDPicture(); 37 virtual void drawMPDPicture();
34 virtual void drawPicture(); 38 virtual void drawPicture();
35 39
36 const SkPicture* picture() const { return fPic; } 40 const SkPicture* picture() const { return fPic; }
37 const SkTDArray<SkSurface*>& surfaces() const { return fSurfaces; } 41 const SkTDArray<SkSurface*>& surfaces() const { return fSurfaces; }
38 const SkTDArray<SkIRect>& tileRects() const { return fTileRects; } 42 const SkTDArray<SkIRect>& tileRects() const { return fTileRects; }
39 43
40 private: 44 private:
41 SkAutoTUnref<const SkPicture> fPic; 45 SkAutoTUnref<const SkPicture> fPic;
42 const SkIRect fClip; 46 const SkIRect fClip;
43 const SkScalar fScale; 47 const SkScalar fScale;
44 SkString fName; 48 SkString fName;
45 SkString fUniqueName; 49 SkString fUniqueName;
46 50
47 const bool fUseMultiPictureDraw; 51 const bool fUseMultiPictureDraw;
48 SkTDArray<SkSurface*> fSurfaces; // for MultiPictureDraw 52 SkTDArray<SkSurface*> fSurfaces; // for MultiPictureDraw
49 SkTDArray<SkIRect> fTileRects; // for MultiPictureDraw 53 SkTDArray<SkIRect> fTileRects; // for MultiPictureDraw
50 54
55 const bool fDoLooping;
56
51 typedef Benchmark INHERITED; 57 typedef Benchmark INHERITED;
52 }; 58 };
53 59
54 #endif 60 #endif
OLDNEW
« no previous file with comments | « bench/SKPAnimationBench.cpp ('k') | bench/SKPBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698