Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: src/gpu/GrTestUtils.cpp

Issue 1109153004: Initial CL to create GrBatchTest infrastructure (Closed) Base URL: https://skia.googlesource.com/skia.git@rand-batch0
Patch Set: adding stroke rect Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrBatchTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
11 namespace GrTest { 11 namespace GrTest {
12 const SkMatrix& TestMatrix(SkRandom* random) { 12 const SkMatrix& TestMatrix(SkRandom* random) {
13 static SkMatrix gMatrices[5]; 13 static SkMatrix gMatrices[5];
14 static bool gOnce; 14 static bool gOnce;
15 if (!gOnce) { 15 if (!gOnce) {
16 gMatrices[0].reset(); 16 gMatrices[0].reset();
17 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); 17 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100));
18 gMatrices[2].setRotate(SkIntToScalar(17)); 18 gMatrices[2].setRotate(SkIntToScalar(17));
19 gMatrices[3].setRotate(SkIntToScalar(185)); 19 gMatrices[3].setRotate(SkIntToScalar(185));
20 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); 20 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33));
21 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); 21 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf);
22 gMatrices[4].setRotate(SkIntToScalar(215)); 22 gMatrices[4].setRotate(SkIntToScalar(215));
23 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); 23 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f);
24 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); 24 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f);
25 gOnce = true; 25 gOnce = true;
26 } 26 }
27 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))]; 27 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))];
28 } 28 }
29
30 const SkRect& TestRect(SkRandom* random) {
31 static SkRect gRects[1];
32 static bool gOnce;
33 // Right now just a normal rect, we could test invalid / empty rects too
34 if (!gOnce) {
35 gRects[0] = SkRect::MakeWH(1.f, 1.f);
robertphillips 2015/04/29 13:23:01 gRects[1] = SkRect::MakeWH(1.0f, 256.0f); gRects[2
36 gOnce = true;
37 }
38 return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRe cts)))];
39 }
29 }; 40 };
OLDNEW
« no previous file with comments | « src/gpu/GrBatchTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698