OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "GrTestUtils.h" |
| 9 #include "SkMatrix.h" |
| 10 |
| 11 namespace GrTest { |
| 12 const SkMatrix& TestMatrix(SkRandom* random) { |
| 13 static SkMatrix gMatrices[5]; |
| 14 static bool gOnce; |
| 15 if (!gOnce) { |
| 16 gMatrices[0].reset(); |
| 17 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); |
| 18 gMatrices[2].setRotate(SkIntToScalar(17)); |
| 19 gMatrices[3].setRotate(SkIntToScalar(185)); |
| 20 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); |
| 21 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); |
| 22 gMatrices[4].setRotate(SkIntToScalar(215)); |
| 23 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); |
| 24 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); |
| 25 gOnce = true; |
| 26 } |
| 27 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(
gMatrices)))]; |
| 28 } |
| 29 }; |
OLD | NEW |