| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 scales[0] = -5; | 232 scales[0] = -5; |
| 233 scales[1] = -5; | 233 scales[1] = -5; |
| 234 success = perspY.getMinMaxScales(scales); | 234 success = perspY.getMinMaxScales(scales); |
| 235 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]); |
| 236 | 236 |
| 237 SkMatrix baseMats[] = {scale, rot90Scale, rotate, | 237 SkMatrix baseMats[] = {scale, rot90Scale, rotate, |
| 238 translate, perspX, perspY}; | 238 translate, perspX, perspY}; |
| 239 SkMatrix mats[2*SK_ARRAY_COUNT(baseMats)]; | 239 SkMatrix mats[2*SK_ARRAY_COUNT(baseMats)]; |
| 240 for (size_t i = 0; i < SK_ARRAY_COUNT(baseMats); ++i) { | 240 for (size_t i = 0; i < SK_ARRAY_COUNT(baseMats); ++i) { |
| 241 mats[i] = baseMats[i]; | 241 mats[i] = baseMats[i]; |
| 242 bool invertable = mats[i].invert(&mats[i + SK_ARRAY_COUNT(baseMats)]); | 242 bool invertible = mats[i].invert(&mats[i + SK_ARRAY_COUNT(baseMats)]); |
| 243 REPORTER_ASSERT(reporter, invertable); | 243 REPORTER_ASSERT(reporter, invertible); |
| 244 } | 244 } |
| 245 SkRandom rand; | 245 SkRandom rand; |
| 246 for (int m = 0; m < 1000; ++m) { | 246 for (int m = 0; m < 1000; ++m) { |
| 247 SkMatrix mat; | 247 SkMatrix mat; |
| 248 mat.reset(); | 248 mat.reset(); |
| 249 for (int i = 0; i < 4; ++i) { | 249 for (int i = 0; i < 4; ++i) { |
| 250 int x = rand.nextU() % SK_ARRAY_COUNT(mats); | 250 int x = rand.nextU() % SK_ARRAY_COUNT(mats); |
| 251 mat.postConcat(mats[x]); | 251 mat.postConcat(mats[x]); |
| 252 } | 252 } |
| 253 | 253 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 | 983 |
| 984 mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2); | 984 mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2); |
| 985 dst[0].sort(); | 985 dst[0].sort(); |
| 986 mat.mapRect(&dst[1], src); | 986 mat.mapRect(&dst[1], src); |
| 987 mat.mapRectScaleTranslate(&dst[2], src); | 987 mat.mapRectScaleTranslate(&dst[2], src); |
| 988 | 988 |
| 989 REPORTER_ASSERT(r, dst[0] == dst[1]); | 989 REPORTER_ASSERT(r, dst[0] == dst[1]); |
| 990 REPORTER_ASSERT(r, dst[0] == dst[2]); | 990 REPORTER_ASSERT(r, dst[0] == dst[2]); |
| 991 } | 991 } |
| 992 } | 992 } |
| OLD | NEW |