Index: bench/Matrix44Bench.cpp |
=================================================================== |
--- bench/Matrix44Bench.cpp (revision 10801) |
+++ bench/Matrix44Bench.cpp (working copy) |
@@ -79,22 +79,22 @@ |
class InvertMatrix44Bench : public Matrix44Bench { |
public: |
InvertMatrix44Bench(void* param) : INHERITED(param, "invert") { |
- fM0.set(0, 0, -1.1); |
- fM0.set(0, 1, 2.1); |
- fM0.set(0, 2, -3.1); |
- fM0.set(0, 3, 4.1); |
- fM0.set(1, 0, 5.1); |
- fM0.set(1, 1, -6.1); |
- fM0.set(1, 2, 7.1); |
- fM0.set(1, 3, 8.1); |
- fM0.set(2, 0, -9.1); |
- fM0.set(2, 1, 10.1); |
- fM0.set(2, 2, 11.1); |
- fM0.set(2, 3, -12.1); |
- fM0.set(3, 0, -13.1); |
- fM0.set(3, 1, 14.1); |
- fM0.set(3, 2, -15.1); |
- fM0.set(3, 3, 16.1); |
+ fM0.set(0, 0, -1.1); |
+ fM0.set(0, 1, 2.1); |
+ fM0.set(0, 2, -3.1); |
+ fM0.set(0, 3, 4.1); |
+ fM0.set(1, 0, 5.1); |
+ fM0.set(1, 1, -6.1); |
+ fM0.set(1, 2, 7.1); |
+ fM0.set(1, 3, 8.1); |
+ fM0.set(2, 0, -9.1); |
+ fM0.set(2, 1, 10.1); |
+ fM0.set(2, 2, 11.1); |
+ fM0.set(2, 3, -12.1); |
+ fM0.set(3, 0, -13.1); |
+ fM0.set(3, 1, 14.1); |
+ fM0.set(3, 2, -15.1); |
+ fM0.set(3, 3, 16.1); |
} |
protected: |
virtual void performTest() { |
@@ -107,6 +107,75 @@ |
typedef Matrix44Bench INHERITED; |
}; |
+class InvertAffineMatrix44Bench : public Matrix44Bench { |
+public: |
+ InvertAffineMatrix44Bench(void* param) : INHERITED(param, "invertaffine") { |
+ fM0.set(0, 0, -1.1); |
+ fM0.set(0, 1, 2.1); |
+ fM0.set(0, 2, -3.1); |
+ fM0.set(0, 3, 4.1); |
+ fM0.set(1, 0, 5.1); |
+ fM0.set(1, 1, -6.1); |
+ fM0.set(1, 2, 7.1); |
+ fM0.set(1, 3, 8.1); |
+ fM0.set(2, 0, -9.1); |
+ fM0.set(2, 1, 10.1); |
+ fM0.set(2, 2, 11.1); |
+ fM0.set(2, 3, -12.1); |
+ // bottom row (perspective component) remains (0, 0, 0, 1). |
+ } |
+protected: |
+ virtual void performTest() { |
+ for (int i = 0; i < 10; ++i) { |
+ fM0.invert(&fM1); |
+ } |
+ } |
+private: |
+ SkMatrix44 fM0, fM1; |
+ typedef Matrix44Bench INHERITED; |
+}; |
+ |
+class InvertScaleTranslateMatrix44Bench : public Matrix44Bench { |
+public: |
+ InvertScaleTranslateMatrix44Bench(void* param) : INHERITED(param, "invertscaletranslate") { |
+ fM0.set(0, 0, -1.1); |
+ fM0.set(0, 3, 4.1); |
+ |
+ fM0.set(1, 1, -6.1); |
+ fM0.set(1, 3, 8.1); |
+ |
+ fM0.set(2, 2, 11.1); |
+ fM0.set(2, 3, -12.1); |
+ } |
+protected: |
+ virtual void performTest() { |
+ for (int i = 0; i < 10; ++i) { |
+ fM0.invert(&fM1); |
+ } |
+ } |
+private: |
+ SkMatrix44 fM0, fM1; |
+ typedef Matrix44Bench INHERITED; |
+}; |
+ |
+class InvertTranslateMatrix44Bench : public Matrix44Bench { |
+public: |
+ InvertTranslateMatrix44Bench(void* param) : INHERITED(param, "inverttranslate") { |
+ fM0.set(0, 3, 4.1); |
+ fM0.set(1, 3, 8.1); |
+ fM0.set(2, 3, -12.1); |
+ } |
+protected: |
+ virtual void performTest() { |
+ for (int i = 0; i < 10; ++i) { |
+ fM0.invert(&fM1); |
+ } |
+ } |
+private: |
+ SkMatrix44 fM0, fM1; |
+ typedef Matrix44Bench INHERITED; |
+}; |
+ |
class PostScaleMatrix44Bench : public Matrix44Bench { |
public: |
PostScaleMatrix44Bench(void* param) : INHERITED(param, "postscale") { |
@@ -167,5 +236,8 @@ |
DEF_BENCH( return new PreScaleMatrix44Bench(p); ) |
DEF_BENCH( return new PostScaleMatrix44Bench(p); ) |
DEF_BENCH( return new InvertMatrix44Bench(p); ) |
+DEF_BENCH( return new InvertAffineMatrix44Bench(p); ) |
+DEF_BENCH( return new InvertScaleTranslateMatrix44Bench(p); ) |
+DEF_BENCH( return new InvertTranslateMatrix44Bench(p); ) |
DEF_BENCH( return new SetConcatMatrix44Bench(p); ) |
DEF_BENCH( return new GetTypeMatrix44Bench(p); ) |