From 824a81b6059d77024c21ec94a9ab71af541d6ead Mon Sep 17 00:00:00 2001 From: Eli Gottlieb Date: Mon, 21 Jun 2010 23:08:10 -0400 Subject: [PATCH] Added Andreas's fixes to the header and stub file for SDL_shape. --- include/SDL_shape.h | 32 +++++++++++++++++++------------- src/video/SDL_shape.c | 6 +++--- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/include/SDL_shape.h b/include/SDL_shape.h index d1108feba..f96769798 100644 --- a/include/SDL_shape.h +++ b/include/SDL_shape.h @@ -39,11 +39,11 @@ extern "C" { /** \file SDL_shape.h * - * Header file for shaped windows. + * Header file for the shaped window API. */ /** - * \brief Create a shaped window with the specified position, dimensions, and flags. + * \brief Create a window that can be shaped with the specified position, dimensions, and flags. * * \param title The title of the window, in UTF-8 encoding. * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or @@ -69,13 +69,18 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un * * \param window The window to query for being shaped. * - * \return SDL_TRUE if the window is a shaped window and SDL_FALSE otherwise. + * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. * \sa SDL_CreateShapedWindow */ -extern DECLSPEC SDL_bool SDLCALL SDL_WindowIsShaped(const SDL_Window *window); +extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ -typedef enum {ShapeModeDefault, ShapeModeBinarizeAlpha} WindowShapeMode; +typedef enum { + /** \brief The default mode, a binarized alpha cutoff of 1. */ + ShapeModeDefault, + /** \brief A binarized alpha cutoff with a given integer value. */ + ShapeModeBinarizeAlpha +} WindowShapeMode; /** \brief A union containing parameters for shaped windows. */ typedef union { /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ @@ -94,29 +99,30 @@ typedef struct SDL_WindowShapeMode { * \brief Set the shape and parameters of a shaped window. * * \param window The shaped window whose parameters should be set. - * \param shape A surface encoding the desired shape for the window as a bitmap mask. - * \param parameters The parameters to set for the shaped window. + * \param shape A surface encoding the desired shape for the window. + * \param shapeMode The parameters to set for the shaped window. * * \return 0 on success, -1 on invalid an invalid shape argument, or -2 if the SDL_Window* given does not reference * a valid shaped window. * * \sa SDL_WindowShapeMode - * \sa SDL_GetShapeParameters. + * \sa SDL_GetShapedWindowMode. */ -extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode parameters); +extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); /** - * \brief Set the shape parameters of a shaped window. + * \brief Get the shape parameters of a shaped window. * * \param window The shaped window whose parameters should be retrieved. * \param shapeMode An empty shape-parameters structure to fill. * - * \return 0 on success, -1 on a null shapeMode, or -2 if the SDL_Window given is not a shaped window. + * \return 0 on success, -1 on a null shapeMode, or -2 if the SDL_Window given is not a shaped window, or -3 if the + * SDL_Window given is a window that can be shaped but isn't. * * \sa SDL_WindowShapeMode - * \sa SDL_SetShapeParameters + * \sa SDL_SetWindowShape */ -extern DECLSPEC int SDLCALL SDL_GetShapeParameters(SDL_Window *window,SDL_WindowShapeMode *shapeMode); +extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shapeMode); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index 6eb7d9ed3..c38fc47b3 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -30,11 +30,11 @@ SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int return NULL; } -SDL_bool SDL_WindowIsShaped(const SDL_Window *window) { +SDL_bool SDL_IsShapedWindow(const SDL_Window *window) { return SDL_FALSE; } -int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode parameters) { +int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { if(window == NULL || !SDL_WindowIsShaped(window)) return -2; if(shape == NULL) @@ -42,7 +42,7 @@ int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode return -3; } -int SDL_GetShapeParameters(SDL_Window *window,SDL_WindowShapeMode *shapeMode) { +int SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shapeMode) { if(shapeMode == NULL) return -1; if(window == NULL || !SDL_WindowIsShaped(window))