30 int Amin, Amax, Bmin, Bmax;
77 int Amin, Amax, Bmin, Bmax;
111 result->
w = Amax - Amin;
123 result->
h = Amax - Amin;
131 int Amin, Amax, Bmin, Bmax;
176 result->
w = Amax - Amin;
188 result->
h = Amax - Amin;
213 const int clip_minx = clip->
x;
214 const int clip_miny = clip->
y;
215 const int clip_maxx = clip->
x+clip->
w-1;
216 const int clip_maxy = clip->
y+clip->
h-1;
223 for (i = 0; i <
count; ++
i) {
233 if (result ==
NULL) {
245 }
else if (x > maxx) {
250 }
else if (y > maxy) {
259 if (result ==
NULL) {
264 minx = maxx = points[0].
x;
265 miny = maxy = points[0].
y;
267 for (i = 1; i <
count; ++
i) {
273 }
else if (x > maxx) {
278 }
else if (y > maxy) {
287 result->
w = (maxx-minx)+1;
288 result->
h = (maxy-miny)+1;
294 #define CODE_BOTTOM 1
304 }
else if (y >= rect->
y + rect->
h) {
309 }
else if (x >= rect->
x + rect->
w) {
327 int outcode1, outcode2;
365 rectx2 = rect->
x + rect->
w - 1;
366 recty2 = rect->
y + rect->
h - 1;
375 if ((x1 < rectx1 && x2 < rectx1) || (x1 > rectx2 && x2 > rectx2) ||
376 (y1 < recty1 && y2 < recty1) || (y1 > recty2 && y2 > recty2)) {
384 }
else if (x1 > rectx2) {
389 }
else if (x2 > rectx2) {
399 }
else if (y1 > recty2) {
404 }
else if (y2 > recty2) {
413 while (outcode1 || outcode2) {
414 if (outcode1 & outcode2) {
421 x = x1 + ((x2 -
x1) * (y - y1)) / (y2 - y1);
424 x = x1 + ((x2 -
x1) * (y - y1)) / (y2 - y1);
427 y = y1 + ((y2 -
y1) * (x - x1)) / (x2 - x1);
430 y = y1 + ((y2 -
y1) * (x - x1)) / (x2 - x1);
438 x = x1 + ((x2 -
x1) * (y - y1)) / (y2 - y1);
441 x = x1 + ((x2 -
x1) * (y - y1)) / (y2 - y1);
444 y = y1 + ((y2 -
y1) * (x - x1)) / (x2 - x1);
447 y = y1 + ((y2 -
y1) * (x - x1)) / (x2 - x1);
466 int span_y1, span_y2;
467 int rect_y1, rect_y2;
498 for (i = 0; i < numrects; ++
i) {
499 rect_y1 = rects[
i].
y;
500 rect_y2 = rect_y1 + rects[
i].
h;
505 }
else if (rect_y1 < span_y1) {
508 if (rect_y2 > height) {
510 }
else if (rect_y2 > span_y2) {
514 if (span_y2 > span_y1) {
518 span->
h = (span_y2 - span_y1);
DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2)
Calculate the intersection of a rectangle and line segment.
The structure that defines a point.
EGLSurface EGLint EGLint EGLint EGLint height
static int ComputeOutCode(const SDL_Rect *rect, int x, int y)
DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result)
Calculate a minimal rectangle enclosing a set of points.
#define SDL_InvalidParamError(param)
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLfixed GLfixed GLfixed y2
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result)
Calculate the union of two rectangles.
DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result)
Calculate the intersection of two rectangles.
EGLSurface EGLint EGLint EGLint width
DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect *A, const SDL_Rect *B)
Determine whether two rectangles intersect.
GLuint GLfloat GLfloat GLfloat x1
EGLSurface EGLint EGLint y
GLuint GLdouble GLdouble GLint GLint const GLdouble * points
GLenum GLenum GLvoid GLvoid GLvoid * span
A rectangle, with the origin at the upper left.
SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect *rects, SDL_Rect *span)