Lines Matching defs:bounds
69 static int clip_line(const SkRect& bounds, SkPoint p0, SkPoint p1, SkPoint edges[]) {
81 if (p1.fY <= bounds.top() || p0.fY >= bounds.bottom()) {
86 if (p0.fY < bounds.top()) {
87 p0.fX = SkDoubleToScalar(p0.fX + dxdy * (bounds.top() - p0.fY));
88 p0.fY = bounds.top();
90 if (p1.fY > bounds.bottom()) {
91 p1.fX = SkDoubleToScalar(p1.fX + dxdy * (bounds.bottom() - p1.fY));
92 p1.fY = bounds.bottom();
95 // Now p0...p1 is strictly inside bounds vertically, so we just need to clip horizontally
103 if (p1.fX <= bounds.left()) { // entirely to the left
104 p0.fX = p1.fX = bounds.left();
109 if (p0.fX >= bounds.right()) { // entirely to the right
110 p0.fX = p1.fX = bounds.right();
116 if (p0.fX < bounds.left()) {
117 float y = SkDoubleToScalar(p0.fY + (bounds.left() - p0.fX) / dxdy);
118 *edges++ = SkPoint::Make(bounds.left(), p0.fY);
119 *edges++ = SkPoint::Make(bounds.left(), y);
120 p0.set(bounds.left(), y);
122 if (p1.fX > bounds.right()) {
123 float y = SkDoubleToScalar(p0.fY + (bounds.right() - p0.fX) / dxdy);
125 *edges++ = SkPoint::Make(bounds.right(), y);
126 *edges++ = SkPoint::Make(bounds.right(), p1.fY);
134 static void draw_clipped_line(SkCanvas* canvas, const SkRect& bounds,
137 int count = clip_line(bounds, p0, p1, verts);