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

Side by Side Diff: src/gpu/batches/GrAAHairLinePathRenderer.cpp

Issue 2368993002: allow conic chop to fail (Closed)
Patch Set: address comment Created 4 years, 2 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/core/SkPathMeasure.cpp ('k') | src/pathops/SkOpEdgeBuilder.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 2011 Google Inc. 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 SkScalar t = SkFindQuadMaxCurvature(src); 138 SkScalar t = SkFindQuadMaxCurvature(src);
139 if (t == 0) { 139 if (t == 0) {
140 if (dst) { 140 if (dst) {
141 dst[0].set(src, weight); 141 dst[0].set(src, weight);
142 } 142 }
143 return 1; 143 return 1;
144 } else { 144 } else {
145 if (dst) { 145 if (dst) {
146 SkConic conic; 146 SkConic conic;
147 conic.set(src, weight); 147 conic.set(src, weight);
148 conic.chopAt(t, dst); 148 if (!conic.chopAt(t, dst)) {
149 dst[0].set(src, weight);
150 return 1;
151 }
149 } 152 }
150 return 2; 153 return 2;
151 } 154 }
152 } 155 }
153 156
154 // Calls split_conic on the entire conic and then once more on each subsection. 157 // Calls split_conic on the entire conic and then once more on each subsection.
155 // Most cases will result in either 1 conic (chop point is not within t range) 158 // Most cases will result in either 1 conic (chop point is not within t range)
156 // or 3 points (split once and then one subsection is split again). 159 // or 3 points (split once and then one subsection is split again).
157 static int chop_conic(const SkPoint src[3], SkConic dst[4], const SkScalar weigh t) { 160 static int chop_conic(const SkPoint src[3], SkConic dst[4], const SkScalar weigh t) {
158 SkConic dstTemp[2]; 161 SkConic dstTemp[2];
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) { 984 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) {
982 GrColor color = GrRandomColor(random); 985 GrColor color = GrRandomColor(random);
983 SkMatrix viewMatrix = GrTest::TestMatrix(random); 986 SkMatrix viewMatrix = GrTest::TestMatrix(random);
984 SkPath path = GrTest::TestPath(random); 987 SkPath path = GrTest::TestPath(random);
985 SkIRect devClipBounds; 988 SkIRect devClipBounds;
986 devClipBounds.setEmpty(); 989 devClipBounds.setEmpty();
987 return create_hairline_batch(color, viewMatrix, path, GrStyle::SimpleHairlin e(), devClipBounds); 990 return create_hairline_batch(color, viewMatrix, path, GrStyle::SimpleHairlin e(), devClipBounds);
988 } 991 }
989 992
990 #endif 993 #endif
OLDNEW
« no previous file with comments | « src/core/SkPathMeasure.cpp ('k') | src/pathops/SkOpEdgeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698