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;
75 // Modify pts[] in place so that it is clipped in Y to the clip rect
76 static void chop_quad_in_Y(SkPoint pts[3], const SkRect& clip) {
81 if (pts[0].fY < clip.fTop) {
82 if (chopMonoQuadAtY(pts, clip.fTop, &t)) {
86 tmp[2].fY = clip.fTop;
87 clamp_ge(tmp[3].fY, clip.fTop);
95 if (pts[i].fY < clip.fTop) {
96 pts[i].fY = clip.fTop;
103 if (pts[2].fY > clip.fBottom) {
104 if (chopMonoQuadAtY(pts, clip.fBottom, &t)) {
107 clamp_le(tmp[1].fY, clip.fBottom);
108 tmp[2].fY = clip.fBottom;
116 if (pts[i].fY > clip.fBottom) {
117 pts[i].fY = clip.fBottom;
125 void SkEdgeClipper::clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip) {
130 if (pts[2].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
134 // Now chop so that pts is contained within clip in Y
135 chop_quad_in_Y(pts, clip);
146 if (pts[2].fX <= clip.fLeft) { // wholly to the left
147 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse);
150 if (pts[0].fX >= clip.fRight) { // wholly to the right
151 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
159 if (pts[0].fX < clip.fLeft) {
160 if (chopMonoQuadAtX(pts, clip.fLeft, &t)) {
162 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[2].fY, reverse);
164 tmp[2].fX = clip.fLeft;
165 clamp_ge(tmp[3].fX, clip.fLeft);
172 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse);
178 if (pts[2].fX > clip.fRight) {
179 if (chopMonoQuadAtX(pts, clip.fRight, &t)) {
182 clamp_le(tmp[1].fX, clip.fRight);
183 tmp[2].fX = clip.fRight;
186 this->appendVLine(clip.fRight, tmp[2].fY, tmp[4].fY, reverse);
190 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
192 } else { // wholly inside the clip
197 bool SkEdgeClipper::clipQuad(const SkPoint srcPts[3], const SkRect& clip) {
204 if (!quick_reject(bounds, clip)) {
211 this->clipMonoQuad(&monoX[x * 2], clip);
276 // Modify pts[] in place so that it is clipped in Y to the clip rect
277 static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
280 if (pts[0].fY < clip.fTop) {
282 if (chopMonoCubicAtY(pts, clip.fTop, &t)) {
286 // tmp[3, 4, 5].fY should all be to the below clip.fTop.
289 tmp[3].fY = clip.fTop;
290 clamp_ge(tmp[4].fY, clip.fTop);
291 clamp_ge(tmp[5].fY, clip.fTop);
300 clamp_ge(pts[i].fY, clip.fTop);
306 if (pts[3].fY > clip.fBottom) {
308 if (chopMonoCubicAtY(pts, clip.fBottom, &t)) {
311 tmp[3].fY = clip.fBottom;
312 clamp_le(tmp[2].fY, clip.fBottom);
321 clamp_le(pts[i].fY, clip.fBottom);
328 void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
333 if (pts[3].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
337 // Now chop so that pts is contained within clip in Y
338 chop_cubic_in_Y(pts, clip);
348 if (pts[3].fX <= clip.fLeft) { // wholly to the left
349 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
352 if (pts[0].fX >= clip.fRight) { // wholly to the right
353 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
358 if (pts[0].fX < clip.fLeft) {
360 if (chopMonoCubicAtX(pts, clip.fLeft, &t)) {
363 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse);
365 // tmp[3, 4, 5].fX should all be to the right of clip.fLeft.
368 tmp[3].fX = clip.fLeft;
369 clamp_ge(tmp[4].fX, clip.fLeft);
370 clamp_ge(tmp[5].fX, clip.fLeft);
378 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
384 if (pts[3].fX > clip.fRight) {
386 if (chopMonoCubicAtX(pts, clip.fRight, &t)) {
389 tmp[3].fX = clip.fRight;
390 clamp_le(tmp[2].fX, clip.fRight);
391 clamp_le(tmp[1].fX, clip.fRight);
394 this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse);
398 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
400 } else { // wholly inside the clip
405 bool SkEdgeClipper::clipCubic(const SkPoint srcPts[4], const SkRect& clip) {
412 if (!quick_reject(bounds, clip)) {
419 this->clipMonoCubic(&monoX[x * 3], clip);