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

Side by Side Diff: bench/MatrixBench.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « bench/ColorFilterBench.cpp ('k') | bench/MatrixConvolutionBench.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 /* 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 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkMatrixUtils.h" 10 #include "SkMatrixUtils.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 always_do(m1 == m2); 67 always_do(m1 == m2);
68 always_do(m2 == m0); 68 always_do(m2 == m0);
69 } 69 }
70 private: 70 private:
71 typedef MatrixBench INHERITED; 71 typedef MatrixBench INHERITED;
72 }; 72 };
73 73
74 class ScaleMatrixBench : public MatrixBench { 74 class ScaleMatrixBench : public MatrixBench {
75 public: 75 public:
76 ScaleMatrixBench() : INHERITED("scale") { 76 ScaleMatrixBench() : INHERITED("scale") {
77 fSX = fSY = SkFloatToScalar(1.5f); 77 fSX = fSY = 1.5f;
78 fM0.reset(); 78 fM0.reset();
79 fM1.setScale(fSX, fSY); 79 fM1.setScale(fSX, fSY);
80 fM2.setTranslate(fSX, fSY); 80 fM2.setTranslate(fSX, fSY);
81 } 81 }
82 protected: 82 protected:
83 virtual void performTest() { 83 virtual void performTest() {
84 SkMatrix m; 84 SkMatrix m;
85 m = fM0; m.preScale(fSX, fSY); 85 m = fM0; m.preScale(fSX, fSY);
86 m = fM1; m.preScale(fSX, fSY); 86 m = fM1; m.preScale(fSX, fSY);
87 m = fM2; m.preScale(fSX, fSY); 87 m = fM2; m.preScale(fSX, fSY);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 }; 376 };
377 377
378 class InvertMapRectMatrixBench : public MatrixBench { 378 class InvertMapRectMatrixBench : public MatrixBench {
379 public: 379 public:
380 InvertMapRectMatrixBench(const char* name, int flags) 380 InvertMapRectMatrixBench(const char* name, int flags)
381 : INHERITED(name) 381 : INHERITED(name)
382 , fFlags(flags) { 382 , fFlags(flags) {
383 fMatrix.reset(); 383 fMatrix.reset();
384 fIteration = 0; 384 fIteration = 0;
385 if (flags & kScale_Flag) { 385 if (flags & kScale_Flag) {
386 fMatrix.postScale(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f)); 386 fMatrix.postScale(1.5f, 2.5f);
387 } 387 }
388 if (flags & kTranslate_Flag) { 388 if (flags & kTranslate_Flag) {
389 fMatrix.postTranslate(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f)); 389 fMatrix.postTranslate(1.5f, 2.5f);
390 } 390 }
391 if (flags & kRotate_Flag) { 391 if (flags & kRotate_Flag) {
392 fMatrix.postRotate(SkFloatToScalar(45.0f)); 392 fMatrix.postRotate(45.0f);
393 } 393 }
394 if (flags & kPerspective_Flag) { 394 if (flags & kPerspective_Flag) {
395 fMatrix.setPerspX(SkFloatToScalar(1.5f)); 395 fMatrix.setPerspX(1.5f);
396 fMatrix.setPerspY(SkFloatToScalar(2.5f)); 396 fMatrix.setPerspY(2.5f);
397 } 397 }
398 if (0 == (flags & kUncachedTypeMask_Flag)) { 398 if (0 == (flags & kUncachedTypeMask_Flag)) {
399 fMatrix.getType(); 399 fMatrix.getType();
400 } 400 }
401 } 401 }
402 enum Flag { 402 enum Flag {
403 kScale_Flag = 0x01, 403 kScale_Flag = 0x01,
404 kTranslate_Flag = 0x02, 404 kTranslate_Flag = 0x02,
405 kRotate_Flag = 0x04, 405 kRotate_Flag = 0x04,
406 kPerspective_Flag = 0x08, 406 kPerspective_Flag = 0x08,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 DEF_BENCH( return new InvertMapRectMatrixBench( 470 DEF_BENCH( return new InvertMapRectMatrixBench(
471 "invert_maprect_typemask_nonpersp", 471 "invert_maprect_typemask_nonpersp",
472 InvertMapRectMatrixBench::kUncachedTypeMask_Flag | 472 InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
473 InvertMapRectMatrixBench::kScale_Flag | 473 InvertMapRectMatrixBench::kScale_Flag |
474 InvertMapRectMatrixBench::kRotate_Flag | 474 InvertMapRectMatrixBench::kRotate_Flag |
475 InvertMapRectMatrixBench::kTranslate_Flag); ) 475 InvertMapRectMatrixBench::kTranslate_Flag); )
476 476
477 DEF_BENCH( return new ScaleTransMixedMatrixBench(); ) 477 DEF_BENCH( return new ScaleTransMixedMatrixBench(); )
478 DEF_BENCH( return new ScaleTransDoubleMatrixBench(); ) 478 DEF_BENCH( return new ScaleTransDoubleMatrixBench(); )
OLDNEW
« no previous file with comments | « bench/ColorFilterBench.cpp ('k') | bench/MatrixConvolutionBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698