OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkMath.h" | 8 #include "SkMath.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 #include "SkMatrixUtils.h" | 10 #include "SkMatrixUtils.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMinScale()); | 206 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMinScale()); |
207 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMaxScale()); | 207 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMaxScale()); |
208 success = perspX.getMinMaxScales(scales); | 208 success = perspX.getMinMaxScales(scales); |
209 REPORTER_ASSERT(reporter, !success); | 209 REPORTER_ASSERT(reporter, !success); |
210 | 210 |
211 // skbug.com/4718 | 211 // skbug.com/4718 |
212 SkMatrix big; | 212 SkMatrix big; |
213 big.setAll(2.39394089e+36f, 8.85347779e+36f, 9.26526204e+36f, | 213 big.setAll(2.39394089e+36f, 8.85347779e+36f, 9.26526204e+36f, |
214 3.9159619e+36f, 1.44823453e+37f, 1.51559342e+37f, | 214 3.9159619e+36f, 1.44823453e+37f, 1.51559342e+37f, |
215 0.f, 0.f, 1.f); | 215 0.f, 0.f, 1.f); |
216 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMinScale()); | |
217 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMaxScale()); | |
218 success = big.getMinMaxScales(scales); | 216 success = big.getMinMaxScales(scales); |
219 REPORTER_ASSERT(reporter, !success); | 217 REPORTER_ASSERT(reporter, !success); |
220 | 218 |
| 219 // skbug.com/4718 |
| 220 SkMatrix givingNegativeNearlyZeros; |
| 221 givingNegativeNearlyZeros.setAll(0.00436534f, 0.114138f, 0.37141f, |
| 222 0.00358857f, 0.0936228f, -0.0174198f, |
| 223 0.f, 0.f, 1.f); |
| 224 success = givingNegativeNearlyZeros.getMinMaxScales(scales); |
| 225 REPORTER_ASSERT(reporter, success && 0 == scales[0]); |
| 226 |
221 SkMatrix perspY; | 227 SkMatrix perspY; |
222 perspY.reset(); | 228 perspY.reset(); |
223 perspY.setPerspY(-SK_Scalar1 / 500); | 229 perspY.setPerspY(-SK_Scalar1 / 500); |
224 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMinScale()); | 230 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMinScale()); |
225 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMaxScale()); | 231 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMaxScale()); |
226 scales[0] = -5; | 232 scales[0] = -5; |
227 scales[1] = -5; | 233 scales[1] = -5; |
228 success = perspY.getMinMaxScales(scales); | 234 success = perspY.getMinMaxScales(scales); |
229 REPORTER_ASSERT(reporter, !success && -5 * SK_Scalar1 == scales[0] && -5 * S
K_Scalar1 == scales[1]); | 235 REPORTER_ASSERT(reporter, !success && -5 * SK_Scalar1 == scales[0] && -5 * S
K_Scalar1 == scales[1]); |
230 | 236 |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 | 983 |
978 mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2); | 984 mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2); |
979 dst[0].sort(); | 985 dst[0].sort(); |
980 mat.mapRect(&dst[1], src); | 986 mat.mapRect(&dst[1], src); |
981 mat.mapRectScaleTranslate(&dst[2], src); | 987 mat.mapRectScaleTranslate(&dst[2], src); |
982 | 988 |
983 REPORTER_ASSERT(r, dst[0] == dst[1]); | 989 REPORTER_ASSERT(r, dst[0] == dst[1]); |
984 REPORTER_ASSERT(r, dst[0] == dst[2]); | 990 REPORTER_ASSERT(r, dst[0] == dst[2]); |
985 } | 991 } |
986 } | 992 } |
OLD | NEW |