Home | History | Annotate | Download | only in core

Lines Matching full: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);
260 // Modify pts[] in place so that it is clipped in Y to the clip rect
261 static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
264 if (pts[0].fY < clip.fTop) {
266 chop_mono_cubic_at_y(pts, clip.fTop, tmp);
267 // tmp[3, 4].fY should all be to the below clip.fTop.
270 tmp[3].fY = clip.fTop;
271 clamp_ge(tmp[4].fY, clip.fTop);
279 if (pts[3].fY > clip.fBottom) {
281 chop_mono_cubic_at_y(pts, clip.fBottom, tmp);
282 tmp[3].fY = clip.fBottom;
283 clamp_le(tmp[2].fY, clip.fBottom);
299 void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
304 if (pts[3].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
308 // Now chop so that pts is contained within clip in Y
309 chop_cubic_in_Y(pts, clip);
319 if (pts[3].fX <= clip.fLeft) { // wholly to the left
320 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
323 if (pts[0].fX >= clip.fRight) { // wholly to the right
325 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
331 if (pts[0].fX < clip.fLeft) {
333 chop_mono_cubic_at_x(pts, clip.fLeft, tmp);
334 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse);
336 // tmp[3, 4].fX should all be to the right of clip.fLeft.
339 tmp[3].fX = clip.fLeft;
340 clamp_ge(tmp[4].fX, clip.fLeft);
348 if (pts[3].fX > clip.fRight) {
350 chop_mono_cubic_at_x(pts, clip.fRight, tmp);
351 tmp[3].fX = clip.fRight;
352 clamp_le(tmp[2].fX, clip.fRight);
355 this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse);
356 } else { // wholly inside the clip
361 static bool quick_reject_in_y(const SkPoint pts[4], const SkRect& clip) {
363 Sk4s t(clip.top());
364 Sk4s b(clip.bottom());
369 bool SkEdgeClipper::clipCubic(const SkPoint srcPts[4], const SkRect& clip) {
373 if (!quick_reject_in_y(srcPts, clip)) {
380 this->clipMonoCubic(&monoX[x * 3], clip);