OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef skiagm_DEFINED | 8 #ifndef skiagm_DEFINED |
9 #define skiagm_DEFINED | 9 #define skiagm_DEFINED |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 kSkip565_Flag = 1 << 5, | 46 kSkip565_Flag = 1 << 5, |
47 kSkipScaledReplay_Flag = 1 << 6, | 47 kSkipScaledReplay_Flag = 1 << 6, |
48 kSkipGPU_Flag = 1 << 7, | 48 kSkipGPU_Flag = 1 << 7, |
49 kSkipPDFRasterization_Flag = 1 << 8, | 49 kSkipPDFRasterization_Flag = 1 << 8, |
50 | 50 |
51 kGPUOnly_Flag = 1 << 9, | 51 kGPUOnly_Flag = 1 << 9, |
52 | 52 |
53 kAsBench_Flag = 1 << 10, // Run the GM as a benchmark
in the bench tool | 53 kAsBench_Flag = 1 << 10, // Run the GM as a benchmark
in the bench tool |
54 }; | 54 }; |
55 | 55 |
| 56 enum Mode { |
| 57 kGM_Mode, |
| 58 kSample_Mode, |
| 59 kBench_Mode, |
| 60 }; |
| 61 |
| 62 void setMode(Mode mode) { fMode = mode; } |
| 63 Mode getMode() const { return fMode; } |
| 64 |
56 void draw(SkCanvas*); | 65 void draw(SkCanvas*); |
57 void drawBackground(SkCanvas*); | 66 void drawBackground(SkCanvas*); |
58 void drawContent(SkCanvas*); | 67 void drawContent(SkCanvas*); |
59 | 68 |
60 SkISize getISize() { return this->onISize(); } | 69 SkISize getISize() { return this->onISize(); } |
61 const char* shortName(); | 70 const char* shortName(); |
62 | 71 |
63 uint32_t getFlags() const { | 72 uint32_t getFlags() const { |
64 return this->onGetFlags(); | 73 return this->onGetFlags(); |
65 } | 74 } |
(...skipping 28 matching lines...) Expand all Loading... |
94 | 103 |
95 static SkString& GetResourcePath() { | 104 static SkString& GetResourcePath() { |
96 return gResourcePath; | 105 return gResourcePath; |
97 } | 106 } |
98 | 107 |
99 bool isCanvasDeferred() const { return fCanvasIsDeferred; } | 108 bool isCanvasDeferred() const { return fCanvasIsDeferred; } |
100 void setCanvasIsDeferred(bool isDeferred) { | 109 void setCanvasIsDeferred(bool isDeferred) { |
101 fCanvasIsDeferred = isDeferred; | 110 fCanvasIsDeferred = isDeferred; |
102 } | 111 } |
103 | 112 |
104 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } | 113 const SkMatrix& getStarterMatrix() { return fStarterMatrix; } |
105 void setStarterMatrix(const SkMatrix& matrix) { | 114 void setStarterMatrix(const SkMatrix& matrix) { |
106 fStarterMatrix = matrix; | 115 fStarterMatrix = matrix; |
107 } | 116 } |
108 | 117 |
109 protected: | 118 protected: |
110 static SkString gResourcePath; | 119 static SkString gResourcePath; |
111 | 120 |
112 virtual void onOnceBeforeDraw() {} | 121 virtual void onOnceBeforeDraw() {} |
113 virtual void onDraw(SkCanvas*) = 0; | 122 virtual void onDraw(SkCanvas*) = 0; |
114 virtual void onDrawBackground(SkCanvas*); | 123 virtual void onDrawBackground(SkCanvas*); |
115 virtual SkISize onISize() = 0; | 124 virtual SkISize onISize() = 0; |
116 virtual SkString onShortName() = 0; | 125 virtual SkString onShortName() = 0; |
117 virtual uint32_t onGetFlags() const { return 0; } | 126 virtual uint32_t onGetFlags() const { return 0; } |
118 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } | 127 virtual SkMatrix onGetInitialTransform() const { return SkMatrix::I(); } |
119 | 128 |
120 private: | 129 private: |
| 130 Mode fMode; |
121 SkString fShortName; | 131 SkString fShortName; |
122 SkColor fBGColor; | 132 SkColor fBGColor; |
123 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp | 133 bool fCanvasIsDeferred; // work-around problem in srcmode.cpp |
124 bool fHaveCalledOnceBeforeDraw; | 134 bool fHaveCalledOnceBeforeDraw; |
125 SkMatrix fStarterMatrix; | 135 SkMatrix fStarterMatrix; |
126 }; | 136 }; |
127 | 137 |
128 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; | 138 typedef SkTRegistry<GM*(*)(void*)> GMRegistry; |
129 } | 139 } |
130 | 140 |
131 #endif | 141 #endif |
OLD | NEW |