Split out the SDL_rect and SDL_surface functions into their own headers.
authorSam Lantinga
Mon, 10 Sep 2007 12:20:02 +0000
changeset 227512ea0fdc0df2
parent 2274 aedfcdeb69b6
child 2276 82f1c4c3d13a
Split out the SDL_rect and SDL_surface functions into their own headers.
Removed unused count from the dirty rect list.
include/SDL_pixels.h
include/SDL_rect.h
include/SDL_surface.h
include/SDL_video.h
src/video/SDL_pixels.c
src/video/SDL_rect.c
src/video/SDL_rect_c.h
src/video/SDL_renderer_gl.c
     1.1 --- a/include/SDL_pixels.h	Mon Sep 10 12:11:40 2007 +0000
     1.2 +++ b/include/SDL_pixels.h	Mon Sep 10 12:20:02 2007 +0000
     1.3 @@ -37,6 +37,10 @@
     1.4  /* *INDENT-ON* */
     1.5  #endif
     1.6  
     1.7 +/* Transparency definitions: These define alpha as the opacity of a surface */
     1.8 +#define SDL_ALPHA_OPAQUE 255
     1.9 +#define SDL_ALPHA_TRANSPARENT 0
    1.10 +
    1.11  enum
    1.12  {                               /* Pixel type */
    1.13      SDL_PIXELTYPE_UNKNOWN,
    1.14 @@ -330,6 +334,54 @@
    1.15   */
    1.16  extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
    1.17  
    1.18 +/**
    1.19 + * \fn Uint32 SDL_MapRGB(const SDL_PixelFormat *format,
    1.20 + *                       Uint8 r, Uint8 g, Uint8 b)
    1.21 + *
    1.22 + * \brief Maps an RGB triple to an opaque pixel value for a given pixel format
    1.23 + *
    1.24 + * \sa SDL_MapRGBA
    1.25 + */
    1.26 +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
    1.27 +                                          Uint8 r, Uint8 g, Uint8 b);
    1.28 +
    1.29 +/**
    1.30 + * \fn Uint32 SDL_MapRGBA(const SDL_PixelFormat *fmt,
    1.31 + *                        Uint8 r, Uint8 g, Uint8 b, Uint8 a)
    1.32 + *
    1.33 + * \brief Maps an RGBA quadruple to a pixel value for a given pixel format
    1.34 + *
    1.35 + * \sa SDL_MapRGB
    1.36 + */
    1.37 +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
    1.38 +                                           Uint8 r, Uint8 g, Uint8 b,
    1.39 +                                           Uint8 a);
    1.40 +
    1.41 +/**
    1.42 + * \fn void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format,
    1.43 + *                     Uint8 * r, Uint8 * g, Uint8 * b)
    1.44 + *
    1.45 + * \brief Maps a pixel value into the RGB components for a given pixel format
    1.46 + *
    1.47 + * \sa SDL_GetRGBA
    1.48 + */
    1.49 +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
    1.50 +                                        const SDL_PixelFormat * format,
    1.51 +                                        Uint8 * r, Uint8 * g, Uint8 * b);
    1.52 +
    1.53 +/**
    1.54 + * \fn void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format,
    1.55 + *                      Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
    1.56 + *
    1.57 + * \brief Maps a pixel value into the RGBA components for a given pixel format
    1.58 + *
    1.59 + * \sa SDL_GetRGB
    1.60 + */
    1.61 +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
    1.62 +                                         const SDL_PixelFormat * format,
    1.63 +                                         Uint8 * r, Uint8 * g, Uint8 * b,
    1.64 +                                         Uint8 * a);
    1.65 +
    1.66  /* Ends C function definitions when using C++ */
    1.67  #ifdef __cplusplus
    1.68  /* *INDENT-OFF* */
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/include/SDL_rect.h	Mon Sep 10 12:20:02 2007 +0000
     2.3 @@ -0,0 +1,117 @@
     2.4 +/*
     2.5 +    SDL - Simple DirectMedia Layer
     2.6 +    Copyright (C) 1997-2006 Sam Lantinga
     2.7 +
     2.8 +    This library is free software; you can redistribute it and/or
     2.9 +    modify it under the terms of the GNU Lesser General Public
    2.10 +    License as published by the Free Software Foundation; either
    2.11 +    version 2.1 of the License, or (at your option) any later version.
    2.12 +
    2.13 +    This library is distributed in the hope that it will be useful,
    2.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.16 +    Lesser General Public License for more details.
    2.17 +
    2.18 +    You should have received a copy of the GNU Lesser General Public
    2.19 +    License along with this library; if not, write to the Free Software
    2.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2.21 +
    2.22 +    Sam Lantinga
    2.23 +    slouken@libsdl.org
    2.24 +*/
    2.25 +
    2.26 +/**
    2.27 + * \file SDL_rect.h
    2.28 + *
    2.29 + * Header file for SDL_rect definition and management functions
    2.30 + */
    2.31 +
    2.32 +#ifndef _SDL_rect_h
    2.33 +#define _SDL_rect_h
    2.34 +
    2.35 +#include "SDL_stdinc.h"
    2.36 +#include "SDL_error.h"
    2.37 +#include "SDL_pixels.h"
    2.38 +#include "SDL_rwops.h"
    2.39 +
    2.40 +#include "begin_code.h"
    2.41 +/* Set up for C function definitions, even when using C++ */
    2.42 +#ifdef __cplusplus
    2.43 +/* *INDENT-OFF* */
    2.44 +extern "C" {
    2.45 +/* *INDENT-ON* */
    2.46 +#endif
    2.47 +
    2.48 +/**
    2.49 + * \struct SDL_Rect
    2.50 + *
    2.51 + * \brief A rectangle, with the origin at the upper left.
    2.52 + *
    2.53 + * \sa SDL_RectEmpty
    2.54 + * \sa SDL_RectEquals
    2.55 + * \sa SDL_HasIntersection
    2.56 + * \sa SDL_IntersectRect
    2.57 + * \sa SDL_UnionRect
    2.58 + */
    2.59 +typedef struct SDL_Rect
    2.60 +{
    2.61 +    int x, y;
    2.62 +    int w, h;
    2.63 +} SDL_Rect;
    2.64 +
    2.65 +/**
    2.66 + * \def SDL_RectEmpty()
    2.67 + *
    2.68 + * \brief Returns true if the rectangle has no area.
    2.69 + */
    2.70 +#define SDL_RectEmpty(X)    (((X)->w <= 0) || ((X)->h <= 0))
    2.71 +
    2.72 +/**
    2.73 + * \def SDL_RectEquals()
    2.74 + *
    2.75 + * \brief Returns true if the two rectangles are equal.
    2.76 + */
    2.77 +#define SDL_RectEquals(A, B)   (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
    2.78 +                                ((A)->w == (B)->w) && ((A)->h == (B)->h))
    2.79 +
    2.80 +/**
    2.81 + * \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B);
    2.82 + *
    2.83 + * \brief Determine whether two rectangles intersect.
    2.84 + *
    2.85 + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
    2.86 + */
    2.87 +extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
    2.88 +                                                     const SDL_Rect * B);
    2.89 +
    2.90 +/**
    2.91 + * \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
    2.92 + *
    2.93 + * \brief Calculate the intersection of two rectangles.
    2.94 + *
    2.95 + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
    2.96 + */
    2.97 +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
    2.98 +                                                   const SDL_Rect * B,
    2.99 +                                                   SDL_Rect * result);
   2.100 +
   2.101 +/**
   2.102 + * \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
   2.103 + *
   2.104 + * \brief Calculate the union of two rectangles
   2.105 + */
   2.106 +extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
   2.107 +                                           const SDL_Rect * B,
   2.108 +                                           SDL_Rect * result);
   2.109 +
   2.110 +/* Ends C function definitions when using C++ */
   2.111 +#ifdef __cplusplus
   2.112 +/* *INDENT-OFF* */
   2.113 +}
   2.114 +/* *INDENT-ON* */
   2.115 +#endif
   2.116 +#include "close_code.h"
   2.117 +
   2.118 +#endif /* _SDL_rect_h */
   2.119 +
   2.120 +/* vi: set ts=4 sw=4 expandtab: */
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/include/SDL_surface.h	Mon Sep 10 12:20:02 2007 +0000
     3.3 @@ -0,0 +1,488 @@
     3.4 +/*
     3.5 +    SDL - Simple DirectMedia Layer
     3.6 +    Copyright (C) 1997-2006 Sam Lantinga
     3.7 +
     3.8 +    This library is free software; you can redistribute it and/or
     3.9 +    modify it under the terms of the GNU Lesser General Public
    3.10 +    License as published by the Free Software Foundation; either
    3.11 +    version 2.1 of the License, or (at your option) any later version.
    3.12 +
    3.13 +    This library is distributed in the hope that it will be useful,
    3.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 +    Lesser General Public License for more details.
    3.17 +
    3.18 +    You should have received a copy of the GNU Lesser General Public
    3.19 +    License along with this library; if not, write to the Free Software
    3.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    3.21 +
    3.22 +    Sam Lantinga
    3.23 +    slouken@libsdl.org
    3.24 +*/
    3.25 +
    3.26 +/**
    3.27 + * \file SDL_surface.h
    3.28 + *
    3.29 + * Header file for SDL_surface definition and management functions
    3.30 + */
    3.31 +
    3.32 +#ifndef _SDL_surface_h
    3.33 +#define _SDL_surface_h
    3.34 +
    3.35 +#include "SDL_stdinc.h"
    3.36 +#include "SDL_pixels.h"
    3.37 +#include "SDL_rect.h"
    3.38 +#include "SDL_rwops.h"
    3.39 +
    3.40 +#include "begin_code.h"
    3.41 +/* Set up for C function definitions, even when using C++ */
    3.42 +#ifdef __cplusplus
    3.43 +/* *INDENT-OFF* */
    3.44 +extern "C" {
    3.45 +/* *INDENT-ON* */
    3.46 +#endif
    3.47 +
    3.48 +/* These are the currently supported flags for the SDL_surface */
    3.49 +/* Used internally (read-only) */
    3.50 +#define SDL_PREALLOC        0x00000001  /* Surface uses preallocated memory */
    3.51 +#define SDL_RLEACCEL        0x00000002  /* Surface is RLE encoded */
    3.52 +
    3.53 +/* Evaluates to true if the surface needs to be locked before access */
    3.54 +#define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
    3.55 +
    3.56 +/**
    3.57 + * \struct SDL_Surface
    3.58 + *
    3.59 + * \brief A collection of pixels used in software blitting
    3.60 + *
    3.61 + * \note  This structure should be treated as read-only, except for 'pixels',
    3.62 + *        which, if not NULL, contains the raw pixel data for the surface.
    3.63 + */
    3.64 +typedef struct SDL_Surface
    3.65 +{
    3.66 +    Uint32 flags;               /**< Read-only */
    3.67 +    SDL_PixelFormat *format;    /**< Read-only */
    3.68 +    int w, h;                   /**< Read-only */
    3.69 +    int pitch;                  /**< Read-only */
    3.70 +    void *pixels;               /**< Read-write */
    3.71 +
    3.72 +    /* Application data associated with the surfade */
    3.73 +    void *userdata;             /**< Read-write */
    3.74 +
    3.75 +    /* information needed for surfaces requiring locks */
    3.76 +    int locked;                 /**< Read-only */
    3.77 +    void *lock_data;            /**< Read-only */
    3.78 +
    3.79 +    /* clipping information */
    3.80 +    SDL_Rect clip_rect;         /**< Read-only */
    3.81 +
    3.82 +    /* info for fast blit mapping to other surfaces */
    3.83 +    struct SDL_BlitMap *map;    /**< Private */
    3.84 +
    3.85 +    /* format version, bumped at every change to invalidate blit maps */
    3.86 +    unsigned int format_version;        /**< Private */
    3.87 +
    3.88 +    /* Reference count -- used when freeing surface */
    3.89 +    int refcount;               /**< Read-mostly */
    3.90 +} SDL_Surface;
    3.91 +
    3.92 +/**
    3.93 + * \typedef SDL_blit
    3.94 + *
    3.95 + * \brief The type of function used for surface blitting functions
    3.96 + */
    3.97 +typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
    3.98 +                         struct SDL_Surface * dst, SDL_Rect * dstrect);
    3.99 +
   3.100 +/*
   3.101 + * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
   3.102 + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
   3.103 + * If the depth is greater than 8 bits, the pixel format is set using the
   3.104 + * flags '[RGB]mask'.
   3.105 + * If the function runs out of memory, it will return NULL.
   3.106 + *
   3.107 + * The 'flags' tell what kind of surface to create.
   3.108 + * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
   3.109 + * SDL_SRCALPHA means that the surface will be used for alpha blits.
   3.110 + */
   3.111 +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
   3.112 +    (Uint32 flags, int width, int height, int depth,
   3.113 +     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
   3.114 +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
   3.115 +                                                              int width,
   3.116 +                                                              int height,
   3.117 +                                                              int depth,
   3.118 +                                                              int pitch,
   3.119 +                                                              Uint32 Rmask,
   3.120 +                                                              Uint32 Gmask,
   3.121 +                                                              Uint32 Bmask,
   3.122 +                                                              Uint32 Amask);
   3.123 +extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
   3.124 +
   3.125 +/**
   3.126 + * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
   3.127 + *
   3.128 + * \brief Set the palette used by a surface.
   3.129 + *
   3.130 + * \return 0, or -1 if the surface format doesn't use a palette.
   3.131 + *
   3.132 + * \note A single palette can be shared with many surfaces.
   3.133 + */
   3.134 +extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
   3.135 +                                                  SDL_Palette * palette);
   3.136 +
   3.137 +/*
   3.138 + * SDL_LockSurface() sets up a surface for directly accessing the pixels.
   3.139 + * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
   3.140 + * to and read from 'surface->pixels', using the pixel format stored in 
   3.141 + * 'surface->format'.  Once you are done accessing the surface, you should 
   3.142 + * use SDL_UnlockSurface() to release it.
   3.143 + *
   3.144 + * Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
   3.145 + * to 0, then you can read and write to the surface at any time, and the
   3.146 + * pixel format of the surface will not change.
   3.147 + * 
   3.148 + * No operating system or library calls should be made between lock/unlock
   3.149 + * pairs, as critical system locks may be held during this time.
   3.150 + *
   3.151 + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
   3.152 + */
   3.153 +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
   3.154 +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
   3.155 +
   3.156 +/*
   3.157 + * Load a surface from a seekable SDL data source (memory or file.)
   3.158 + * If 'freesrc' is non-zero, the source will be closed after being read.
   3.159 + * Returns the new surface, or NULL if there was an error.
   3.160 + * The new surface should be freed with SDL_FreeSurface().
   3.161 + */
   3.162 +extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
   3.163 +                                                    int freesrc);
   3.164 +
   3.165 +/* Convenience macro -- load a surface from a file */
   3.166 +#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
   3.167 +
   3.168 +/*
   3.169 + * Save a surface to a seekable SDL data source (memory or file.)
   3.170 + * If 'freedst' is non-zero, the source will be closed after being written.
   3.171 + * Returns 0 if successful or -1 if there was an error.
   3.172 + */
   3.173 +extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
   3.174 +    (SDL_Surface * surface, SDL_RWops * dst, int freedst);
   3.175 +
   3.176 +/* Convenience macro -- save a surface to a file */
   3.177 +#define SDL_SaveBMP(surface, file) \
   3.178 +		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
   3.179 +
   3.180 +/*
   3.181 + * \fn int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
   3.182 + *
   3.183 + * \brief Sets the RLE acceleration hint for a surface.
   3.184 + *
   3.185 + * \return 0 on success, or -1 if the surface is not valid
   3.186 + *
   3.187 + * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
   3.188 + *       but the surface must be locked before directly accessing the pixels.
   3.189 + */
   3.190 +extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
   3.191 +                                              int flag);
   3.192 +
   3.193 +/*
   3.194 + * \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
   3.195 + *
   3.196 + * \brief Sets the color key (transparent pixel) in a blittable surface.
   3.197 + *
   3.198 + * \param surface The surface to update
   3.199 + * \param flag Non-zero to enable colorkey and 0 to disable colorkey 
   3.200 + * \param key The transparent pixel in the native surface format
   3.201 + *
   3.202 + * \return 0 on success, or -1 if the surface is not valid
   3.203 + */
   3.204 +extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
   3.205 +                                            Uint32 flag, Uint32 key);
   3.206 +
   3.207 +/**
   3.208 + * \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
   3.209 + *
   3.210 + * \brief Set an additional color value used in blit operations
   3.211 + *
   3.212 + * \param surface The surface to update
   3.213 + * \param r The red source color value multiplied into blit operations
   3.214 + * \param g The green source color value multiplied into blit operations
   3.215 + * \param b The blue source color value multiplied into blit operations
   3.216 + *
   3.217 + * \return 0 on success, or -1 if the surface is not valid
   3.218 + *
   3.219 + * \sa SDL_GetSurfaceColorMod()
   3.220 + */
   3.221 +extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
   3.222 +                                                   Uint8 r, Uint8 g, Uint8 b);
   3.223 +
   3.224 +
   3.225 +/**
   3.226 + * \fn int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
   3.227 + *
   3.228 + * \brief Get the additional color value used in blit operations
   3.229 + *
   3.230 + * \param surface The surface to query
   3.231 + * \param r A pointer filled in with the source red color value
   3.232 + * \param g A pointer filled in with the source green color value
   3.233 + * \param b A pointer filled in with the source blue color value
   3.234 + *
   3.235 + * \return 0 on success, or -1 if the surface is not valid
   3.236 + *
   3.237 + * \sa SDL_SetSurfaceColorMod()
   3.238 + */
   3.239 +extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
   3.240 +                                                   Uint8 * r, Uint8 * g,
   3.241 +                                                   Uint8 * b);
   3.242 +
   3.243 +/**
   3.244 + * \fn int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
   3.245 + *
   3.246 + * \brief Set an additional alpha value used in blit operations
   3.247 + *
   3.248 + * \param surface The surface to update
   3.249 + * \param alpha The source alpha value multiplied into blit operations.
   3.250 + *
   3.251 + * \return 0 on success, or -1 if the surface is not valid
   3.252 + *
   3.253 + * \sa SDL_GetSurfaceAlphaMod()
   3.254 + */
   3.255 +extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
   3.256 +                                                   Uint8 alpha);
   3.257 +
   3.258 +/**
   3.259 + * \fn int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
   3.260 + *
   3.261 + * \brief Get the additional alpha value used in blit operations
   3.262 + *
   3.263 + * \param surface The surface to query
   3.264 + * \param alpha A pointer filled in with the source alpha value
   3.265 + *
   3.266 + * \return 0 on success, or -1 if the surface is not valid
   3.267 + *
   3.268 + * \sa SDL_SetSurfaceAlphaMod()
   3.269 + */
   3.270 +extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
   3.271 +                                                   Uint8 * alpha);
   3.272 +
   3.273 +/**
   3.274 + * \fn int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
   3.275 + *
   3.276 + * \brief Set the blend mode used for blit operations
   3.277 + *
   3.278 + * \param surface The surface to update
   3.279 + * \param blendMode SDL_TextureBlendMode to use for blit blending
   3.280 + *
   3.281 + * \return 0 on success, or -1 if the parameters are not valid
   3.282 + *
   3.283 + * \sa SDL_GetSurfaceBlendMode()
   3.284 + */
   3.285 +extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
   3.286 +                                                    int blendMode);
   3.287 +
   3.288 +/**
   3.289 + * \fn int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
   3.290 + *
   3.291 + * \brief Get the blend mode used for blit operations
   3.292 + *
   3.293 + * \param surface The surface to query
   3.294 + * \param blendMode A pointer filled in with the current blend mode
   3.295 + *
   3.296 + * \return 0 on success, or -1 if the surface is not valid
   3.297 + *
   3.298 + * \sa SDL_SetSurfaceBlendMode()
   3.299 + */
   3.300 +extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
   3.301 +                                                    int *blendMode);
   3.302 +
   3.303 +/**
   3.304 + * \fn int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
   3.305 + *
   3.306 + * \brief Set the scale mode used for blit operations
   3.307 + *
   3.308 + * \param surface The surface to update
   3.309 + * \param scaleMode SDL_TextureScaleMode to use for blit scaling
   3.310 + *
   3.311 + * \return 0 on success, or -1 if the surface is not valid or the scale mode is not supported
   3.312 + *
   3.313 + * \note If the scale mode is not supported, the closest supported mode is chosen.  Currently only SDL_TEXTURESCALEMODE_FAST is supported on surfaces.
   3.314 + *
   3.315 + * \sa SDL_GetSurfaceScaleMode()
   3.316 + */
   3.317 +extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
   3.318 +                                                    int scaleMode);
   3.319 +
   3.320 +/**
   3.321 + * \fn int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
   3.322 + *
   3.323 + * \brief Get the scale mode used for blit operations
   3.324 + *
   3.325 + * \param surface The surface to query
   3.326 + * \param scaleMode A pointer filled in with the current scale mode
   3.327 + *
   3.328 + * \return 0 on success, or -1 if the surface is not valid
   3.329 + *
   3.330 + * \sa SDL_SetSurfaceScaleMode()
   3.331 + */
   3.332 +extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
   3.333 +                                                    int *scaleMode);
   3.334 +
   3.335 +/*
   3.336 + * Sets the clipping rectangle for the destination surface in a blit.
   3.337 + *
   3.338 + * If the clip rectangle is NULL, clipping will be disabled.
   3.339 + * If the clip rectangle doesn't intersect the surface, the function will
   3.340 + * return SDL_FALSE and blits will be completely clipped.  Otherwise the
   3.341 + * function returns SDL_TRUE and blits to the surface will be clipped to
   3.342 + * the intersection of the surface area and the clipping rectangle.
   3.343 + *
   3.344 + * Note that blits are automatically clipped to the edges of the source
   3.345 + * and destination surfaces.
   3.346 + */
   3.347 +extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
   3.348 +                                                 const SDL_Rect * rect);
   3.349 +
   3.350 +/*
   3.351 + * Gets the clipping rectangle for the destination surface in a blit.
   3.352 + * 'rect' must be a pointer to a valid rectangle which will be filled
   3.353 + * with the correct values.
   3.354 + */
   3.355 +extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
   3.356 +                                             SDL_Rect * rect);
   3.357 +
   3.358 +/*
   3.359 + * Creates a new surface of the specified format, and then copies and maps 
   3.360 + * the given surface to it so the blit of the converted surface will be as 
   3.361 + * fast as possible.  If this function fails, it returns NULL.
   3.362 + *
   3.363 + * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 
   3.364 + * semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
   3.365 + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
   3.366 + * surface.
   3.367 + *
   3.368 + * This function is used internally by SDL_DisplayFormat().
   3.369 + */
   3.370 +extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
   3.371 +    (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
   3.372 +
   3.373 +/*
   3.374 + * This function performs a fast fill of the given rectangle with 'color'
   3.375 + * The given rectangle is clipped to the destination surface clip area
   3.376 + * and the final fill rectangle is saved in the passed in pointer.
   3.377 + * If 'dstrect' is NULL, the whole surface will be filled with 'color'
   3.378 + * The color should be a pixel of the format used by the surface, and 
   3.379 + * can be generated by the SDL_MapRGB() function.
   3.380 + * This function returns 0 on success, or -1 on error.
   3.381 + */
   3.382 +extern DECLSPEC int SDLCALL SDL_FillRect
   3.383 +    (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
   3.384 +
   3.385 +/*
   3.386 + * This performs a fast blit from the source surface to the destination
   3.387 + * surface.  It assumes that the source and destination rectangles are
   3.388 + * the same size.  If either 'srcrect' or 'dstrect' are NULL, the entire
   3.389 + * surface (src or dst) is copied.  The final blit rectangles are saved
   3.390 + * in 'srcrect' and 'dstrect' after all clipping is performed.
   3.391 + * If the blit is successful, it returns 0, otherwise it returns -1.
   3.392 + *
   3.393 + * The blit function should not be called on a locked surface.
   3.394 + *
   3.395 + * The blit semantics for surfaces with and without alpha and colorkey
   3.396 + * are defined as follows:
   3.397 + *
   3.398 + * RGBA->RGB:
   3.399 + *     SDL_SRCALPHA set:
   3.400 + * 	alpha-blend (using alpha-channel).
   3.401 + * 	SDL_SRCCOLORKEY ignored.
   3.402 + *     SDL_SRCALPHA not set:
   3.403 + * 	copy RGB.
   3.404 + * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   3.405 + * 	RGB values of the source colour key, ignoring alpha in the
   3.406 + * 	comparison.
   3.407 + * 
   3.408 + * RGB->RGBA:
   3.409 + *     SDL_SRCALPHA set:
   3.410 + * 	alpha-blend (using the source per-surface alpha value);
   3.411 + * 	set destination alpha to opaque.
   3.412 + *     SDL_SRCALPHA not set:
   3.413 + * 	copy RGB, set destination alpha to source per-surface alpha value.
   3.414 + *     both:
   3.415 + * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   3.416 + * 	source colour key.
   3.417 + * 
   3.418 + * RGBA->RGBA:
   3.419 + *     SDL_SRCALPHA set:
   3.420 + * 	alpha-blend (using the source alpha channel) the RGB values;
   3.421 + * 	leave destination alpha untouched. [Note: is this correct?]
   3.422 + * 	SDL_SRCCOLORKEY ignored.
   3.423 + *     SDL_SRCALPHA not set:
   3.424 + * 	copy all of RGBA to the destination.
   3.425 + * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   3.426 + * 	RGB values of the source colour key, ignoring alpha in the
   3.427 + * 	comparison.
   3.428 + * 
   3.429 + * RGB->RGB: 
   3.430 + *     SDL_SRCALPHA set:
   3.431 + * 	alpha-blend (using the source per-surface alpha value).
   3.432 + *     SDL_SRCALPHA not set:
   3.433 + * 	copy RGB.
   3.434 + *     both:
   3.435 + * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   3.436 + * 	source colour key.
   3.437 + *
   3.438 + * If either of the surfaces were in video memory, and the blit returns -2,
   3.439 + * the video memory was lost, so it should be reloaded with artwork and 
   3.440 + * re-blitted:
   3.441 +	while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
   3.442 +		while ( SDL_LockSurface(image) < 0 )
   3.443 +			Sleep(10);
   3.444 +		-- Write image pixels to image->pixels --
   3.445 +		SDL_UnlockSurface(image);
   3.446 +	}
   3.447 + * This happens under DirectX 5.0 when the system switches away from your
   3.448 + * fullscreen application.  The lock will also fail until you have access
   3.449 + * to the video memory again.
   3.450 + */
   3.451 +/* You should call SDL_BlitSurface() unless you know exactly how SDL
   3.452 +   blitting works internally and how to use the other blit functions.
   3.453 +*/
   3.454 +#define SDL_BlitSurface SDL_UpperBlit
   3.455 +
   3.456 +/* This is the public blit function, SDL_BlitSurface(), and it performs
   3.457 +   rectangle validation and clipping before passing it to SDL_LowerBlit()
   3.458 +*/
   3.459 +extern DECLSPEC int SDLCALL SDL_UpperBlit
   3.460 +    (SDL_Surface * src, SDL_Rect * srcrect,
   3.461 +     SDL_Surface * dst, SDL_Rect * dstrect);
   3.462 +/* This is a semi-private blit function and it performs low-level surface
   3.463 +   blitting only.
   3.464 +*/
   3.465 +extern DECLSPEC int SDLCALL SDL_LowerBlit
   3.466 +    (SDL_Surface * src, SDL_Rect * srcrect,
   3.467 +     SDL_Surface * dst, SDL_Rect * dstrect);
   3.468 +
   3.469 +/**
   3.470 + * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
   3.471 + *
   3.472 + * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
   3.473 + *
   3.474 + * \note This function uses a static buffer, and is not thread-safe.
   3.475 + */
   3.476 +extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
   3.477 +                                            SDL_Rect * srcrect,
   3.478 +                                            SDL_Surface * dst,
   3.479 +                                            SDL_Rect * dstrect);
   3.480 +
   3.481 +/* Ends C function definitions when using C++ */
   3.482 +#ifdef __cplusplus
   3.483 +/* *INDENT-OFF* */
   3.484 +}
   3.485 +/* *INDENT-ON* */
   3.486 +#endif
   3.487 +#include "close_code.h"
   3.488 +
   3.489 +#endif /* _SDL_surface_h */
   3.490 +
   3.491 +/* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/include/SDL_video.h	Mon Sep 10 12:11:40 2007 +0000
     4.2 +++ b/include/SDL_video.h	Mon Sep 10 12:20:02 2007 +0000
     4.3 @@ -23,16 +23,16 @@
     4.4  /**
     4.5   * \file SDL_video.h
     4.6   *
     4.7 - * Header file for access to the SDL raw framebuffer window
     4.8 + * Header file for SDL video functions.
     4.9   */
    4.10  
    4.11  #ifndef _SDL_video_h
    4.12  #define _SDL_video_h
    4.13  
    4.14  #include "SDL_stdinc.h"
    4.15 -#include "SDL_error.h"
    4.16  #include "SDL_pixels.h"
    4.17 -#include "SDL_rwops.h"
    4.18 +#include "SDL_rect.h"
    4.19 +#include "SDL_surface.h"
    4.20  
    4.21  #include "begin_code.h"
    4.22  /* Set up for C function definitions, even when using C++ */
    4.23 @@ -42,21 +42,6 @@
    4.24  /* *INDENT-ON* */
    4.25  #endif
    4.26  
    4.27 -/* Transparency definitions: These define alpha as the opacity of a surface */
    4.28 -#define SDL_ALPHA_OPAQUE 255
    4.29 -#define SDL_ALPHA_TRANSPARENT 0
    4.30 -
    4.31 -/**
    4.32 - * \struct SDL_Rect
    4.33 - *
    4.34 - * \brief A rectangle, with the origin at the upper left.
    4.35 - */
    4.36 -typedef struct SDL_Rect
    4.37 -{
    4.38 -    int x, y;
    4.39 -    int w, h;
    4.40 -} SDL_Rect;
    4.41 -
    4.42  /**
    4.43   * \struct SDL_DisplayMode
    4.44   *
    4.45 @@ -261,51 +246,6 @@
    4.46   */
    4.47  typedef void *SDL_GLContext;
    4.48  
    4.49 -
    4.50 -/* These are the currently supported flags for the SDL_surface */
    4.51 -/* Used internally (read-only) */
    4.52 -#define SDL_PREALLOC        0x00000001  /* Surface uses preallocated memory */
    4.53 -#define SDL_RLEACCEL        0x00000002  /* Surface is RLE encoded */
    4.54 -
    4.55 -/* Evaluates to true if the surface needs to be locked before access */
    4.56 -#define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
    4.57 -
    4.58 -/* This structure should be treated as read-only, except for 'pixels',
    4.59 -   which, if not NULL, contains the raw pixel data for the surface.
    4.60 -*/
    4.61 -typedef struct SDL_Surface
    4.62 -{
    4.63 -    Uint32 flags;               /* Read-only */
    4.64 -    SDL_PixelFormat *format;    /* Read-only */
    4.65 -    int w, h;                   /* Read-only */
    4.66 -    int pitch;                  /* Read-only */
    4.67 -    void *pixels;               /* Read-write */
    4.68 -
    4.69 -    /* Application data associated with the surfade */
    4.70 -    void *userdata;             /* Read-write */
    4.71 -
    4.72 -    /* information needed for surfaces requiring locks */
    4.73 -    int locked;                 /* Read-only */
    4.74 -    void *lock_data;            /* Read-only */
    4.75 -
    4.76 -    /* clipping information */
    4.77 -    SDL_Rect clip_rect;         /* Read-only */
    4.78 -
    4.79 -    /* info for fast blit mapping to other surfaces */
    4.80 -    struct SDL_BlitMap *map;    /* Private */
    4.81 -
    4.82 -    /* format version, bumped at every change to invalidate blit maps */
    4.83 -    unsigned int format_version;        /* Private */
    4.84 -
    4.85 -    /* Reference count -- used when freeing surface */
    4.86 -    int refcount;               /* Read-mostly */
    4.87 -} SDL_Surface;
    4.88 -
    4.89 -/* typedef for private surface blitting functions */
    4.90 -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
    4.91 -                         struct SDL_Surface * dst, SDL_Rect * dstrect);
    4.92 -
    4.93 -
    4.94  /**
    4.95   * \enum SDL_GLattr
    4.96   *
    4.97 @@ -1290,413 +1230,6 @@
    4.98   */
    4.99  extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
   4.100  
   4.101 -/*
   4.102 - * Maps an RGB triple to an opaque pixel value for a given pixel format
   4.103 - */
   4.104 -extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat *
   4.105 -                                          const format, const Uint8 r,
   4.106 -                                          const Uint8 g, const Uint8 b);
   4.107 -
   4.108 -/*
   4.109 - * Maps an RGBA quadruple to a pixel value for a given pixel format
   4.110 - */
   4.111 -extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * const fmt,
   4.112 -                                           const Uint8 r, const Uint8 g,
   4.113 -                                           const Uint8 b, const Uint8 a);
   4.114 -
   4.115 -/*
   4.116 - * Maps a pixel value into the RGB components for a given pixel format
   4.117 - */
   4.118 -extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt,
   4.119 -                                        Uint8 * r, Uint8 * g, Uint8 * b);
   4.120 -
   4.121 -/*
   4.122 - * Maps a pixel value into the RGBA components for a given pixel format
   4.123 - */
   4.124 -extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
   4.125 -                                         Uint8 * r, Uint8 * g, Uint8 * b,
   4.126 -                                         Uint8 * a);
   4.127 -
   4.128 -/*
   4.129 - * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
   4.130 - * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
   4.131 - * If the depth is greater than 8 bits, the pixel format is set using the
   4.132 - * flags '[RGB]mask'.
   4.133 - * If the function runs out of memory, it will return NULL.
   4.134 - *
   4.135 - * The 'flags' tell what kind of surface to create.
   4.136 - * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
   4.137 - * SDL_SRCALPHA means that the surface will be used for alpha blits.
   4.138 - */
   4.139 -extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
   4.140 -    (Uint32 flags, int width, int height, int depth,
   4.141 -     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
   4.142 -extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
   4.143 -                                                              int width,
   4.144 -                                                              int height,
   4.145 -                                                              int depth,
   4.146 -                                                              int pitch,
   4.147 -                                                              Uint32 Rmask,
   4.148 -                                                              Uint32 Gmask,
   4.149 -                                                              Uint32 Bmask,
   4.150 -                                                              Uint32 Amask);
   4.151 -extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
   4.152 -
   4.153 -/**
   4.154 - * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
   4.155 - *
   4.156 - * \brief Set the palette used by a surface.
   4.157 - *
   4.158 - * \return 0, or -1 if the surface format doesn't use a palette.
   4.159 - *
   4.160 - * \note A single palette can be shared with many surfaces.
   4.161 - */
   4.162 -extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
   4.163 -                                                  SDL_Palette * palette);
   4.164 -
   4.165 -/*
   4.166 - * SDL_LockSurface() sets up a surface for directly accessing the pixels.
   4.167 - * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
   4.168 - * to and read from 'surface->pixels', using the pixel format stored in 
   4.169 - * 'surface->format'.  Once you are done accessing the surface, you should 
   4.170 - * use SDL_UnlockSurface() to release it.
   4.171 - *
   4.172 - * Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
   4.173 - * to 0, then you can read and write to the surface at any time, and the
   4.174 - * pixel format of the surface will not change.
   4.175 - * 
   4.176 - * No operating system or library calls should be made between lock/unlock
   4.177 - * pairs, as critical system locks may be held during this time.
   4.178 - *
   4.179 - * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
   4.180 - */
   4.181 -extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
   4.182 -extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
   4.183 -
   4.184 -/*
   4.185 - * Load a surface from a seekable SDL data source (memory or file.)
   4.186 - * If 'freesrc' is non-zero, the source will be closed after being read.
   4.187 - * Returns the new surface, or NULL if there was an error.
   4.188 - * The new surface should be freed with SDL_FreeSurface().
   4.189 - */
   4.190 -extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
   4.191 -                                                    int freesrc);
   4.192 -
   4.193 -/* Convenience macro -- load a surface from a file */
   4.194 -#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
   4.195 -
   4.196 -/*
   4.197 - * Save a surface to a seekable SDL data source (memory or file.)
   4.198 - * If 'freedst' is non-zero, the source will be closed after being written.
   4.199 - * Returns 0 if successful or -1 if there was an error.
   4.200 - */
   4.201 -extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
   4.202 -    (SDL_Surface * surface, SDL_RWops * dst, int freedst);
   4.203 -
   4.204 -/* Convenience macro -- save a surface to a file */
   4.205 -#define SDL_SaveBMP(surface, file) \
   4.206 -		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
   4.207 -
   4.208 -/*
   4.209 - * \fn int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
   4.210 - *
   4.211 - * \brief Sets the RLE acceleration hint for a surface.
   4.212 - *
   4.213 - * \return 0 on success, or -1 if the surface is not valid
   4.214 - *
   4.215 - * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
   4.216 - *       but the surface must be locked before directly accessing the pixels.
   4.217 - */
   4.218 -extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
   4.219 -                                              int flag);
   4.220 -
   4.221 -/*
   4.222 - * \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
   4.223 - *
   4.224 - * \brief Sets the color key (transparent pixel) in a blittable surface.
   4.225 - *
   4.226 - * \param surface The surface to update
   4.227 - * \param flag Non-zero to enable colorkey and 0 to disable colorkey 
   4.228 - * \param key The transparent pixel in the native surface format
   4.229 - *
   4.230 - * \return 0 on success, or -1 if the surface is not valid
   4.231 - */
   4.232 -extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
   4.233 -                                            Uint32 flag, Uint32 key);
   4.234 -
   4.235 -/**
   4.236 - * \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
   4.237 - *
   4.238 - * \brief Set an additional color value used in blit operations
   4.239 - *
   4.240 - * \param surface The surface to update
   4.241 - * \param r The red source color value multiplied into blit operations
   4.242 - * \param g The green source color value multiplied into blit operations
   4.243 - * \param b The blue source color value multiplied into blit operations
   4.244 - *
   4.245 - * \return 0 on success, or -1 if the surface is not valid
   4.246 - *
   4.247 - * \sa SDL_GetSurfaceColorMod()
   4.248 - */
   4.249 -extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
   4.250 -                                                   Uint8 r, Uint8 g, Uint8 b);
   4.251 -
   4.252 -
   4.253 -/**
   4.254 - * \fn int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
   4.255 - *
   4.256 - * \brief Get the additional color value used in blit operations
   4.257 - *
   4.258 - * \param surface The surface to query
   4.259 - * \param r A pointer filled in with the source red color value
   4.260 - * \param g A pointer filled in with the source green color value
   4.261 - * \param b A pointer filled in with the source blue color value
   4.262 - *
   4.263 - * \return 0 on success, or -1 if the surface is not valid
   4.264 - *
   4.265 - * \sa SDL_SetSurfaceColorMod()
   4.266 - */
   4.267 -extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
   4.268 -                                                   Uint8 * r, Uint8 * g,
   4.269 -                                                   Uint8 * b);
   4.270 -
   4.271 -/**
   4.272 - * \fn int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
   4.273 - *
   4.274 - * \brief Set an additional alpha value used in blit operations
   4.275 - *
   4.276 - * \param surface The surface to update
   4.277 - * \param alpha The source alpha value multiplied into blit operations.
   4.278 - *
   4.279 - * \return 0 on success, or -1 if the surface is not valid
   4.280 - *
   4.281 - * \sa SDL_GetSurfaceAlphaMod()
   4.282 - */
   4.283 -extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
   4.284 -                                                   Uint8 alpha);
   4.285 -
   4.286 -/**
   4.287 - * \fn int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
   4.288 - *
   4.289 - * \brief Get the additional alpha value used in blit operations
   4.290 - *
   4.291 - * \param surface The surface to query
   4.292 - * \param alpha A pointer filled in with the source alpha value
   4.293 - *
   4.294 - * \return 0 on success, or -1 if the surface is not valid
   4.295 - *
   4.296 - * \sa SDL_SetSurfaceAlphaMod()
   4.297 - */
   4.298 -extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
   4.299 -                                                   Uint8 * alpha);
   4.300 -
   4.301 -/**
   4.302 - * \fn int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
   4.303 - *
   4.304 - * \brief Set the blend mode used for blit operations
   4.305 - *
   4.306 - * \param surface The surface to update
   4.307 - * \param blendMode SDL_TextureBlendMode to use for blit blending
   4.308 - *
   4.309 - * \return 0 on success, or -1 if the parameters are not valid
   4.310 - *
   4.311 - * \sa SDL_GetSurfaceBlendMode()
   4.312 - */
   4.313 -extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
   4.314 -                                                    int blendMode);
   4.315 -
   4.316 -/**
   4.317 - * \fn int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
   4.318 - *
   4.319 - * \brief Get the blend mode used for blit operations
   4.320 - *
   4.321 - * \param surface The surface to query
   4.322 - * \param blendMode A pointer filled in with the current blend mode
   4.323 - *
   4.324 - * \return 0 on success, or -1 if the surface is not valid
   4.325 - *
   4.326 - * \sa SDL_SetSurfaceBlendMode()
   4.327 - */
   4.328 -extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
   4.329 -                                                    int *blendMode);
   4.330 -
   4.331 -/**
   4.332 - * \fn int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
   4.333 - *
   4.334 - * \brief Set the scale mode used for blit operations
   4.335 - *
   4.336 - * \param surface The surface to update
   4.337 - * \param scaleMode SDL_TextureScaleMode to use for blit scaling
   4.338 - *
   4.339 - * \return 0 on success, or -1 if the surface is not valid or the scale mode is not supported
   4.340 - *
   4.341 - * \note If the scale mode is not supported, the closest supported mode is chosen.  Currently only SDL_TEXTURESCALEMODE_FAST is supported on surfaces.
   4.342 - *
   4.343 - * \sa SDL_GetSurfaceScaleMode()
   4.344 - */
   4.345 -extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
   4.346 -                                                    int scaleMode);
   4.347 -
   4.348 -/**
   4.349 - * \fn int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
   4.350 - *
   4.351 - * \brief Get the scale mode used for blit operations
   4.352 - *
   4.353 - * \param surface The surface to query
   4.354 - * \param scaleMode A pointer filled in with the current scale mode
   4.355 - *
   4.356 - * \return 0 on success, or -1 if the surface is not valid
   4.357 - *
   4.358 - * \sa SDL_SetSurfaceScaleMode()
   4.359 - */
   4.360 -extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
   4.361 -                                                    int *scaleMode);
   4.362 -
   4.363 -/*
   4.364 - * Sets the clipping rectangle for the destination surface in a blit.
   4.365 - *
   4.366 - * If the clip rectangle is NULL, clipping will be disabled.
   4.367 - * If the clip rectangle doesn't intersect the surface, the function will
   4.368 - * return SDL_FALSE and blits will be completely clipped.  Otherwise the
   4.369 - * function returns SDL_TRUE and blits to the surface will be clipped to
   4.370 - * the intersection of the surface area and the clipping rectangle.
   4.371 - *
   4.372 - * Note that blits are automatically clipped to the edges of the source
   4.373 - * and destination surfaces.
   4.374 - */
   4.375 -extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
   4.376 -                                                 const SDL_Rect * rect);
   4.377 -
   4.378 -/*
   4.379 - * Gets the clipping rectangle for the destination surface in a blit.
   4.380 - * 'rect' must be a pointer to a valid rectangle which will be filled
   4.381 - * with the correct values.
   4.382 - */
   4.383 -extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
   4.384 -                                             SDL_Rect * rect);
   4.385 -
   4.386 -/*
   4.387 - * Creates a new surface of the specified format, and then copies and maps 
   4.388 - * the given surface to it so the blit of the converted surface will be as 
   4.389 - * fast as possible.  If this function fails, it returns NULL.
   4.390 - *
   4.391 - * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 
   4.392 - * semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
   4.393 - * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
   4.394 - * surface.
   4.395 - *
   4.396 - * This function is used internally by SDL_DisplayFormat().
   4.397 - */
   4.398 -extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
   4.399 -    (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
   4.400 -
   4.401 -/*
   4.402 - * This function performs a fast fill of the given rectangle with 'color'
   4.403 - * The given rectangle is clipped to the destination surface clip area
   4.404 - * and the final fill rectangle is saved in the passed in pointer.
   4.405 - * If 'dstrect' is NULL, the whole surface will be filled with 'color'
   4.406 - * The color should be a pixel of the format used by the surface, and 
   4.407 - * can be generated by the SDL_MapRGB() function.
   4.408 - * This function returns 0 on success, or -1 on error.
   4.409 - */
   4.410 -extern DECLSPEC int SDLCALL SDL_FillRect
   4.411 -    (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
   4.412 -
   4.413 -/*
   4.414 - * This performs a fast blit from the source surface to the destination
   4.415 - * surface.  It assumes that the source and destination rectangles are
   4.416 - * the same size.  If either 'srcrect' or 'dstrect' are NULL, the entire
   4.417 - * surface (src or dst) is copied.  The final blit rectangles are saved
   4.418 - * in 'srcrect' and 'dstrect' after all clipping is performed.
   4.419 - * If the blit is successful, it returns 0, otherwise it returns -1.
   4.420 - *
   4.421 - * The blit function should not be called on a locked surface.
   4.422 - *
   4.423 - * The blit semantics for surfaces with and without alpha and colorkey
   4.424 - * are defined as follows:
   4.425 - *
   4.426 - * RGBA->RGB:
   4.427 - *     SDL_SRCALPHA set:
   4.428 - * 	alpha-blend (using alpha-channel).
   4.429 - * 	SDL_SRCCOLORKEY ignored.
   4.430 - *     SDL_SRCALPHA not set:
   4.431 - * 	copy RGB.
   4.432 - * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   4.433 - * 	RGB values of the source colour key, ignoring alpha in the
   4.434 - * 	comparison.
   4.435 - * 
   4.436 - * RGB->RGBA:
   4.437 - *     SDL_SRCALPHA set:
   4.438 - * 	alpha-blend (using the source per-surface alpha value);
   4.439 - * 	set destination alpha to opaque.
   4.440 - *     SDL_SRCALPHA not set:
   4.441 - * 	copy RGB, set destination alpha to source per-surface alpha value.
   4.442 - *     both:
   4.443 - * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   4.444 - * 	source colour key.
   4.445 - * 
   4.446 - * RGBA->RGBA:
   4.447 - *     SDL_SRCALPHA set:
   4.448 - * 	alpha-blend (using the source alpha channel) the RGB values;
   4.449 - * 	leave destination alpha untouched. [Note: is this correct?]
   4.450 - * 	SDL_SRCCOLORKEY ignored.
   4.451 - *     SDL_SRCALPHA not set:
   4.452 - * 	copy all of RGBA to the destination.
   4.453 - * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   4.454 - * 	RGB values of the source colour key, ignoring alpha in the
   4.455 - * 	comparison.
   4.456 - * 
   4.457 - * RGB->RGB: 
   4.458 - *     SDL_SRCALPHA set:
   4.459 - * 	alpha-blend (using the source per-surface alpha value).
   4.460 - *     SDL_SRCALPHA not set:
   4.461 - * 	copy RGB.
   4.462 - *     both:
   4.463 - * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
   4.464 - * 	source colour key.
   4.465 - *
   4.466 - * If either of the surfaces were in video memory, and the blit returns -2,
   4.467 - * the video memory was lost, so it should be reloaded with artwork and 
   4.468 - * re-blitted:
   4.469 -	while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
   4.470 -		while ( SDL_LockSurface(image) < 0 )
   4.471 -			Sleep(10);
   4.472 -		-- Write image pixels to image->pixels --
   4.473 -		SDL_UnlockSurface(image);
   4.474 -	}
   4.475 - * This happens under DirectX 5.0 when the system switches away from your
   4.476 - * fullscreen application.  The lock will also fail until you have access
   4.477 - * to the video memory again.
   4.478 - */
   4.479 -/* You should call SDL_BlitSurface() unless you know exactly how SDL
   4.480 -   blitting works internally and how to use the other blit functions.
   4.481 -*/
   4.482 -#define SDL_BlitSurface SDL_UpperBlit
   4.483 -
   4.484 -/* This is the public blit function, SDL_BlitSurface(), and it performs
   4.485 -   rectangle validation and clipping before passing it to SDL_LowerBlit()
   4.486 -*/
   4.487 -extern DECLSPEC int SDLCALL SDL_UpperBlit
   4.488 -    (SDL_Surface * src, SDL_Rect * srcrect,
   4.489 -     SDL_Surface * dst, SDL_Rect * dstrect);
   4.490 -/* This is a semi-private blit function and it performs low-level surface
   4.491 -   blitting only.
   4.492 -*/
   4.493 -extern DECLSPEC int SDLCALL SDL_LowerBlit
   4.494 -    (SDL_Surface * src, SDL_Rect * srcrect,
   4.495 -     SDL_Surface * dst, SDL_Rect * dstrect);
   4.496 -
   4.497 -/**
   4.498 - * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
   4.499 - *
   4.500 - * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
   4.501 - *
   4.502 - * \note This function uses a static buffer, and is not thread-safe.
   4.503 - */
   4.504 -extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
   4.505 -                                            SDL_Rect * srcrect,
   4.506 -                                            SDL_Surface * dst,
   4.507 -                                            SDL_Rect * dstrect);
   4.508  
   4.509  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
   4.510  /* OpenGL support functions.                                                 */
   4.511 @@ -1811,50 +1344,6 @@
   4.512   */
   4.513  extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
   4.514  
   4.515 -/**
   4.516 - * \def SDL_RectEmpty()
   4.517 - *
   4.518 - * \brief Returns true if the rectangle has no area.
   4.519 - */
   4.520 -#define SDL_RectEmpty(X)    (((X)->w <= 0) || ((X)->h <= 0))
   4.521 -
   4.522 -/**
   4.523 - * \def SDL_RectEquals()
   4.524 - *
   4.525 - * \brief Returns true if the two rectangles are equal.
   4.526 - */
   4.527 -#define SDL_RectEquals(A, B)   (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
   4.528 -                                ((A)->w == (B)->w) && ((A)->h == (B)->h))
   4.529 -
   4.530 -/**
   4.531 - * \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B);
   4.532 - *
   4.533 - * \brief Determine whether two rectangles intersect.
   4.534 - *
   4.535 - * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
   4.536 - */
   4.537 -extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
   4.538 -                                                     const SDL_Rect * B);
   4.539 -
   4.540 -/**
   4.541 - * \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
   4.542 - *
   4.543 - * \brief Calculate the intersection of two rectangles.
   4.544 - *
   4.545 - * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
   4.546 - */
   4.547 -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
   4.548 -                                                   const SDL_Rect * B,
   4.549 -                                                   SDL_Rect * result);
   4.550 -
   4.551 -/**
   4.552 - * \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
   4.553 - *
   4.554 - * \brief Calculate the union of two rectangles
   4.555 - */
   4.556 -extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
   4.557 -                                           const SDL_Rect * B,
   4.558 -                                           SDL_Rect * result);
   4.559  
   4.560  /* Ends C function definitions when using C++ */
   4.561  #ifdef __cplusplus
     5.1 --- a/src/video/SDL_pixels.c	Mon Sep 10 12:11:40 2007 +0000
     5.2 +++ b/src/video/SDL_pixels.c	Mon Sep 10 12:20:02 2007 +0000
     5.3 @@ -536,8 +536,7 @@
     5.4  
     5.5  /* Find the opaque pixel value corresponding to an RGB triple */
     5.6  Uint32
     5.7 -SDL_MapRGB(const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g,
     5.8 -           const Uint8 b)
     5.9 +SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b)
    5.10  {
    5.11      if (format->palette == NULL) {
    5.12          return (r >> format->Rloss) << format->Rshift
    5.13 @@ -550,8 +549,8 @@
    5.14  
    5.15  /* Find the pixel value corresponding to an RGBA quadruple */
    5.16  Uint32
    5.17 -SDL_MapRGBA(const SDL_PixelFormat * const format, const Uint8 r,
    5.18 -            const Uint8 g, const Uint8 b, const Uint8 a)
    5.19 +SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b,
    5.20 +            Uint8 a)
    5.21  {
    5.22      if (format->palette == NULL) {
    5.23          return (r >> format->Rloss) << format->Rshift
    5.24 @@ -564,10 +563,37 @@
    5.25  }
    5.26  
    5.27  void
    5.28 -SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
    5.29 +SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g,
    5.30 +           Uint8 * b)
    5.31 +{
    5.32 +    if (format->palette == NULL) {
    5.33 +        /*
    5.34 +         * This makes sure that the result is mapped to the
    5.35 +         * interval [0..255], and the maximum value for each
    5.36 +         * component is 255. This is important to make sure
    5.37 +         * that white is indeed reported as (255, 255, 255).
    5.38 +         * This only works for RGB bit fields at least 4 bit
    5.39 +         * wide, which is almost always the case.
    5.40 +         */
    5.41 +        unsigned v;
    5.42 +        v = (pixel & format->Rmask) >> format->Rshift;
    5.43 +        *r = (v << format->Rloss) + (v >> (8 - (format->Rloss << 1)));
    5.44 +        v = (pixel & format->Gmask) >> format->Gshift;
    5.45 +        *g = (v << format->Gloss) + (v >> (8 - (format->Gloss << 1)));
    5.46 +        v = (pixel & format->Bmask) >> format->Bshift;
    5.47 +        *b = (v << format->Bloss) + (v >> (8 - (format->Bloss << 1)));
    5.48 +    } else {
    5.49 +        *r = format->palette->colors[pixel].r;
    5.50 +        *g = format->palette->colors[pixel].g;
    5.51 +        *b = format->palette->colors[pixel].b;
    5.52 +    }
    5.53 +}
    5.54 +
    5.55 +void
    5.56 +SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format,
    5.57              Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
    5.58  {
    5.59 -    if (fmt->palette == NULL) {
    5.60 +    if (format->palette == NULL) {
    5.61          /*
    5.62           * This makes sure that the result is mapped to the
    5.63           * interval [0..255], and the maximum value for each
    5.64 @@ -578,46 +604,26 @@
    5.65           * wide, which is almost always the case.
    5.66           */
    5.67          unsigned v;
    5.68 -        v = (pixel & fmt->Rmask) >> fmt->Rshift;
    5.69 -        *r = (v << fmt->Rloss) + (v >> (8 - (fmt->Rloss << 1)));
    5.70 -        v = (pixel & fmt->Gmask) >> fmt->Gshift;
    5.71 -        *g = (v << fmt->Gloss) + (v >> (8 - (fmt->Gloss << 1)));
    5.72 -        v = (pixel & fmt->Bmask) >> fmt->Bshift;
    5.73 -        *b = (v << fmt->Bloss) + (v >> (8 - (fmt->Bloss << 1)));
    5.74 -        if (fmt->Amask) {
    5.75 -            v = (pixel & fmt->Amask) >> fmt->Ashift;
    5.76 -            *a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
    5.77 +        v = (pixel & format->Rmask) >> format->Rshift;
    5.78 +        *r = (v << format->Rloss) + (v >> (8 - (format->Rloss << 1)));
    5.79 +        v = (pixel & format->Gmask) >> format->Gshift;
    5.80 +        *g = (v << format->Gloss) + (v >> (8 - (format->Gloss << 1)));
    5.81 +        v = (pixel & format->Bmask) >> format->Bshift;
    5.82 +        *b = (v << format->Bloss) + (v >> (8 - (format->Bloss << 1)));
    5.83 +        if (format->Amask) {
    5.84 +            v = (pixel & format->Amask) >> format->Ashift;
    5.85 +            *a = (v << format->Aloss) + (v >> (8 - (format->Aloss << 1)));
    5.86          } else {
    5.87              *a = SDL_ALPHA_OPAQUE;
    5.88          }
    5.89      } else {
    5.90 -        *r = fmt->palette->colors[pixel].r;
    5.91 -        *g = fmt->palette->colors[pixel].g;
    5.92 -        *b = fmt->palette->colors[pixel].b;
    5.93 +        *r = format->palette->colors[pixel].r;
    5.94 +        *g = format->palette->colors[pixel].g;
    5.95 +        *b = format->palette->colors[pixel].b;
    5.96          *a = SDL_ALPHA_OPAQUE;
    5.97      }
    5.98  }
    5.99  
   5.100 -void
   5.101 -SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt, Uint8 * r, Uint8 * g,
   5.102 -           Uint8 * b)
   5.103 -{
   5.104 -    if (fmt->palette == NULL) {
   5.105 -        /* the note for SDL_GetRGBA above applies here too */
   5.106 -        unsigned v;
   5.107 -        v = (pixel & fmt->Rmask) >> fmt->Rshift;
   5.108 -        *r = (v << fmt->Rloss) + (v >> (8 - (fmt->Rloss << 1)));
   5.109 -        v = (pixel & fmt->Gmask) >> fmt->Gshift;
   5.110 -        *g = (v << fmt->Gloss) + (v >> (8 - (fmt->Gloss << 1)));
   5.111 -        v = (pixel & fmt->Bmask) >> fmt->Bshift;
   5.112 -        *b = (v << fmt->Bloss) + (v >> (8 - (fmt->Bloss << 1)));
   5.113 -    } else {
   5.114 -        *r = fmt->palette->colors[pixel].r;
   5.115 -        *g = fmt->palette->colors[pixel].g;
   5.116 -        *b = fmt->palette->colors[pixel].b;
   5.117 -    }
   5.118 -}
   5.119 -
   5.120  /* Apply gamma to a set of colors - this is easy. :) */
   5.121  void
   5.122  SDL_ApplyGamma(Uint16 * gamma, SDL_Color * colors, SDL_Color * output,
     6.1 --- a/src/video/SDL_rect.c	Mon Sep 10 12:11:40 2007 +0000
     6.2 +++ b/src/video/SDL_rect.c	Mon Sep 10 12:20:02 2007 +0000
     6.3 @@ -143,7 +143,6 @@
     6.4      dirty->rect = *rect;
     6.5      dirty->next = list->list;
     6.6      list->list = dirty;
     6.7 -    ++list->count;
     6.8  }
     6.9  
    6.10  void
    6.11 @@ -164,7 +163,6 @@
    6.12          list->free = list->list;
    6.13      }
    6.14      list->list = NULL;
    6.15 -    list->count = 0;
    6.16  }
    6.17  
    6.18  void
     7.1 --- a/src/video/SDL_rect_c.h	Mon Sep 10 12:11:40 2007 +0000
     7.2 +++ b/src/video/SDL_rect_c.h	Mon Sep 10 12:20:02 2007 +0000
     7.3 @@ -29,7 +29,6 @@
     7.4  
     7.5  typedef struct SDL_DirtyRectList
     7.6  {
     7.7 -    int count;
     7.8      SDL_DirtyRect *list;
     7.9      SDL_DirtyRect *free;
    7.10  } SDL_DirtyRectList;
     8.1 --- a/src/video/SDL_renderer_gl.c	Mon Sep 10 12:11:40 2007 +0000
     8.2 +++ b/src/video/SDL_renderer_gl.c	Mon Sep 10 12:20:02 2007 +0000
     8.3 @@ -806,7 +806,7 @@
     8.4      int minx, miny, maxx, maxy;
     8.5      GLfloat minu, maxu, minv, maxv;
     8.6  
     8.7 -    if (texturedata->dirty.count > 0) {
     8.8 +    if (texturedata->dirty.list) {
     8.9          SDL_DirtyRect *dirty;
    8.10          void *pixels;
    8.11          int bpp = SDL_BYTESPERPIXEL(texture->format);