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

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

Issue 1119563002: Add hairlines batch unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@randbatch3
Patch Set: cleanup 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/GrAAHairLinePathRenderer.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 #include "SkPath.h"
10 #include "SkRRect.h" 11 #include "SkRRect.h"
11 12
12 #ifdef GR_TEST_UTILS 13 #ifdef GR_TEST_UTILS
13 14
14 namespace GrTest { 15 namespace GrTest {
15 const SkMatrix& TestMatrix(SkRandom* random) { 16 const SkMatrix& TestMatrix(SkRandom* random) {
16 static SkMatrix gMatrices[5]; 17 static SkMatrix gMatrices[5];
17 static bool gOnce; 18 static bool gOnce;
18 if (!gOnce) { 19 if (!gOnce) {
19 gOnce = true; 20 gOnce = true;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // true round rect with elliptical corners 114 // true round rect with elliptical corners
114 gRRect[3].setRectXY(rectangle, 2.0f, 1.0f); 115 gRRect[3].setRectXY(rectangle, 2.0f, 1.0f);
115 116
116 for (size_t i = 0; i < SK_ARRAY_COUNT(gRRect); i++) { 117 for (size_t i = 0; i < SK_ARRAY_COUNT(gRRect); i++) {
117 SkASSERT(gRRect[i].isSimple()); 118 SkASSERT(gRRect[i].isSimple());
118 } 119 }
119 } 120 }
120 return gRRect[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRR ect)))]; 121 return gRRect[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRR ect)))];
121 } 122 }
122 123
124 const SkPath& TestPath(SkRandom* random) {
125 static SkPath gPath[7];
126 static bool gOnce;
127 if (!gOnce) {
128 gOnce = true;
129 // line
130 gPath[0].moveTo(0.f, 0.f);
131 gPath[0].lineTo(10.f, 10.f);
132 // quad
133 gPath[1].moveTo(0.f, 0.f);
134 gPath[1].quadTo(10.f, 10.f, 20.f, 20.f);
135 // conic
136 gPath[2].moveTo(0.f, 0.f);
137 gPath[2].conicTo(10.f, 10.f, 20.f, 20.f, 1.f);
138 // cubic
139 gPath[3].moveTo(0.f, 0.f);
140 gPath[3].cubicTo(10.f, 10.f, 20.f, 20.f, 30.f, 30.f);
141 // all three
142 gPath[4].moveTo(0.f, 0.f);
143 gPath[4].lineTo(10.f, 10.f);
144 gPath[4].quadTo(10.f, 10.f, 20.f, 20.f);
145 gPath[4].conicTo(10.f, 10.f, 20.f, 20.f, 1.f);
146 gPath[4].cubicTo(10.f, 10.f, 20.f, 20.f, 30.f, 30.f);
147 // convex
148 gPath[5].moveTo(0.0f, 0.0f);
149 gPath[5].lineTo(10.0f, 0.0f);
150 gPath[5].lineTo(10.0f, 10.0f);
151 gPath[5].lineTo(0.0f, 10.0f);
152 gPath[5].close();
153 // concave
154 gPath[6].moveTo(0.0f, 0.0f);
155 gPath[6].lineTo(5.0f, 5.0f);
156 gPath[6].lineTo(10.0f, 0.0f);
157 gPath[6].lineTo(10.0f, 10.0f);
158 gPath[6].lineTo(0.0f, 10.0f);
159 gPath[6].close();
160 }
161
162 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPat h)))];
163 }
164
123 }; 165 };
124 166
125 #endif 167 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698