Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Split out the SDL_rect and SDL_surface functions into their own headers.

Removed unused count from the dirty rect list.
  • Loading branch information
slouken committed Sep 10, 2007
1 parent df3b4e4 commit 58a1001c403db2cf94f15844ff74e68bb4a7d850
Showing with 705 additions and 556 deletions.
  1. +52 −0 include/SDL_pixels.h
  2. +117 −0 include/SDL_rect.h
  3. +488 −0 include/SDL_surface.h
  4. +3 −514 include/SDL_video.h
  5. +44 −38 src/video/SDL_pixels.c
  6. +0 −2 src/video/SDL_rect.c
  7. +0 −1 src/video/SDL_rect_c.h
  8. +1 −1 src/video/SDL_renderer_gl.c
@@ -37,6 +37,10 @@ extern "C" {
/* *INDENT-ON* */
#endif

/* Transparency definitions: These define alpha as the opacity of a surface */
#define SDL_ALPHA_OPAQUE 255
#define SDL_ALPHA_TRANSPARENT 0

enum
{ /* Pixel type */
SDL_PIXELTYPE_UNKNOWN,
@@ -330,6 +334,54 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
*/
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);

/**
* \fn Uint32 SDL_MapRGB(const SDL_PixelFormat *format,
* Uint8 r, Uint8 g, Uint8 b)
*
* \brief Maps an RGB triple to an opaque pixel value for a given pixel format
*
* \sa SDL_MapRGBA
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
Uint8 r, Uint8 g, Uint8 b);

/**
* \fn Uint32 SDL_MapRGBA(const SDL_PixelFormat *fmt,
* Uint8 r, Uint8 g, Uint8 b, Uint8 a)
*
* \brief Maps an RGBA quadruple to a pixel value for a given pixel format
*
* \sa SDL_MapRGB
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
Uint8 r, Uint8 g, Uint8 b,
Uint8 a);

/**
* \fn void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format,
* Uint8 * r, Uint8 * g, Uint8 * b)
*
* \brief Maps a pixel value into the RGB components for a given pixel format
*
* \sa SDL_GetRGBA
*/
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
const SDL_PixelFormat * format,
Uint8 * r, Uint8 * g, Uint8 * b);

/**
* \fn void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format,
* Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
*
* \brief Maps a pixel value into the RGBA components for a given pixel format
*
* \sa SDL_GetRGB
*/
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
const SDL_PixelFormat * format,
Uint8 * r, Uint8 * g, Uint8 * b,
Uint8 * a);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
@@ -0,0 +1,117 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/

/**
* \file SDL_rect.h
*
* Header file for SDL_rect definition and management functions
*/

#ifndef _SDL_rect_h
#define _SDL_rect_h

#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_pixels.h"
#include "SDL_rwops.h"

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
/* *INDENT-ON* */
#endif

/**
* \struct SDL_Rect
*
* \brief A rectangle, with the origin at the upper left.
*
* \sa SDL_RectEmpty
* \sa SDL_RectEquals
* \sa SDL_HasIntersection
* \sa SDL_IntersectRect
* \sa SDL_UnionRect
*/
typedef struct SDL_Rect
{
int x, y;
int w, h;
} SDL_Rect;

/**
* \def SDL_RectEmpty()
*
* \brief Returns true if the rectangle has no area.
*/
#define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0))

/**
* \def SDL_RectEquals()
*
* \brief Returns true if the two rectangles are equal.
*/
#define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
((A)->w == (B)->w) && ((A)->h == (B)->h))

/**
* \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B);
*
* \brief Determine whether two rectangles intersect.
*
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
const SDL_Rect * B);

/**
* \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
*
* \brief Calculate the intersection of two rectangles.
*
* \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);

/**
* \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
*
* \brief Calculate the union of two rectangles
*/
extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
const SDL_Rect * B,
SDL_Rect * result);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
}
/* *INDENT-ON* */
#endif
#include "close_code.h"

#endif /* _SDL_rect_h */

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit 58a1001

Please sign in to comment.