Changeset 2305 for libcaca/trunk/cucul/cucul.c
- Timestamp:
- Apr 19, 2008, 9:25:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/cucul.c
r2300 r2305 34 34 #include "cucul_internals.h" 35 35 36 static int cucul_resize(cucul_canvas_t *, unsigned int, unsignedint);36 static int cucul_resize(cucul_canvas_t *, int, int); 37 37 38 38 /** \brief Initialise a \e libcucul canvas. … … 47 47 * 48 48 * If an error occurs, NULL is returned and \b errno is set accordingly: 49 * - \c EINVAL Specified width or height is invalid. 49 50 * - \c ENOMEM Not enough memory for the requested canvas size. 50 51 * … … 53 54 * \return A libcucul canvas handle upon success, NULL if an error occurred. 54 55 */ 55 cucul_canvas_t * cucul_create_canvas(unsigned int width, unsigned int height) 56 { 57 cucul_canvas_t *cv = malloc(sizeof(cucul_canvas_t)); 56 cucul_canvas_t * cucul_create_canvas(int width, int height) 57 { 58 cucul_canvas_t *cv; 59 60 if(width < 0 || height < 0) 61 { 62 seterrno(EINVAL); 63 return NULL; 64 } 65 66 cv = malloc(sizeof(cucul_canvas_t)); 58 67 59 68 if(!cv) … … 191 200 * 192 201 * If an error occurs, -1 is returned and \b errno is set accordingly: 202 * - \c EINVAL Specified width or height is invalid. 193 203 * - \c EBUSY The canvas is in use by a display driver and cannot be resized. 194 204 * - \c ENOMEM Not enough memory for the requested canvas size. If this … … 200 210 * \return 0 in case of success, -1 if an error occurred. 201 211 */ 202 int cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, 203 unsigned int height) 204 { 212 int cucul_set_canvas_size(cucul_canvas_t *cv, int width, int height) 213 { 214 if(width < 0 || height < 0) 215 { 216 seterrno(EINVAL); 217 return -1; 218 } 219 205 220 if(cv->refcount && cv->resize_callback 206 221 && !cv->resize_callback(cv->resize_data)) … … 222 237 * \return The canvas width. 223 238 */ 224 unsignedint cucul_get_canvas_width(cucul_canvas_t const *cv)239 int cucul_get_canvas_width(cucul_canvas_t const *cv) 225 240 { 226 241 return cv->width; … … 236 251 * \return The canvas height. 237 252 */ 238 unsignedint cucul_get_canvas_height(cucul_canvas_t const *cv)253 int cucul_get_canvas_height(cucul_canvas_t const *cv) 239 254 { 240 255 return cv->height; … … 293 308 int cucul_free_canvas(cucul_canvas_t *cv) 294 309 { 295 unsignedint f;310 int f; 296 311 297 312 if(cv->refcount) … … 357 372 */ 358 373 359 int cucul_resize(cucul_canvas_t *cv, unsigned int width, unsignedint height)360 { 361 unsignedint x, y, f, old_width, old_height, new_size, old_size;374 int cucul_resize(cucul_canvas_t *cv, int width, int height) 375 { 376 int x, y, f, old_width, old_height, new_size, old_size; 362 377 363 378 old_width = cv->width; … … 427 442 /* New width is smaller. Copy as many lines as possible. Ignore 428 443 * the first line, it is already in place. */ 429 unsignedint lines = height < old_height ? height : old_height;444 int lines = height < old_height ? height : old_height; 430 445 431 446 for(f = 0; f < cv->framecount; f++)
Note: See TracChangeset
for help on using the changeset viewer.