Home | History | Annotate | Download | only in core

Lines Matching refs:clip

13 static bool quick_reject(const SkRect& bounds, const SkRect& clip) {
14 return bounds.fTop >= clip.fBottom || bounds.fBottom <= clip.fTop;
46 bool SkEdgeClipper::clipLine(SkPoint p0, SkPoint p1, const SkRect& clip) {
52 int lineCount = SkLineClipper::ClipLine(pts, clip, lines, fCanCullToTheRight);
92 // Modify pts[] in place so that it is clipped in Y to the clip rect
93 static void chop_quad_in_Y(SkPoint pts[3], const SkRect& clip) {
98 if (pts[0].fY < clip.fTop) {
99 if (chopMonoQuadAtY(pts, clip.fTop, &t)) {
103 tmp[2].fY = clip.fTop;
104 clamp_ge(tmp[3].fY, clip.fTop);
112 if (pts[i].fY < clip.fTop) {
113 pts[i].fY = clip.fTop;
120 if (pts[2].fY > clip.fBottom) {
121 if (chopMonoQuadAtY(pts, clip.fBottom, &t)) {
124 clamp_le(tmp[1].fY, clip.fBottom);
125 tmp[2].fY = clip.fBottom;
133 if (pts[i].fY > clip.fBottom) {
134 pts[i].fY = clip.fBottom;
142 void SkEdgeClipper::clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip) {
147 if (pts[2].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
151 // Now chop so that pts is contained within clip in Y
152 chop_quad_in_Y(pts, clip);
163 if (pts[2].fX <= clip.fLeft) { // wholly to the left
164 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse);
167 if (pts[0].fX >= clip.fRight) { // wholly to the right
169 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
178 if (pts[0].fX < clip.fLeft) {
179 if (chopMonoQuadAtX(pts, clip.fLeft, &t)) {
181 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[2].fY, reverse);
183 tmp[2].fX = clip.fLeft;
184 clamp_ge(tmp[3].fX, clip.fLeft);
191 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse);
197 if (pts[2].fX > clip.fRight) {
198 if (chopMonoQuadAtX(pts, clip.fRight, &t)) {
201 clamp_le(tmp[1].fX, clip.fRight);
202 tmp[2].fX = clip.fRight;
205 this->appendVLine(clip.fRight, tmp[2].fY, tmp[4].fY, reverse);
209 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
211 } else { // wholly inside the clip
216 bool SkEdgeClipper::clipQuad(const SkPoint srcPts[3], const SkRect& clip) {
223 if (!quick_reject(bounds, clip)) {
230 this->clipMonoQuad(&monoX[x * 2], clip);
277 // Modify pts[] in place so that it is clipped in Y to the clip rect
278 static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
281 if (pts[0].fY < clip.fTop) {
283 chop_mono_cubic_at_y(pts, clip.fTop, tmp);
287 * we computed resulted in the lower cubic still being partly above the clip.
295 if (tmp[3].fY < clip.fTop && tmp[4].fY < clip.fTop && tmp[5].fY < clip.fTop) {
298 chop_mono_cubic_at_y(tmp2, clip.fTop, tmp);
301 // tmp[3, 4].fY should all be to the below clip.fTop.
303 tmp[3].fY = clip.fTop;
304 clamp_ge(tmp[4].fY, clip.fTop);
312 if (pts[3].fY > clip.fBottom) {
314 chop_mono_cubic_at_y(pts, clip.fBottom, tmp);
315 tmp[3].fY = clip.fBottom;
316 clamp_le(tmp[2].fY, clip.fBottom);
332 void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
337 if (pts[3].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
341 // Now chop so that pts is contained within clip in Y
342 chop_cubic_in_Y(pts, clip);
352 if (pts[3].fX <= clip.fLeft) { // wholly to the left
353 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
356 if (pts[0].fX >= clip.fRight) { // wholly to the right
358 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
364 if (pts[0].fX < clip.fLeft) {
366 chop_mono_cubic_at_x(pts, clip.fLeft, tmp);
367 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse);
369 // tmp[3, 4].fX should all be to the right of clip.fLeft.
372 tmp[3].fX = clip.fLeft;
373 clamp_ge(tmp[4].fX, clip.fLeft);
381 if (pts[3].fX > clip.fRight) {
383 chop_mono_cubic_at_x(pts, clip.fRight, tmp);
384 tmp[3].fX = clip.fRight;
385 clamp_le(tmp[2].fX, clip.fRight);
388 this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse);
389 } else { // wholly inside the clip
411 bool SkEdgeClipper::clipCubic(const SkPoint srcPts[4], const SkRect& clip) {
417 if (bounds.fBottom > clip.fTop && bounds.fTop < clip.fBottom) {
419 // can't safely clip the cubic, so we give up and draw a line (which we can safely clip)
425 return this->clipLine(srcPts[0], srcPts[3], clip);
433 this->clipMonoCubic(&monoX[x * 3], clip);