Lines Matching refs:rect

27 	clipping_rect rect;
29 rect.left = min_c(r1.left, r2.left);
30 rect.top = min_c(r1.top, r2.top);
31 rect.right = max_c(r1.right, r2.right);
32 rect.bottom = max_c(r1.bottom, r2.bottom);
34 return rect;
39 // The caller should check if the returned rect is valid. If it isn't valid,
44 clipping_rect rect;
46 rect.left = max_c(r1.left, r2.left);
47 rect.top = max_c(r1.top, r2.top);
48 rect.right = min_c(r1.right, r2.right);
49 rect.bottom = min_c(r1.bottom, r2.bottom);
51 return rect;
55 // Adds the given offsets to the given rect.
57 offset_rect(clipping_rect &rect, int32 x, int32 y)
59 rect.left += x;
60 rect.top += y;
61 rect.right += x;
62 rect.bottom += y;
67 scale_rect(clipping_rect& rect, float x, float y)
69 rect.left = (int)(rect.left * x);
70 rect.top = (int)(rect.top * y);
71 rect.right = (int)((rect.right + 1) * x) - 1;
72 rect.bottom = (int)((rect.bottom + 1) * y) - 1;
78 to_BRect(const clipping_rect &rect)
80 return BRect((float)rect.left, (float)rect.top,
81 (float)rect.right, (float)rect.bottom);
87 to_clipping_rect(const BRect &rect)
93 // clipRect.left = (int32)floorf(rect.left);
94 // clipRect.top = (int32)floorf(rect.top);
95 // clipRect.right = (int32)ceilf(rect.right);
96 // clipRect.bottom = (int32)ceilf(rect.bottom);
100 clipRect.left = (int32)rect.left;
101 clipRect.top = (int32)rect.top;
102 clipRect.right = (int32)rect.right;
103 clipRect.bottom = (int32)rect.bottom;
109 // Checks if the given point lies in the given rect's area
111 point_in(const clipping_rect &rect, int32 px, int32 py)
113 if (px >= rect.left && px <= rect.right
114 && py >= rect.top && py <= rect.bottom)
122 point_in(const clipping_rect &rect, const BPoint &pt)
124 if (pt.x >= rect.left && pt.x <= rect.right
125 && pt.y >= rect.top && pt.y <= rect.bottom)
132 rect_contains(const clipping_rect &rect, const clipping_rect &testRect)
134 return rect.top <= testRect.top && rect.bottom >= testRect.bottom
135 && rect.left <= testRect.left && rect.right >= testRect.right;
139 // Checks if the rect is valid
141 valid_rect(const clipping_rect &rect)
143 if (rect.left <= rect.right && rect.top <= rect.bottom)
167 // Returns the width of the given rect.
169 rect_width(const clipping_rect &rect)
171 return rect.right - rect.left;
175 // Returns the height of the given rect.
177 rect_height(const clipping_rect &rect)
179 return rect.bottom - rect.top;