OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTestUtils.h" | 8 #include "GrTestUtils.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // 90 degress rotation | 76 // 90 degress rotation |
77 gMatrices[5].setRotate(90); | 77 gMatrices[5].setRotate(90); |
78 | 78 |
79 for (size_t i = 0; i < SK_ARRAY_COUNT(gMatrices); i++) { | 79 for (size_t i = 0; i < SK_ARRAY_COUNT(gMatrices); i++) { |
80 SkASSERT(gMatrices[i].rectStaysRect()); | 80 SkASSERT(gMatrices[i].rectStaysRect()); |
81 } | 81 } |
82 } | 82 } |
83 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))]; | 83 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))]; |
84 } | 84 } |
85 | 85 |
86 SkMatrix TestMatrixInvertible(SkRandom* random) { | |
robertphillips
2015/05/07 16:59:29
Isn't this pretty much guaranteed to kill RVO?
| |
87 SkMatrix result; | |
88 SkMatrix dummy; | |
89 do { | |
90 result = TestMatrix(random); | |
91 } while (!result.invert(&dummy)); | |
92 return result; | |
93 } | |
94 | |
86 const SkRect& TestRect(SkRandom* random) { | 95 const SkRect& TestRect(SkRandom* random) { |
87 static SkRect gRects[7]; | 96 static SkRect gRects[7]; |
88 static bool gOnce; | 97 static bool gOnce; |
89 if (!gOnce) { | 98 if (!gOnce) { |
90 gOnce = true; | 99 gOnce = true; |
91 gRects[0] = SkRect::MakeWH(1.f, 1.f); | 100 gRects[0] = SkRect::MakeWH(1.f, 1.f); |
92 gRects[1] = SkRect::MakeWH(1.0f, 256.0f); | 101 gRects[1] = SkRect::MakeWH(1.0f, 256.0f); |
93 gRects[2] = SkRect::MakeWH(256.0f, 1.0f); | 102 gRects[2] = SkRect::MakeWH(256.0f, 1.0f); |
94 gRects[4] = SkRect::MakeLargest(); | 103 gRects[4] = SkRect::MakeLargest(); |
95 gRects[5] = SkRect::MakeLTRB(-65535.0f, -65535.0f, 65535.0f, 65535.0f); | 104 gRects[5] = SkRect::MakeLTRB(-65535.0f, -65535.0f, 65535.0f, 65535.0f); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 gPath[6].lineTo(0.0f, 10.0f); | 167 gPath[6].lineTo(0.0f, 10.0f); |
159 gPath[6].close(); | 168 gPath[6].close(); |
160 } | 169 } |
161 | 170 |
162 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPat h)))]; | 171 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPat h)))]; |
163 } | 172 } |
164 | 173 |
165 }; | 174 }; |
166 | 175 |
167 #endif | 176 #endif |
OLD | NEW |