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

Side by Side Diff: bench/Matrix44Bench.cpp

Issue 1173673003: A bunch of little SkMScalar-as-float build fixes. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: 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 | « no previous file | include/core/SkFloatingPoint.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkMatrix44.h" 9 #include "SkMatrix44.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 typedef Matrix44Bench INHERITED; 109 typedef Matrix44Bench INHERITED;
110 }; 110 };
111 111
112 class InvertMatrix44Bench : public Matrix44Bench { 112 class InvertMatrix44Bench : public Matrix44Bench {
113 public: 113 public:
114 InvertMatrix44Bench() 114 InvertMatrix44Bench()
115 : INHERITED("invert") 115 : INHERITED("invert")
116 , fM0(SkMatrix44::kUninitialized_Constructor) 116 , fM0(SkMatrix44::kUninitialized_Constructor)
117 , fM1(SkMatrix44::kUninitialized_Constructor) 117 , fM1(SkMatrix44::kUninitialized_Constructor)
118 { 118 {
119 fM0.set(0, 0, -1.1); 119 fM0.setDouble(0, 0, -1.1);
120 fM0.set(0, 1, 2.1); 120 fM0.setDouble(0, 1, 2.1);
121 fM0.set(0, 2, -3.1); 121 fM0.setDouble(0, 2, -3.1);
122 fM0.set(0, 3, 4.1); 122 fM0.setDouble(0, 3, 4.1);
123 fM0.set(1, 0, 5.1); 123 fM0.setDouble(1, 0, 5.1);
124 fM0.set(1, 1, -6.1); 124 fM0.setDouble(1, 1, -6.1);
125 fM0.set(1, 2, 7.1); 125 fM0.setDouble(1, 2, 7.1);
126 fM0.set(1, 3, 8.1); 126 fM0.setDouble(1, 3, 8.1);
127 fM0.set(2, 0, -9.1); 127 fM0.setDouble(2, 0, -9.1);
128 fM0.set(2, 1, 10.1); 128 fM0.setDouble(2, 1, 10.1);
129 fM0.set(2, 2, 11.1); 129 fM0.setDouble(2, 2, 11.1);
130 fM0.set(2, 3, -12.1); 130 fM0.setDouble(2, 3, -12.1);
131 fM0.set(3, 0, -13.1); 131 fM0.setDouble(3, 0, -13.1);
132 fM0.set(3, 1, 14.1); 132 fM0.setDouble(3, 1, 14.1);
133 fM0.set(3, 2, -15.1); 133 fM0.setDouble(3, 2, -15.1);
134 fM0.set(3, 3, 16.1); 134 fM0.setDouble(3, 3, 16.1);
135 } 135 }
136 protected: 136 protected:
137 virtual void performTest() { 137 virtual void performTest() {
138 for (int i = 0; i < 10; ++i) { 138 for (int i = 0; i < 10; ++i) {
139 fM0.invert(&fM1); 139 fM0.invert(&fM1);
140 } 140 }
141 } 141 }
142 private: 142 private:
143 SkMatrix44 fM0, fM1; 143 SkMatrix44 fM0, fM1;
144 typedef Matrix44Bench INHERITED; 144 typedef Matrix44Bench INHERITED;
145 }; 145 };
146 146
147 class InvertAffineMatrix44Bench : public Matrix44Bench { 147 class InvertAffineMatrix44Bench : public Matrix44Bench {
148 public: 148 public:
149 InvertAffineMatrix44Bench() 149 InvertAffineMatrix44Bench()
150 : INHERITED("invertaffine") 150 : INHERITED("invertaffine")
151 , fM0(SkMatrix44::kIdentity_Constructor) 151 , fM0(SkMatrix44::kIdentity_Constructor)
152 , fM1(SkMatrix44::kUninitialized_Constructor) 152 , fM1(SkMatrix44::kUninitialized_Constructor)
153 { 153 {
154 fM0.set(0, 0, -1.1); 154 fM0.setDouble(0, 0, -1.1);
155 fM0.set(0, 1, 2.1); 155 fM0.setDouble(0, 1, 2.1);
156 fM0.set(0, 2, -3.1); 156 fM0.setDouble(0, 2, -3.1);
157 fM0.set(0, 3, 4.1); 157 fM0.setDouble(0, 3, 4.1);
158 fM0.set(1, 0, 5.1); 158 fM0.setDouble(1, 0, 5.1);
159 fM0.set(1, 1, -6.1); 159 fM0.setDouble(1, 1, -6.1);
160 fM0.set(1, 2, 7.1); 160 fM0.setDouble(1, 2, 7.1);
161 fM0.set(1, 3, 8.1); 161 fM0.setDouble(1, 3, 8.1);
162 fM0.set(2, 0, -9.1); 162 fM0.setDouble(2, 0, -9.1);
163 fM0.set(2, 1, 10.1); 163 fM0.setDouble(2, 1, 10.1);
164 fM0.set(2, 2, 11.1); 164 fM0.setDouble(2, 2, 11.1);
165 fM0.set(2, 3, -12.1); 165 fM0.setDouble(2, 3, -12.1);
166 // bottom row (perspective component) remains (0, 0, 0, 1). 166 // bottom row (perspective component) remains (0, 0, 0, 1).
167 } 167 }
168 protected: 168 protected:
169 virtual void performTest() { 169 virtual void performTest() {
170 for (int i = 0; i < 10; ++i) { 170 for (int i = 0; i < 10; ++i) {
171 fM0.invert(&fM1); 171 fM0.invert(&fM1);
172 } 172 }
173 } 173 }
174 private: 174 private:
175 SkMatrix44 fM0, fM1; 175 SkMatrix44 fM0, fM1;
176 typedef Matrix44Bench INHERITED; 176 typedef Matrix44Bench INHERITED;
177 }; 177 };
178 178
179 class InvertScaleTranslateMatrix44Bench : public Matrix44Bench { 179 class InvertScaleTranslateMatrix44Bench : public Matrix44Bench {
180 public: 180 public:
181 InvertScaleTranslateMatrix44Bench() 181 InvertScaleTranslateMatrix44Bench()
182 : INHERITED("invertscaletranslate") 182 : INHERITED("invertscaletranslate")
183 , fM0(SkMatrix44::kIdentity_Constructor) 183 , fM0(SkMatrix44::kIdentity_Constructor)
184 , fM1(SkMatrix44::kUninitialized_Constructor) 184 , fM1(SkMatrix44::kUninitialized_Constructor)
185 { 185 {
186 fM0.set(0, 0, -1.1); 186 fM0.setDouble(0, 0, -1.1);
187 fM0.set(0, 3, 4.1); 187 fM0.setDouble(0, 3, 4.1);
188 188
189 fM0.set(1, 1, -6.1); 189 fM0.setDouble(1, 1, -6.1);
190 fM0.set(1, 3, 8.1); 190 fM0.setDouble(1, 3, 8.1);
191 191
192 fM0.set(2, 2, 11.1); 192 fM0.setDouble(2, 2, 11.1);
193 fM0.set(2, 3, -12.1); 193 fM0.setDouble(2, 3, -12.1);
194 } 194 }
195 protected: 195 protected:
196 virtual void performTest() { 196 virtual void performTest() {
197 for (int i = 0; i < 10; ++i) { 197 for (int i = 0; i < 10; ++i) {
198 fM0.invert(&fM1); 198 fM0.invert(&fM1);
199 } 199 }
200 } 200 }
201 private: 201 private:
202 SkMatrix44 fM0, fM1; 202 SkMatrix44 fM0, fM1;
203 typedef Matrix44Bench INHERITED; 203 typedef Matrix44Bench INHERITED;
204 }; 204 };
205 205
206 class InvertTranslateMatrix44Bench : public Matrix44Bench { 206 class InvertTranslateMatrix44Bench : public Matrix44Bench {
207 public: 207 public:
208 InvertTranslateMatrix44Bench() 208 InvertTranslateMatrix44Bench()
209 : INHERITED("inverttranslate") 209 : INHERITED("inverttranslate")
210 , fM0(SkMatrix44::kIdentity_Constructor) 210 , fM0(SkMatrix44::kIdentity_Constructor)
211 , fM1(SkMatrix44::kUninitialized_Constructor) 211 , fM1(SkMatrix44::kUninitialized_Constructor)
212 { 212 {
213 fM0.set(0, 3, 4.1); 213 fM0.setDouble(0, 3, 4.1);
214 fM0.set(1, 3, 8.1); 214 fM0.setDouble(1, 3, 8.1);
215 fM0.set(2, 3, -12.1); 215 fM0.setDouble(2, 3, -12.1);
216 } 216 }
217 protected: 217 protected:
218 virtual void performTest() { 218 virtual void performTest() {
219 for (int i = 0; i < 10; ++i) { 219 for (int i = 0; i < 10; ++i) {
220 fM0.invert(&fM1); 220 fM0.invert(&fM1);
221 } 221 }
222 } 222 }
223 private: 223 private:
224 SkMatrix44 fM0, fM1; 224 SkMatrix44 fM0, fM1;
225 typedef Matrix44Bench INHERITED; 225 typedef Matrix44Bench INHERITED;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DEF_BENCH( return new EqualsMatrix44Bench(); ) 305 DEF_BENCH( return new EqualsMatrix44Bench(); )
306 DEF_BENCH( return new PreScaleMatrix44Bench(); ) 306 DEF_BENCH( return new PreScaleMatrix44Bench(); )
307 DEF_BENCH( return new PostScaleMatrix44Bench(); ) 307 DEF_BENCH( return new PostScaleMatrix44Bench(); )
308 DEF_BENCH( return new InvertMatrix44Bench(); ) 308 DEF_BENCH( return new InvertMatrix44Bench(); )
309 DEF_BENCH( return new InvertAffineMatrix44Bench(); ) 309 DEF_BENCH( return new InvertAffineMatrix44Bench(); )
310 DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(); ) 310 DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(); )
311 DEF_BENCH( return new InvertTranslateMatrix44Bench(); ) 311 DEF_BENCH( return new InvertTranslateMatrix44Bench(); )
312 DEF_BENCH( return new SetConcatMatrix44Bench(true); ) 312 DEF_BENCH( return new SetConcatMatrix44Bench(true); )
313 DEF_BENCH( return new SetConcatMatrix44Bench(false); ) 313 DEF_BENCH( return new SetConcatMatrix44Bench(false); )
314 DEF_BENCH( return new GetTypeMatrix44Bench(); ) 314 DEF_BENCH( return new GetTypeMatrix44Bench(); )
OLDNEW
« no previous file with comments | « no previous file | include/core/SkFloatingPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698