comparison src/video/SDL_shape.c @ 4801:506a9165491b

Added #define's for error codes returned from SDL shaped-window API.
author Eli Gottlieb <eligottlieb@gmail.com>
date Sun, 18 Jul 2010 22:24:52 -0400
parents a0e096916474
children f14a8c05f5bb
comparison
equal deleted inserted replaced
4800:6d4be626225f 4801:506a9165491b
80 80
81 int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { 81 int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
82 int result; 82 int result;
83 if(window == NULL || !SDL_IsShapedWindow(window)) 83 if(window == NULL || !SDL_IsShapedWindow(window))
84 //The window given was not a shapeable window. 84 //The window given was not a shapeable window.
85 return -2; 85 return SDL_NONSHAPEABLE_WINDOW;
86 if(shape == NULL) 86 if(shape == NULL)
87 //Invalid shape argument. 87 //Invalid shape argument.
88 return -1; 88 return SDL_INVALID_SHAPE_ARGUMENT;
89 89
90 if(shapeMode != NULL) { 90 if(shapeMode != NULL) {
91 switch(shapeMode->mode) { 91 switch(shapeMode->mode) {
92 case ShapeModeDefault: { 92 case ShapeModeDefault: {
93 window->shaper->alphacutoff = 1; 93 window->shaper->alphacutoff = 1;
121 if(SDL_WindowHasAShape(window)) 121 if(SDL_WindowHasAShape(window))
122 //The window given has a shape. 122 //The window given has a shape.
123 return 0; 123 return 0;
124 else 124 else
125 //The window given is shapeable but lacks a shape. 125 //The window given is shapeable but lacks a shape.
126 return -2; 126 return SDL_WINDOW_LACKS_SHAPE;
127 } 127 }
128 else { 128 else {
129 if(window->shaper->alphacutoff != 1) { 129 if(window->shaper->alphacutoff != 1) {
130 shapeMode->mode = ShapeModeBinarizeAlpha; 130 shapeMode->mode = ShapeModeBinarizeAlpha;
131 shapeMode->parameters.binarizationCutoff = window->shaper->alphacutoff; 131 shapeMode->parameters.binarizationCutoff = window->shaper->alphacutoff;
135 return 0; 135 return 0;
136 } 136 }
137 } 137 }
138 else 138 else
139 //The window given is not a valid shapeable window. 139 //The window given is not a valid shapeable window.
140 return -1; 140 return SDL_NONSHAPEABLE_WINDOW;
141 } 141 }