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

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

Issue 1108053004: Add dash lines batch unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@randbatch1
Patch Set: tweaks 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/GrStrokeInfo.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | 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
(...skipping 11 matching lines...) Expand all
22 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); 22 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33));
23 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); 23 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf);
24 gMatrices[4].setRotate(SkIntToScalar(215)); 24 gMatrices[4].setRotate(SkIntToScalar(215));
25 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); 25 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f);
26 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); 26 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f);
27 gOnce = true; 27 gOnce = true;
28 } 28 }
29 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))]; 29 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))];
30 } 30 }
31 31
32 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom* random) {
33 static SkMatrix gMatrices[4];
34 static bool gOnce;
35 if (!gOnce) {
36 // identity
37 gMatrices[0].reset();
38 // translation
39 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100));
40 // scale
41 gMatrices[2].setScale(SkIntToScalar(17), SkIntToScalar(17));
42 // scale + translation
43 gMatrices[3].setScale(SkIntToScalar(-17), SkIntToScalar(-17));
44 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33));
45 // orthogonal basis vectors
46 gMatrices[4].reset();
47 gMatrices[4].setScale(SkIntToScalar(-1), SkIntToScalar(-1));
48 gMatrices[4].setRotate(47);
brucedawson 2015/04/30 20:19:06 These three lines of code reference gMatrices[4] b
49 gOnce = true;
50
51 for (size_t i = 0; i < SK_ARRAY_COUNT(gMatrices); i++) {
52 SkASSERT(gMatrices[i].preservesRightAngles());
53 }
54 }
55 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))];
56 }
57
32 const SkRect& TestRect(SkRandom* random) { 58 const SkRect& TestRect(SkRandom* random) {
33 static SkRect gRects[1]; 59 static SkRect gRects[1];
34 static bool gOnce; 60 static bool gOnce;
35 if (!gOnce) { 61 if (!gOnce) {
36 gRects[0] = SkRect::MakeWH(1.f, 1.f); 62 gRects[0] = SkRect::MakeWH(1.f, 1.f);
37 gRects[1] = SkRect::MakeWH(1.0f, 256.0f); 63 gRects[1] = SkRect::MakeWH(1.0f, 256.0f);
38 gRects[2] = SkRect::MakeWH(256.0f, 1.0f); 64 gRects[2] = SkRect::MakeWH(256.0f, 1.0f);
39 gRects[4] = SkRect::MakeLargest(); 65 gRects[4] = SkRect::MakeLargest();
40 gRects[5] = SkRect::MakeLTRB(-65535.0f, -65535.0f, 65535.0f, 65535.0f); 66 gRects[5] = SkRect::MakeLTRB(-65535.0f, -65535.0f, 65535.0f, 65535.0f);
41 gRects[6] = SkRect::MakeLTRB(10.0f, 10.0f, -10.0f, -10.0f); 67 gRects[6] = SkRect::MakeLTRB(10.0f, 10.0f, -10.0f, -10.0f);
42 gOnce = true; 68 gOnce = true;
43 } 69 }
44 return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRe cts)))]; 70 return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRe cts)))];
45 } 71 }
46 }; 72 };
47 73
48 #endif 74 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStrokeInfo.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698