182 {
183 int index0, index1;
184
185 if (pts[0].fY < pts[1].fY) {
186 index0 = 0;
187 index1 = 1;
188 } else {
189 index0 = 1;
190 index1 = 0;
191 }
192
193
194
195 if (pts[index1].fY <=
clip.fTop) {
196 return 0;
197 }
198 if (pts[index0].fY >=
clip.fBottom) {
199 return 0;
200 }
201
202
203
205 memcpy(tmp, pts, sizeof(tmp));
206
207
208 if (pts[index0].fY <
clip.fTop) {
210 SkASSERT(is_between_unsorted(tmp[index0].fX, pts[0].fX, pts[1].fX));
211 }
212 if (tmp[index1].fY >
clip.fBottom) {
214 SkASSERT(is_between_unsorted(tmp[index1].fX, pts[0].fX, pts[1].fX));
215 }
216
217
218
219
222 int lineCount = 1;
224
225 if (pts[0].fX < pts[1].fX) {
226 index0 = 0;
227 index1 = 1;
229 } else {
230 index0 = 1;
231 index1 = 0;
233 }
234
235 if (tmp[index1].fX <=
clip.fLeft) {
239 }
else if (tmp[index0].fX >=
clip.fRight) {
240 if (canCullToTheRight) {
241 return 0;
242 }
243 tmp[0].
fX = tmp[1].
fX =
clip.fRight;
246 } else {
249
250 if (tmp[index0].fX <
clip.fLeft) {
251 r->
set(
clip.fLeft, tmp[index0].fY);
252 r += 1;
254 SkASSERT(is_between_unsorted(r->
fY, tmp[0].fY, tmp[1].fY));
255 } else {
256 *r = tmp[index0];
257 }
258 r += 1;
259
260 if (tmp[index1].fX >
clip.fRight) {
262 SkASSERT(is_between_unsorted(r->
fY, tmp[0].fY, tmp[1].fY));
263 r += 1;
264 r->
set(
clip.fRight, tmp[index1].fY);
265 } else {
266 *r = tmp[index1];
267 }
268
270 }
271
272
274
275 for (
int i = 0;
i <= lineCount;
i++) {
277 }
278 } else {
280 }
281 return lineCount;
282}
static SkScalar sect_with_horizontal(const SkPoint src[2], SkScalar Y)
static SkScalar sect_clamp_with_vertical(const SkPoint src[2], SkScalar x)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
constexpr int SkToInt(S x)
void set(float x, float y)