Mercurial > sdl-ios-xcode
diff src/video/SDL_surface.c @ 1735:8dd28c4ef746 SDL-1.3
SDL_Rect now uses int for position and size.
Added a few more rectangle functions.
Added a dirty rectangle list implementation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 07:34:50 +0000 |
parents | 6c63fc2bd986 |
children |
line wrap: on
line diff
--- a/src/video/SDL_surface.c Sun Jul 09 18:09:16 2006 +0000 +++ b/src/video/SDL_surface.c Mon Jul 10 07:34:50 2006 +0000 @@ -41,14 +41,6 @@ { SDL_Surface *surface; - /* FIXME!! */ - /* Make sure the size requested doesn't overflow our datatypes */ - /* Next time I write a library like SDL, I'll use int for size. :) */ - if (width >= 16384 || height >= 65536) { - SDL_SetError("Width or height is too large"); - return NULL; - } - /* Allocate the surface */ surface = (SDL_Surface *) SDL_malloc(sizeof(*surface)); if (surface == NULL) { @@ -211,6 +203,7 @@ surface->flags |= SDL_HWSURFACE; surface->w = w; surface->h = h; + surface->pitch = SDL_CalculatePitch(surface); SDL_SetClipRect(surface, NULL); } } @@ -415,43 +408,6 @@ } /* - * A function to calculate the intersection of two rectangles: - * return true if the rectangles intersect, false otherwise - */ -SDL_bool -SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, - SDL_Rect * intersection) -{ - int Amin, Amax, Bmin, Bmax; - - /* Horizontal intersection */ - Amin = A->x; - Amax = Amin + A->w; - Bmin = B->x; - Bmax = Bmin + B->w; - if (Bmin > Amin) - Amin = Bmin; - intersection->x = Amin; - if (Bmax < Amax) - Amax = Bmax; - intersection->w = Amax - Amin > 0 ? Amax - Amin : 0; - - /* Vertical intersection */ - Amin = A->y; - Amax = Amin + A->h; - Bmin = B->y; - Bmax = Bmin + B->h; - if (Bmin > Amin) - Amin = Bmin; - intersection->y = Amin; - if (Bmax < Amax) - Amax = Bmax; - intersection->h = Amax - Amin > 0 ? Amax - Amin : 0; - - return (intersection->w && intersection->h); -} - -/* * Set the clipping rectangle for a blittable surface */ SDL_bool