Fixed formatting of SDL_shape.c post-merge again.
This commit is contained in:
parent
4e4cf1cebe
commit
f294cf6a4c
1 changed files with 224 additions and 214 deletions
|
@ -30,7 +30,8 @@
|
|||
#include "SDL_shape.h"
|
||||
#include "SDL_shape_internals.h"
|
||||
|
||||
SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
|
||||
SDL_Window*
|
||||
SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
|
||||
SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
|
||||
if(result != NULL) {
|
||||
result->shaper = result->display->device->shape_driver.CreateShaper(result);
|
||||
|
@ -50,7 +51,8 @@ SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SDL_bool SDL_IsShapedWindow(const SDL_Window *window) {
|
||||
SDL_bool
|
||||
SDL_IsShapedWindow(const SDL_Window *window) {
|
||||
if(window == NULL)
|
||||
return SDL_FALSE;
|
||||
else
|
||||
|
@ -58,7 +60,8 @@ SDL_bool SDL_IsShapedWindow(const SDL_Window *window) {
|
|||
}
|
||||
|
||||
/* REQUIRES that bitmap point to a w-by-h bitmap with ppb pixels-per-byte. */
|
||||
void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb) {
|
||||
void
|
||||
SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
Uint8 r = 0,g = 0,b = 0,alpha = 0;
|
||||
|
@ -111,7 +114,8 @@ void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8*
|
|||
SDL_UnlockSurface(shape);
|
||||
}
|
||||
|
||||
SDL_ShapeTree* RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rect dimensions) {
|
||||
SDL_ShapeTree*
|
||||
RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rect dimensions) {
|
||||
int x = 0,y = 0;
|
||||
Uint8* pixel = NULL;
|
||||
Uint32 pixel_value = 0;
|
||||
|
@ -184,7 +188,8 @@ SDL_ShapeTree* RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surfac
|
|||
return result;
|
||||
}
|
||||
|
||||
SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) {
|
||||
SDL_ShapeTree*
|
||||
SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) {
|
||||
SDL_Rect dimensions = {0,0,shape->w,shape->h};
|
||||
SDL_ShapeTree* result = NULL;
|
||||
if(SDL_MUSTLOCK(shape))
|
||||
|
@ -195,7 +200,8 @@ SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shap
|
|||
return result;
|
||||
}
|
||||
|
||||
void SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure) {
|
||||
void
|
||||
SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure) {
|
||||
SDL_assert(tree != NULL);
|
||||
if(tree->kind == QuadShape) {
|
||||
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft,function,closure);
|
||||
|
@ -207,7 +213,8 @@ void SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,vo
|
|||
function(tree,closure);
|
||||
}
|
||||
|
||||
void SDL_FreeShapeTree(SDL_ShapeTree** shapeTree) {
|
||||
void
|
||||
SDL_FreeShapeTree(SDL_ShapeTree** shapeTree) {
|
||||
if((*shapeTree)->kind == QuadShape) {
|
||||
SDL_FreeShapeTree((SDL_ShapeTree **)&(*shapeTree)->data.children.upleft);
|
||||
SDL_FreeShapeTree((SDL_ShapeTree **)&(*shapeTree)->data.children.upright);
|
||||
|
@ -218,7 +225,8 @@ void SDL_FreeShapeTree(SDL_ShapeTree** shapeTree) {
|
|||
*shapeTree = NULL;
|
||||
}
|
||||
|
||||
int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
|
||||
int
|
||||
SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
|
||||
int result;
|
||||
if(window == NULL || !SDL_IsShapedWindow(window))
|
||||
//The window given was not a shapeable window.
|
||||
|
@ -239,13 +247,15 @@ int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode
|
|||
return result;
|
||||
}
|
||||
|
||||
SDL_bool SDL_WindowHasAShape(SDL_Window *window) {
|
||||
SDL_bool
|
||||
SDL_WindowHasAShape(SDL_Window *window) {
|
||||
if (window == NULL || !SDL_IsShapedWindow(window))
|
||||
return SDL_FALSE;
|
||||
return window->shaper->hasshape;
|
||||
}
|
||||
|
||||
int SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shapeMode) {
|
||||
int
|
||||
SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shapeMode) {
|
||||
if(window != NULL && SDL_IsShapedWindow(window)) {
|
||||
if(shapeMode == NULL) {
|
||||
if(SDL_WindowHasAShape(window))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue