OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "Benchmark.h" | 7 #include "Benchmark.h" |
8 #include "SkBitmapSource.h" | 8 #include "SkBitmapSource.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool fIsSmall; | 94 bool fIsSmall; |
95 typedef Benchmark INHERITED; | 95 typedef Benchmark INHERITED; |
96 }; | 96 }; |
97 | 97 |
98 class LightingPointLitDiffuseBench : public LightingBaseBench { | 98 class LightingPointLitDiffuseBench : public LightingBaseBench { |
99 public: | 99 public: |
100 LightingPointLitDiffuseBench(bool small) : INHERITED(small) { | 100 LightingPointLitDiffuseBench(bool small) : INHERITED(small) { |
101 } | 101 } |
102 | 102 |
103 protected: | 103 protected: |
104 const char* onGetName() SK_OVERRIDE { | 104 const char* onGetName() override { |
105 return fIsSmall ? "lightingpointlitdiffuse_small" : "lightingpointlitdif
fuse_large"; | 105 return fIsSmall ? "lightingpointlitdiffuse_small" : "lightingpointlitdif
fuse_large"; |
106 } | 106 } |
107 | 107 |
108 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 108 void onDraw(const int loops, SkCanvas* canvas) override { |
109 draw(loops, canvas, SkLightingImageFilter::CreatePointLitDiffuse(getPoin
tLocation(), | 109 draw(loops, canvas, SkLightingImageFilter::CreatePointLitDiffuse(getPoin
tLocation(), |
110 getWhit
e(), | 110 getWhit
e(), |
111 getSurf
aceScale(), | 111 getSurf
aceScale(), |
112 getKd()
)); | 112 getKd()
)); |
113 } | 113 } |
114 | 114 |
115 private: | 115 private: |
116 typedef LightingBaseBench INHERITED; | 116 typedef LightingBaseBench INHERITED; |
117 }; | 117 }; |
118 | 118 |
119 class LightingDistantLitDiffuseBench : public LightingBaseBench { | 119 class LightingDistantLitDiffuseBench : public LightingBaseBench { |
120 public: | 120 public: |
121 LightingDistantLitDiffuseBench(bool small) : INHERITED(small) { | 121 LightingDistantLitDiffuseBench(bool small) : INHERITED(small) { |
122 } | 122 } |
123 | 123 |
124 protected: | 124 protected: |
125 const char* onGetName() SK_OVERRIDE { | 125 const char* onGetName() override { |
126 return fIsSmall ? "lightingdistantlitdiffuse_small" : "lightingdistantli
tdiffuse_large"; | 126 return fIsSmall ? "lightingdistantlitdiffuse_small" : "lightingdistantli
tdiffuse_large"; |
127 } | 127 } |
128 | 128 |
129 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 129 void onDraw(const int loops, SkCanvas* canvas) override { |
130 draw(loops, canvas, SkLightingImageFilter::CreateDistantLitDiffuse(getDi
stantDirection(), | 130 draw(loops, canvas, SkLightingImageFilter::CreateDistantLitDiffuse(getDi
stantDirection(), |
131 getWh
ite(), | 131 getWh
ite(), |
132 getSu
rfaceScale(), | 132 getSu
rfaceScale(), |
133 getKd
())); | 133 getKd
())); |
134 } | 134 } |
135 | 135 |
136 private: | 136 private: |
137 typedef LightingBaseBench INHERITED; | 137 typedef LightingBaseBench INHERITED; |
138 }; | 138 }; |
139 | 139 |
140 class LightingSpotLitDiffuseBench : public LightingBaseBench { | 140 class LightingSpotLitDiffuseBench : public LightingBaseBench { |
141 public: | 141 public: |
142 LightingSpotLitDiffuseBench(bool small) : INHERITED(small) { | 142 LightingSpotLitDiffuseBench(bool small) : INHERITED(small) { |
143 } | 143 } |
144 | 144 |
145 protected: | 145 protected: |
146 const char* onGetName() SK_OVERRIDE { | 146 const char* onGetName() override { |
147 return fIsSmall ? "lightingspotlitdiffuse_small" : "lightingspotlitdiffu
se_large"; | 147 return fIsSmall ? "lightingspotlitdiffuse_small" : "lightingspotlitdiffu
se_large"; |
148 } | 148 } |
149 | 149 |
150 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 150 void onDraw(const int loops, SkCanvas* canvas) override { |
151 draw(loops, canvas, SkLightingImageFilter::CreateSpotLitDiffuse(getSpotL
ocation(), | 151 draw(loops, canvas, SkLightingImageFilter::CreateSpotLitDiffuse(getSpotL
ocation(), |
152 getSpotT
arget(), | 152 getSpotT
arget(), |
153 getSpotE
xponent(), | 153 getSpotE
xponent(), |
154 getCutof
fAngle(), | 154 getCutof
fAngle(), |
155 getWhite
(), | 155 getWhite
(), |
156 getSurfa
ceScale(), | 156 getSurfa
ceScale(), |
157 getKd())
); | 157 getKd())
); |
158 } | 158 } |
159 | 159 |
160 private: | 160 private: |
161 typedef LightingBaseBench INHERITED; | 161 typedef LightingBaseBench INHERITED; |
162 }; | 162 }; |
163 | 163 |
164 class LightingPointLitSpecularBench : public LightingBaseBench { | 164 class LightingPointLitSpecularBench : public LightingBaseBench { |
165 public: | 165 public: |
166 LightingPointLitSpecularBench(bool small) : INHERITED(small) { | 166 LightingPointLitSpecularBench(bool small) : INHERITED(small) { |
167 } | 167 } |
168 | 168 |
169 protected: | 169 protected: |
170 const char* onGetName() SK_OVERRIDE { | 170 const char* onGetName() override { |
171 return fIsSmall ? "lightingpointlitspecular_small" : "lightingpointlitsp
ecular_large"; | 171 return fIsSmall ? "lightingpointlitspecular_small" : "lightingpointlitsp
ecular_large"; |
172 } | 172 } |
173 | 173 |
174 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 174 void onDraw(const int loops, SkCanvas* canvas) override { |
175 draw(loops, canvas, SkLightingImageFilter::CreatePointLitSpecular(getPoi
ntLocation(), | 175 draw(loops, canvas, SkLightingImageFilter::CreatePointLitSpecular(getPoi
ntLocation(), |
176 getWhi
te(), | 176 getWhi
te(), |
177 getSur
faceScale(), | 177 getSur
faceScale(), |
178 getKs(
), | 178 getKs(
), |
179 getShi
niness())); | 179 getShi
niness())); |
180 } | 180 } |
181 | 181 |
182 private: | 182 private: |
183 typedef LightingBaseBench INHERITED; | 183 typedef LightingBaseBench INHERITED; |
184 }; | 184 }; |
185 | 185 |
186 class LightingDistantLitSpecularBench : public LightingBaseBench { | 186 class LightingDistantLitSpecularBench : public LightingBaseBench { |
187 public: | 187 public: |
188 LightingDistantLitSpecularBench(bool small) : INHERITED(small) { | 188 LightingDistantLitSpecularBench(bool small) : INHERITED(small) { |
189 } | 189 } |
190 | 190 |
191 protected: | 191 protected: |
192 const char* onGetName() SK_OVERRIDE { | 192 const char* onGetName() override { |
193 return fIsSmall ? "lightingdistantlitspecular_small" : "lightingdistantl
itspecular_large"; | 193 return fIsSmall ? "lightingdistantlitspecular_small" : "lightingdistantl
itspecular_large"; |
194 } | 194 } |
195 | 195 |
196 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 196 void onDraw(const int loops, SkCanvas* canvas) override { |
197 draw(loops, canvas, SkLightingImageFilter::CreateDistantLitSpecular(getD
istantDirection(), | 197 draw(loops, canvas, SkLightingImageFilter::CreateDistantLitSpecular(getD
istantDirection(), |
198 getW
hite(), | 198 getW
hite(), |
199 getS
urfaceScale(), | 199 getS
urfaceScale(), |
200 getK
s(), | 200 getK
s(), |
201 getS
hininess())); | 201 getS
hininess())); |
202 } | 202 } |
203 | 203 |
204 private: | 204 private: |
205 typedef LightingBaseBench INHERITED; | 205 typedef LightingBaseBench INHERITED; |
206 }; | 206 }; |
207 | 207 |
208 class LightingSpotLitSpecularBench : public LightingBaseBench { | 208 class LightingSpotLitSpecularBench : public LightingBaseBench { |
209 public: | 209 public: |
210 LightingSpotLitSpecularBench(bool small) : INHERITED(small) { | 210 LightingSpotLitSpecularBench(bool small) : INHERITED(small) { |
211 } | 211 } |
212 | 212 |
213 protected: | 213 protected: |
214 const char* onGetName() SK_OVERRIDE { | 214 const char* onGetName() override { |
215 return fIsSmall ? "lightingspotlitspecular_small" : "lightingspotlitspec
ular_large"; | 215 return fIsSmall ? "lightingspotlitspecular_small" : "lightingspotlitspec
ular_large"; |
216 } | 216 } |
217 | 217 |
218 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 218 void onDraw(const int loops, SkCanvas* canvas) override { |
219 draw(loops, canvas, SkLightingImageFilter::CreateSpotLitSpecular(getSpot
Location(), | 219 draw(loops, canvas, SkLightingImageFilter::CreateSpotLitSpecular(getSpot
Location(), |
220 getSpot
Target(), | 220 getSpot
Target(), |
221 getSpot
Exponent(), | 221 getSpot
Exponent(), |
222 getCuto
ffAngle(), | 222 getCuto
ffAngle(), |
223 getWhit
e(), | 223 getWhit
e(), |
224 getSurf
aceScale(), | 224 getSurf
aceScale(), |
225 getKs()
, | 225 getKs()
, |
226 getShin
iness())); | 226 getShin
iness())); |
227 } | 227 } |
228 | 228 |
229 private: | 229 private: |
230 typedef LightingBaseBench INHERITED; | 230 typedef LightingBaseBench INHERITED; |
231 }; | 231 }; |
232 | 232 |
233 /////////////////////////////////////////////////////////////////////////////// | 233 /////////////////////////////////////////////////////////////////////////////// |
234 | 234 |
235 DEF_BENCH( return new LightingPointLitDiffuseBench(true); ) | 235 DEF_BENCH( return new LightingPointLitDiffuseBench(true); ) |
236 DEF_BENCH( return new LightingPointLitDiffuseBench(false); ) | 236 DEF_BENCH( return new LightingPointLitDiffuseBench(false); ) |
237 DEF_BENCH( return new LightingDistantLitDiffuseBench(true); ) | 237 DEF_BENCH( return new LightingDistantLitDiffuseBench(true); ) |
238 DEF_BENCH( return new LightingDistantLitDiffuseBench(false); ) | 238 DEF_BENCH( return new LightingDistantLitDiffuseBench(false); ) |
239 DEF_BENCH( return new LightingSpotLitDiffuseBench(true); ) | 239 DEF_BENCH( return new LightingSpotLitDiffuseBench(true); ) |
240 DEF_BENCH( return new LightingSpotLitDiffuseBench(false); ) | 240 DEF_BENCH( return new LightingSpotLitDiffuseBench(false); ) |
241 DEF_BENCH( return new LightingPointLitSpecularBench(true); ) | 241 DEF_BENCH( return new LightingPointLitSpecularBench(true); ) |
242 DEF_BENCH( return new LightingPointLitSpecularBench(false); ) | 242 DEF_BENCH( return new LightingPointLitSpecularBench(false); ) |
243 DEF_BENCH( return new LightingDistantLitSpecularBench(true); ) | 243 DEF_BENCH( return new LightingDistantLitSpecularBench(true); ) |
244 DEF_BENCH( return new LightingDistantLitSpecularBench(false); ) | 244 DEF_BENCH( return new LightingDistantLitSpecularBench(false); ) |
245 DEF_BENCH( return new LightingSpotLitSpecularBench(true); ) | 245 DEF_BENCH( return new LightingSpotLitSpecularBench(true); ) |
246 DEF_BENCH( return new LightingSpotLitSpecularBench(false); ) | 246 DEF_BENCH( return new LightingSpotLitSpecularBench(false); ) |
OLD | NEW |