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
152 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
161 if (pts[0].fX < clip.fLeft) {
162 if (chopMonoQuadAtX(pts, clip.fLeft, &t)) {
164 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[2].fY, reverse);
166 tmp[2].fX = clip.fLeft;
167 clamp_ge(tmp[3].fX, clip.fLeft);
174 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse);
180 if (pts[2].fX > clip.fRight) {
181 if (chopMonoQuadAtX(pts, clip.fRight, &t)) {
184 clamp_le(tmp[1].fX, clip.fRight);
185 tmp[2].fX = clip.fRight;
188 this->appendVLine(clip.fRight, tmp[2].fY, tmp[4].fY, reverse);
192 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
194 } else { // wholly inside the clip
199 bool SkEdgeClipper::clipQuad(const SkPoint srcPts[3], const SkRect& clip) {
206 if (!quick_reject(bounds, clip)) {
213 this->clipMonoQuad(&monoX[x * 2], clip);
228 // Modify pts[] in place so that it is clipped in Y to the clip rect
229 static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
232 if (pts[0].fY < clip.fTop) {
234 if (SkChopMonoCubicAtY(pts, clip.fTop, tmp)) {
235 // tmp[3, 4].fY should all be to the below clip.fTop.
238 tmp[3].fY = clip.fTop;
239 clamp_ge(tmp[4].fY, clip.fTop);
248 clamp_ge(pts[i].fY, clip.fTop);
254 if (pts[3].fY > clip.fBottom) {
256 if (SkChopMonoCubicAtY(pts, clip.fBottom, tmp)) {
257 tmp[3].fY = clip.fBottom;
258 clamp_le(tmp[2].fY, clip.fBottom);
267 clamp_le(pts[i].fY, clip.fBottom);
274 void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
279 if (pts[3].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
283 // Now chop so that pts is contained within clip in Y
284 chop_cubic_in_Y(pts, clip);
294 if (pts[3].fX <= clip.fLeft) { // wholly to the left
295 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
298 if (pts[0].fX >= clip.fRight) { // wholly to the right
300 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
306 if (pts[0].fX < clip.fLeft) {
308 if (SkChopMonoCubicAtX(pts, clip.fLeft, tmp)) {
309 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse);
311 // tmp[3, 4].fX should all be to the right of clip.fLeft.
314 tmp[3].fX = clip.fLeft;
315 clamp_ge(tmp[4].fX, clip.fLeft);
323 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
329 if (pts[3].fX > clip.fRight) {
331 if (SkChopMonoCubicAtX(pts, clip.fRight, tmp)) {
332 tmp[3].fX = clip.fRight;
333 clamp_le(tmp[2].fX, clip.fRight);
336 this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse);
340 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
342 } else { // wholly inside the clip
347 bool SkEdgeClipper::clipCubic(const SkPoint srcPts[4], const SkRect& clip) {
354 if (!quick_reject(bounds, clip)) {
361 this->clipMonoCubic(&monoX[x * 3], clip);