blob: 37487a3e66ea6221809ee8e69b4c04ddae86d87f [file] [log] [blame]
keyar@chromium.org163b5672012-08-01 17:53:29 +00001/*
2 * Copyright 2012 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#ifndef PictureBenchmark_DEFINED
9#define PictureBenchmark_DEFINED
10#include "SkTypes.h"
11#include "SkRefCnt.h"
12#include "PictureRenderer.h"
13
14class SkPicture;
15class SkString;
16
17namespace sk_tools {
18
19class PictureBenchmark : public SkRefCnt {
20public:
21 virtual void run(SkPicture* pict) = 0;
22
23 void setRepeats(int repeats) {
24 fRepeats = repeats;
25 }
26
27 int getRepeats() const {
28 return fRepeats;
29 }
30
31protected:
32 int fRepeats;
33};
34
35class PipePictureBenchmark : public PictureBenchmark {
36public:
37 virtual void run(SkPicture* pict);
38private:
39 PipePictureRenderer renderer;
40};
41
42class RecordPictureBenchmark : public PictureBenchmark {
43public:
44 virtual void run(SkPicture* pict);
45};
46
47class SimplePictureBenchmark : public PictureBenchmark {
48public:
49 virtual void run(SkPicture* pict);
50private:
51 SimplePictureRenderer renderer;
52};
53
54class TiledPictureBenchmark : public PictureBenchmark {
55public:
56 virtual void run(SkPicture* pict);
57
58 void setTileWidth(int width) {
59 renderer.setTileWidth(width);
60 }
61
62 int getTileWidth() const {
63 return renderer.getTileWidth();
64 }
65
66 void setTileHeight(int height) {
67 renderer.setTileHeight(height);
68 }
69
70 int getTileHeight() const {
71 return renderer.getTileHeight();
72 }
73
74 void setTileWidthPercentage(double percentage) {
75 renderer.setTileWidthPercentage(percentage);
76 }
77
78 double getTileWidthPercentage() const {
79 return renderer.getTileWidthPercentage();
80 }
81
82 void setTileHeightPercentage(double percentage) {
83 renderer.setTileHeightPercentage(percentage);
84 }
85
86 double getTileHeightPercentage() const {
87 return renderer.getTileHeightPercentage();
88 }
89
90private:
91 TiledPictureRenderer renderer;
92};
93
94class UnflattenPictureBenchmark : public PictureBenchmark {
95public:
96 virtual void run(SkPicture* pict);
97};
98
99}
100
101#endif // PictureBenchmark_DEFINED