| /* |
| * Copyright 2015 Google Inc. |
| * |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| */ |
| |
| #include "GrTestUtils.h" |
| #include "SkMatrix.h" |
| |
| namespace GrTest { |
| const SkMatrix& TestMatrix(SkRandom* random) { |
| static SkMatrix gMatrices[5]; |
| static bool gOnce; |
| if (!gOnce) { |
| gMatrices[0].reset(); |
| gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); |
| gMatrices[2].setRotate(SkIntToScalar(17)); |
| gMatrices[3].setRotate(SkIntToScalar(185)); |
| gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); |
| gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); |
| gMatrices[4].setRotate(SkIntToScalar(215)); |
| gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); |
| gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); |
| gOnce = true; |
| } |
| return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; |
| } |
| }; |