| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |