Mercurial > sdl-ios-xcode
comparison src/video/SDL_surface.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 6e7ec5cb83c3 |
children | eef792d31de8 |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
33 /* Public routines */ | 33 /* Public routines */ |
34 /* | 34 /* |
35 * Create an empty RGB surface of the appropriate depth | 35 * Create an empty RGB surface of the appropriate depth |
36 */ | 36 */ |
37 SDL_Surface * | 37 SDL_Surface * |
38 SDL_CreateRGBSurface (Uint32 flags, | 38 SDL_CreateRGBSurface(Uint32 flags, |
39 int width, int height, int depth, | 39 int width, int height, int depth, |
40 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) | 40 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
41 { | 41 { |
42 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 42 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
43 SDL_Surface *screen; | 43 SDL_Surface *screen; |
44 SDL_Surface *surface; | 44 SDL_Surface *surface; |
45 | 45 |
46 /* Make sure the size requested doesn't overflow our datatypes */ | 46 /* Make sure the size requested doesn't overflow our datatypes */ |
47 /* Next time I write a library like SDL, I'll use int for size. :) */ | 47 /* Next time I write a library like SDL, I'll use int for size. :) */ |
48 if (width >= 16384 || height >= 65536) { | 48 if (width >= 16384 || height >= 65536) { |
49 SDL_SetError ("Width or height is too large"); | 49 SDL_SetError("Width or height is too large"); |
50 return (NULL); | 50 return (NULL); |
51 } | 51 } |
52 | 52 |
53 /* Check to see if we desire the surface in video memory */ | 53 /* Check to see if we desire the surface in video memory */ |
54 if (_this) { | 54 if (_this) { |
73 } else { | 73 } else { |
74 flags &= ~SDL_HWSURFACE; | 74 flags &= ~SDL_HWSURFACE; |
75 } | 75 } |
76 | 76 |
77 /* Allocate the surface */ | 77 /* Allocate the surface */ |
78 surface = (SDL_Surface *) SDL_malloc (sizeof (*surface)); | 78 surface = (SDL_Surface *) SDL_malloc(sizeof(*surface)); |
79 if (surface == NULL) { | 79 if (surface == NULL) { |
80 SDL_OutOfMemory (); | 80 SDL_OutOfMemory(); |
81 return (NULL); | 81 return (NULL); |
82 } | 82 } |
83 surface->flags = SDL_SWSURFACE; | 83 surface->flags = SDL_SWSURFACE; |
84 if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) { | 84 if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) { |
85 if ((Amask) && (_this->displayformatalphapixel)) { | 85 if ((Amask) && (_this->displayformatalphapixel)) { |
94 Gmask = screen->format->Gmask; | 94 Gmask = screen->format->Gmask; |
95 Bmask = screen->format->Bmask; | 95 Bmask = screen->format->Bmask; |
96 Amask = screen->format->Amask; | 96 Amask = screen->format->Amask; |
97 } | 97 } |
98 } | 98 } |
99 surface->format = SDL_AllocFormat (depth, Rmask, Gmask, Bmask, Amask); | 99 surface->format = SDL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask); |
100 if (surface->format == NULL) { | 100 if (surface->format == NULL) { |
101 SDL_free (surface); | 101 SDL_free(surface); |
102 return (NULL); | 102 return (NULL); |
103 } | 103 } |
104 if (Amask) { | 104 if (Amask) { |
105 surface->flags |= SDL_SRCALPHA; | 105 surface->flags |= SDL_SRCALPHA; |
106 } | 106 } |
107 surface->w = width; | 107 surface->w = width; |
108 surface->h = height; | 108 surface->h = height; |
109 surface->pitch = SDL_CalculatePitch (surface); | 109 surface->pitch = SDL_CalculatePitch(surface); |
110 surface->pixels = NULL; | 110 surface->pixels = NULL; |
111 surface->offset = 0; | 111 surface->offset = 0; |
112 surface->hwdata = NULL; | 112 surface->hwdata = NULL; |
113 surface->locked = 0; | 113 surface->locked = 0; |
114 surface->map = NULL; | 114 surface->map = NULL; |
115 surface->unused1 = 0; | 115 surface->unused1 = 0; |
116 SDL_SetClipRect (surface, NULL); | 116 SDL_SetClipRect(surface, NULL); |
117 SDL_FormatChanged (surface); | 117 SDL_FormatChanged(surface); |
118 | 118 |
119 /* Get the pixels */ | 119 /* Get the pixels */ |
120 if (((flags & SDL_HWSURFACE) == SDL_SWSURFACE) || | 120 if (((flags & SDL_HWSURFACE) == SDL_SWSURFACE) || |
121 (_this->AllocHWSurface (_this, surface) < 0)) { | 121 (_this->AllocHWSurface(_this, surface) < 0)) { |
122 if (surface->w && surface->h) { | 122 if (surface->w && surface->h) { |
123 surface->pixels = SDL_malloc (surface->h * surface->pitch); | 123 surface->pixels = SDL_malloc(surface->h * surface->pitch); |
124 if (surface->pixels == NULL) { | 124 if (surface->pixels == NULL) { |
125 SDL_FreeSurface (surface); | 125 SDL_FreeSurface(surface); |
126 SDL_OutOfMemory (); | 126 SDL_OutOfMemory(); |
127 return (NULL); | 127 return (NULL); |
128 } | 128 } |
129 /* This is important for bitmaps */ | 129 /* This is important for bitmaps */ |
130 SDL_memset (surface->pixels, 0, surface->h * surface->pitch); | 130 SDL_memset(surface->pixels, 0, surface->h * surface->pitch); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 /* Allocate an empty mapping */ | 134 /* Allocate an empty mapping */ |
135 surface->map = SDL_AllocBlitMap (); | 135 surface->map = SDL_AllocBlitMap(); |
136 if (surface->map == NULL) { | 136 if (surface->map == NULL) { |
137 SDL_FreeSurface (surface); | 137 SDL_FreeSurface(surface); |
138 return (NULL); | 138 return (NULL); |
139 } | 139 } |
140 | 140 |
141 /* The surface is ready to go */ | 141 /* The surface is ready to go */ |
142 surface->refcount = 1; | 142 surface->refcount = 1; |
148 | 148 |
149 /* | 149 /* |
150 * Create an RGB surface from an existing memory buffer | 150 * Create an RGB surface from an existing memory buffer |
151 */ | 151 */ |
152 SDL_Surface * | 152 SDL_Surface * |
153 SDL_CreateRGBSurfaceFrom (void *pixels, | 153 SDL_CreateRGBSurfaceFrom(void *pixels, |
154 int width, int height, int depth, int pitch, | 154 int width, int height, int depth, int pitch, |
155 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, | 155 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, |
156 Uint32 Amask) | 156 Uint32 Amask) |
157 { | 157 { |
158 SDL_Surface *surface; | 158 SDL_Surface *surface; |
159 | 159 |
160 surface = SDL_CreateRGBSurface (SDL_SWSURFACE, 0, 0, depth, | 160 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, depth, |
161 Rmask, Gmask, Bmask, Amask); | 161 Rmask, Gmask, Bmask, Amask); |
162 if (surface != NULL) { | 162 if (surface != NULL) { |
163 surface->flags |= SDL_PREALLOC; | 163 surface->flags |= SDL_PREALLOC; |
164 surface->pixels = pixels; | 164 surface->pixels = pixels; |
165 surface->w = width; | 165 surface->w = width; |
166 surface->h = height; | 166 surface->h = height; |
167 surface->pitch = pitch; | 167 surface->pitch = pitch; |
168 SDL_SetClipRect (surface, NULL); | 168 SDL_SetClipRect(surface, NULL); |
169 } | 169 } |
170 return (surface); | 170 return (surface); |
171 } | 171 } |
172 | 172 |
173 /* | 173 /* |
174 * Set the color key in a blittable surface | 174 * Set the color key in a blittable surface |
175 */ | 175 */ |
176 int | 176 int |
177 SDL_SetColorKey (SDL_Surface * surface, Uint32 flag, Uint32 key) | 177 SDL_SetColorKey(SDL_Surface * surface, Uint32 flag, Uint32 key) |
178 { | 178 { |
179 /* Sanity check the flag as it gets passed in */ | 179 /* Sanity check the flag as it gets passed in */ |
180 if (flag & SDL_SRCCOLORKEY) { | 180 if (flag & SDL_SRCCOLORKEY) { |
181 if (flag & (SDL_RLEACCEL | SDL_RLEACCELOK)) { | 181 if (flag & (SDL_RLEACCEL | SDL_RLEACCELOK)) { |
182 flag = (SDL_SRCCOLORKEY | SDL_RLEACCELOK); | 182 flag = (SDL_SRCCOLORKEY | SDL_RLEACCELOK); |
193 return (0); | 193 return (0); |
194 } | 194 } |
195 | 195 |
196 /* UnRLE surfaces before we change the colorkey */ | 196 /* UnRLE surfaces before we change the colorkey */ |
197 if (surface->flags & SDL_RLEACCEL) { | 197 if (surface->flags & SDL_RLEACCEL) { |
198 SDL_UnRLESurface (surface, 1); | 198 SDL_UnRLESurface(surface, 1); |
199 } | 199 } |
200 | 200 |
201 if (flag) { | 201 if (flag) { |
202 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 202 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
203 | 203 |
204 surface->flags |= SDL_SRCCOLORKEY; | 204 surface->flags |= SDL_SRCCOLORKEY; |
205 surface->format->colorkey = key; | 205 surface->format->colorkey = key; |
206 if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL) { | 206 if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL) { |
207 if ((_this->SetHWColorKey == NULL) || | 207 if ((_this->SetHWColorKey == NULL) || |
208 (_this->SetHWColorKey (_this, surface, key) < 0)) { | 208 (_this->SetHWColorKey(_this, surface, key) < 0)) { |
209 surface->flags &= ~SDL_HWACCEL; | 209 surface->flags &= ~SDL_HWACCEL; |
210 } | 210 } |
211 } | 211 } |
212 if (flag & SDL_RLEACCELOK) { | 212 if (flag & SDL_RLEACCELOK) { |
213 surface->flags |= SDL_RLEACCELOK; | 213 surface->flags |= SDL_RLEACCELOK; |
216 } | 216 } |
217 } else { | 217 } else { |
218 surface->flags &= ~(SDL_SRCCOLORKEY | SDL_RLEACCELOK); | 218 surface->flags &= ~(SDL_SRCCOLORKEY | SDL_RLEACCELOK); |
219 surface->format->colorkey = 0; | 219 surface->format->colorkey = 0; |
220 } | 220 } |
221 SDL_InvalidateMap (surface->map); | 221 SDL_InvalidateMap(surface->map); |
222 return (0); | 222 return (0); |
223 } | 223 } |
224 | 224 |
225 /* This function sets the alpha channel of a surface */ | 225 /* This function sets the alpha channel of a surface */ |
226 int | 226 int |
227 SDL_SetAlpha (SDL_Surface * surface, Uint32 flag, Uint8 value) | 227 SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value) |
228 { | 228 { |
229 Uint32 oldflags = surface->flags; | 229 Uint32 oldflags = surface->flags; |
230 Uint32 oldalpha = surface->format->alpha; | 230 Uint32 oldalpha = surface->format->alpha; |
231 | 231 |
232 /* Sanity check the flag as it gets passed in */ | 232 /* Sanity check the flag as it gets passed in */ |
245 (!flag || value == oldalpha)) { | 245 (!flag || value == oldalpha)) { |
246 return (0); | 246 return (0); |
247 } | 247 } |
248 | 248 |
249 if (!(flag & SDL_RLEACCELOK) && (surface->flags & SDL_RLEACCEL)) | 249 if (!(flag & SDL_RLEACCELOK) && (surface->flags & SDL_RLEACCEL)) |
250 SDL_UnRLESurface (surface, 1); | 250 SDL_UnRLESurface(surface, 1); |
251 | 251 |
252 if (flag) { | 252 if (flag) { |
253 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 253 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
254 | 254 |
255 surface->flags |= SDL_SRCALPHA; | 255 surface->flags |= SDL_SRCALPHA; |
256 surface->format->alpha = value; | 256 surface->format->alpha = value; |
257 if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL) { | 257 if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL) { |
258 if ((_this->SetHWAlpha == NULL) || | 258 if ((_this->SetHWAlpha == NULL) || |
259 (_this->SetHWAlpha (_this, surface, value) < 0)) { | 259 (_this->SetHWAlpha(_this, surface, value) < 0)) { |
260 surface->flags &= ~SDL_HWACCEL; | 260 surface->flags &= ~SDL_HWACCEL; |
261 } | 261 } |
262 } | 262 } |
263 if (flag & SDL_RLEACCELOK) { | 263 if (flag & SDL_RLEACCELOK) { |
264 surface->flags |= SDL_RLEACCELOK; | 264 surface->flags |= SDL_RLEACCELOK; |
276 * need to invalidate.) | 276 * need to invalidate.) |
277 */ | 277 */ |
278 if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL | 278 if ((surface->flags & SDL_HWACCEL) == SDL_HWACCEL |
279 || oldflags != surface->flags | 279 || oldflags != surface->flags |
280 || (((oldalpha + 1) ^ (value + 1)) & 0x100)) | 280 || (((oldalpha + 1) ^ (value + 1)) & 0x100)) |
281 SDL_InvalidateMap (surface->map); | 281 SDL_InvalidateMap(surface->map); |
282 return (0); | 282 return (0); |
283 } | 283 } |
284 | 284 |
285 int | 285 int |
286 SDL_SetAlphaChannel (SDL_Surface * surface, Uint8 value) | 286 SDL_SetAlphaChannel(SDL_Surface * surface, Uint8 value) |
287 { | 287 { |
288 int row, col; | 288 int row, col; |
289 int offset; | 289 int offset; |
290 Uint8 *buf; | 290 Uint8 *buf; |
291 | 291 |
292 if ((surface->format->Amask != 0xFF000000) && | 292 if ((surface->format->Amask != 0xFF000000) && |
293 (surface->format->Amask != 0x000000FF)) { | 293 (surface->format->Amask != 0x000000FF)) { |
294 SDL_SetError ("Unsupported surface alpha mask format"); | 294 SDL_SetError("Unsupported surface alpha mask format"); |
295 return -1; | 295 return -1; |
296 } | 296 } |
297 #if SDL_BYTEORDER == SDL_LIL_ENDIAN | 297 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
298 if (surface->format->Amask == 0xFF000000) { | 298 if (surface->format->Amask == 0xFF000000) { |
299 offset = 3; | 299 offset = 3; |
307 offset = 3; | 307 offset = 3; |
308 } | 308 } |
309 #endif /* Byte ordering */ | 309 #endif /* Byte ordering */ |
310 | 310 |
311 /* Quickly set the alpha channel of an RGBA or ARGB surface */ | 311 /* Quickly set the alpha channel of an RGBA or ARGB surface */ |
312 if (SDL_MUSTLOCK (surface)) { | 312 if (SDL_MUSTLOCK(surface)) { |
313 if (SDL_LockSurface (surface) < 0) { | 313 if (SDL_LockSurface(surface) < 0) { |
314 return -1; | 314 return -1; |
315 } | 315 } |
316 } | 316 } |
317 row = surface->h; | 317 row = surface->h; |
318 while (row--) { | 318 while (row--) { |
321 while (col--) { | 321 while (col--) { |
322 *buf = value; | 322 *buf = value; |
323 buf += 4; | 323 buf += 4; |
324 } | 324 } |
325 } | 325 } |
326 if (SDL_MUSTLOCK (surface)) { | 326 if (SDL_MUSTLOCK(surface)) { |
327 SDL_UnlockSurface (surface); | 327 SDL_UnlockSurface(surface); |
328 } | 328 } |
329 return 0; | 329 return 0; |
330 } | 330 } |
331 | 331 |
332 /* | 332 /* |
333 * A function to calculate the intersection of two rectangles: | 333 * A function to calculate the intersection of two rectangles: |
334 * return true if the rectangles intersect, false otherwise | 334 * return true if the rectangles intersect, false otherwise |
335 */ | 335 */ |
336 static __inline__ SDL_bool | 336 static __inline__ SDL_bool |
337 SDL_IntersectRect (const SDL_Rect * A, const SDL_Rect * B, | 337 SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, |
338 SDL_Rect * intersection) | 338 SDL_Rect * intersection) |
339 { | 339 { |
340 int Amin, Amax, Bmin, Bmax; | 340 int Amin, Amax, Bmin, Bmax; |
341 | 341 |
342 /* Horizontal intersection */ | 342 /* Horizontal intersection */ |
343 Amin = A->x; | 343 Amin = A->x; |
368 | 368 |
369 /* | 369 /* |
370 * Set the clipping rectangle for a blittable surface | 370 * Set the clipping rectangle for a blittable surface |
371 */ | 371 */ |
372 SDL_bool | 372 SDL_bool |
373 SDL_SetClipRect (SDL_Surface * surface, const SDL_Rect * rect) | 373 SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect) |
374 { | 374 { |
375 SDL_Rect full_rect; | 375 SDL_Rect full_rect; |
376 | 376 |
377 /* Don't do anything if there's no surface to act on */ | 377 /* Don't do anything if there's no surface to act on */ |
378 if (!surface) { | 378 if (!surface) { |
388 /* Set the clipping rectangle */ | 388 /* Set the clipping rectangle */ |
389 if (!rect) { | 389 if (!rect) { |
390 surface->clip_rect = full_rect; | 390 surface->clip_rect = full_rect; |
391 return 1; | 391 return 1; |
392 } | 392 } |
393 return SDL_IntersectRect (rect, &full_rect, &surface->clip_rect); | 393 return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect); |
394 } | 394 } |
395 | 395 |
396 void | 396 void |
397 SDL_GetClipRect (SDL_Surface * surface, SDL_Rect * rect) | 397 SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect) |
398 { | 398 { |
399 if (surface && rect) { | 399 if (surface && rect) { |
400 *rect = surface->clip_rect; | 400 *rect = surface->clip_rect; |
401 } | 401 } |
402 } | 402 } |
411 * library in the optimimum places. They are exported so that if | 411 * library in the optimimum places. They are exported so that if |
412 * you know exactly what you are doing, you can optimize your code | 412 * you know exactly what you are doing, you can optimize your code |
413 * by calling the one(s) you need. | 413 * by calling the one(s) you need. |
414 */ | 414 */ |
415 int | 415 int |
416 SDL_LowerBlit (SDL_Surface * src, SDL_Rect * srcrect, | 416 SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect, |
417 SDL_Surface * dst, SDL_Rect * dstrect) | 417 SDL_Surface * dst, SDL_Rect * dstrect) |
418 { | 418 { |
419 SDL_blit do_blit; | 419 SDL_blit do_blit; |
420 | 420 |
421 /* Check to make sure the blit mapping is valid */ | 421 /* Check to make sure the blit mapping is valid */ |
422 if ((src->map->dst != dst) || | 422 if ((src->map->dst != dst) || |
423 (src->map->dst->format_version != src->map->format_version)) { | 423 (src->map->dst->format_version != src->map->format_version)) { |
424 if (SDL_MapSurface (src, dst) < 0) { | 424 if (SDL_MapSurface(src, dst) < 0) { |
425 return (-1); | 425 return (-1); |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 /* Figure out which blitter to use */ | 429 /* Figure out which blitter to use */ |
430 if ((src->flags & SDL_HWACCEL) == SDL_HWACCEL) { | 430 if ((src->flags & SDL_HWACCEL) == SDL_HWACCEL) { |
431 do_blit = src->map->hw_blit; | 431 do_blit = src->map->hw_blit; |
432 } else { | 432 } else { |
433 do_blit = src->map->sw_blit; | 433 do_blit = src->map->sw_blit; |
434 } | 434 } |
435 return (do_blit (src, srcrect, dst, dstrect)); | 435 return (do_blit(src, srcrect, dst, dstrect)); |
436 } | 436 } |
437 | 437 |
438 | 438 |
439 int | 439 int |
440 SDL_UpperBlit (SDL_Surface * src, SDL_Rect * srcrect, | 440 SDL_UpperBlit(SDL_Surface * src, SDL_Rect * srcrect, |
441 SDL_Surface * dst, SDL_Rect * dstrect) | 441 SDL_Surface * dst, SDL_Rect * dstrect) |
442 { | 442 { |
443 SDL_Rect fulldst; | 443 SDL_Rect fulldst; |
444 int srcx, srcy, w, h; | 444 int srcx, srcy, w, h; |
445 | 445 |
446 /* Make sure the surfaces aren't locked */ | 446 /* Make sure the surfaces aren't locked */ |
447 if (!src || !dst) { | 447 if (!src || !dst) { |
448 SDL_SetError ("SDL_UpperBlit: passed a NULL surface"); | 448 SDL_SetError("SDL_UpperBlit: passed a NULL surface"); |
449 return (-1); | 449 return (-1); |
450 } | 450 } |
451 if (src->locked || dst->locked) { | 451 if (src->locked || dst->locked) { |
452 SDL_SetError ("Surfaces must not be locked during blit"); | 452 SDL_SetError("Surfaces must not be locked during blit"); |
453 return (-1); | 453 return (-1); |
454 } | 454 } |
455 | 455 |
456 /* If the destination rectangle is NULL, use the entire dest surface */ | 456 /* If the destination rectangle is NULL, use the entire dest surface */ |
457 if (dstrect == NULL) { | 457 if (dstrect == NULL) { |
521 SDL_Rect sr; | 521 SDL_Rect sr; |
522 sr.x = srcx; | 522 sr.x = srcx; |
523 sr.y = srcy; | 523 sr.y = srcy; |
524 sr.w = dstrect->w = w; | 524 sr.w = dstrect->w = w; |
525 sr.h = dstrect->h = h; | 525 sr.h = dstrect->h = h; |
526 return SDL_LowerBlit (src, &sr, dst, dstrect); | 526 return SDL_LowerBlit(src, &sr, dst, dstrect); |
527 } | 527 } |
528 dstrect->w = dstrect->h = 0; | 528 dstrect->w = dstrect->h = 0; |
529 return 0; | 529 return 0; |
530 } | 530 } |
531 | 531 |
532 static int | 532 static int |
533 SDL_FillRect1 (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) | 533 SDL_FillRect1(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) |
534 { | 534 { |
535 /* FIXME: We have to worry about packing order.. *sigh* */ | 535 /* FIXME: We have to worry about packing order.. *sigh* */ |
536 SDL_SetError ("1-bpp rect fill not yet implemented"); | 536 SDL_SetError("1-bpp rect fill not yet implemented"); |
537 return -1; | 537 return -1; |
538 } | 538 } |
539 | 539 |
540 static int | 540 static int |
541 SDL_FillRect4 (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) | 541 SDL_FillRect4(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) |
542 { | 542 { |
543 /* FIXME: We have to worry about packing order.. *sigh* */ | 543 /* FIXME: We have to worry about packing order.. *sigh* */ |
544 SDL_SetError ("4-bpp rect fill not yet implemented"); | 544 SDL_SetError("4-bpp rect fill not yet implemented"); |
545 return -1; | 545 return -1; |
546 } | 546 } |
547 | 547 |
548 /* | 548 /* |
549 * This function performs a fast fill of the given rectangle with 'color' | 549 * This function performs a fast fill of the given rectangle with 'color' |
550 */ | 550 */ |
551 int | 551 int |
552 SDL_FillRect (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) | 552 SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) |
553 { | 553 { |
554 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 554 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
555 int x, y; | 555 int x, y; |
556 Uint8 *row; | 556 Uint8 *row; |
557 | 557 |
558 /* This function doesn't work on surfaces < 8 bpp */ | 558 /* This function doesn't work on surfaces < 8 bpp */ |
559 if (dst->format->BitsPerPixel < 8) { | 559 if (dst->format->BitsPerPixel < 8) { |
560 switch (dst->format->BitsPerPixel) { | 560 switch (dst->format->BitsPerPixel) { |
561 case 1: | 561 case 1: |
562 return SDL_FillRect1 (dst, dstrect, color); | 562 return SDL_FillRect1(dst, dstrect, color); |
563 break; | 563 break; |
564 case 4: | 564 case 4: |
565 return SDL_FillRect4 (dst, dstrect, color); | 565 return SDL_FillRect4(dst, dstrect, color); |
566 break; | 566 break; |
567 default: | 567 default: |
568 SDL_SetError ("Fill rect on unsupported surface format"); | 568 SDL_SetError("Fill rect on unsupported surface format"); |
569 return (-1); | 569 return (-1); |
570 break; | 570 break; |
571 } | 571 } |
572 } | 572 } |
573 | 573 |
574 /* If 'dstrect' == NULL, then fill the whole surface */ | 574 /* If 'dstrect' == NULL, then fill the whole surface */ |
575 if (dstrect) { | 575 if (dstrect) { |
576 /* Perform clipping */ | 576 /* Perform clipping */ |
577 if (!SDL_IntersectRect (dstrect, &dst->clip_rect, dstrect)) { | 577 if (!SDL_IntersectRect(dstrect, &dst->clip_rect, dstrect)) { |
578 return (0); | 578 return (0); |
579 } | 579 } |
580 } else { | 580 } else { |
581 dstrect = &dst->clip_rect; | 581 dstrect = &dst->clip_rect; |
582 } | 582 } |
583 | 583 |
584 /* Check for hardware acceleration */ | 584 /* Check for hardware acceleration */ |
585 if (((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) && | 585 if (((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) && |
586 _this->info.blit_fill) { | 586 _this->info.blit_fill) { |
587 return (_this->FillHWRect (_this, dst, dstrect, color)); | 587 return (_this->FillHWRect(_this, dst, dstrect, color)); |
588 } | 588 } |
589 | 589 |
590 /* Perform software fill */ | 590 /* Perform software fill */ |
591 if (SDL_LockSurface (dst) != 0) { | 591 if (SDL_LockSurface(dst) != 0) { |
592 return (-1); | 592 return (-1); |
593 } | 593 } |
594 row = (Uint8 *) dst->pixels + dstrect->y * dst->pitch + | 594 row = (Uint8 *) dst->pixels + dstrect->y * dst->pitch + |
595 dstrect->x * dst->format->BytesPerPixel; | 595 dstrect->x * dst->format->BytesPerPixel; |
596 if (dst->format->palette || (color == 0)) { | 596 if (dst->format->palette || (color == 0)) { |
597 x = dstrect->w * dst->format->BytesPerPixel; | 597 x = dstrect->w * dst->format->BytesPerPixel; |
598 if (!color && !((uintptr_t) row & 3) && !(x & 3) | 598 if (!color && !((uintptr_t) row & 3) && !(x & 3) |
599 && !(dst->pitch & 3)) { | 599 && !(dst->pitch & 3)) { |
600 int n = x >> 2; | 600 int n = x >> 2; |
601 for (y = dstrect->h; y; --y) { | 601 for (y = dstrect->h; y; --y) { |
602 SDL_memset4 (row, 0, n); | 602 SDL_memset4(row, 0, n); |
603 row += dst->pitch; | 603 row += dst->pitch; |
604 } | 604 } |
605 } else { | 605 } else { |
606 #ifdef __powerpc__ | 606 #ifdef __powerpc__ |
607 /* | 607 /* |
615 /* | 615 /* |
616 * 64-bit stores are probably most | 616 * 64-bit stores are probably most |
617 * efficient to uncached video memory | 617 * efficient to uncached video memory |
618 */ | 618 */ |
619 double fill; | 619 double fill; |
620 SDL_memset (&fill, color, (sizeof fill)); | 620 SDL_memset(&fill, color, (sizeof fill)); |
621 for (y = dstrect->h; y; y--) { | 621 for (y = dstrect->h; y; y--) { |
622 Uint8 *d = row; | 622 Uint8 *d = row; |
623 unsigned n = x; | 623 unsigned n = x; |
624 unsigned nn; | 624 unsigned nn; |
625 Uint8 c = color; | 625 Uint8 c = color; |
626 double f = fill; | 626 double f = fill; |
627 while ((unsigned long) d & (sizeof (double) - 1)) { | 627 while ((unsigned long) d & (sizeof(double) - 1)) { |
628 *d++ = c; | 628 *d++ = c; |
629 n--; | 629 n--; |
630 } | 630 } |
631 nn = n / (sizeof (double) * 4); | 631 nn = n / (sizeof(double) * 4); |
632 while (nn) { | 632 while (nn) { |
633 ((double *) d)[0] = f; | 633 ((double *) d)[0] = f; |
634 ((double *) d)[1] = f; | 634 ((double *) d)[1] = f; |
635 ((double *) d)[2] = f; | 635 ((double *) d)[2] = f; |
636 ((double *) d)[3] = f; | 636 ((double *) d)[3] = f; |
637 d += 4 * sizeof (double); | 637 d += 4 * sizeof(double); |
638 nn--; | 638 nn--; |
639 } | 639 } |
640 n &= ~(sizeof (double) * 4 - 1); | 640 n &= ~(sizeof(double) * 4 - 1); |
641 nn = n / sizeof (double); | 641 nn = n / sizeof(double); |
642 while (nn) { | 642 while (nn) { |
643 *(double *) d = f; | 643 *(double *) d = f; |
644 d += sizeof (double); | 644 d += sizeof(double); |
645 nn--; | 645 nn--; |
646 } | 646 } |
647 n &= ~(sizeof (double) - 1); | 647 n &= ~(sizeof(double) - 1); |
648 while (n) { | 648 while (n) { |
649 *d++ = c; | 649 *d++ = c; |
650 n--; | 650 n--; |
651 } | 651 } |
652 row += dst->pitch; | 652 row += dst->pitch; |
666 } | 666 } |
667 } else | 667 } else |
668 #endif /* __powerpc__ */ | 668 #endif /* __powerpc__ */ |
669 { | 669 { |
670 for (y = dstrect->h; y; y--) { | 670 for (y = dstrect->h; y; y--) { |
671 SDL_memset (row, color, x); | 671 SDL_memset(row, color, x); |
672 row += dst->pitch; | 672 row += dst->pitch; |
673 } | 673 } |
674 } | 674 } |
675 } | 675 } |
676 } else { | 676 } else { |
684 if ((uintptr_t) pixels & 3) { | 684 if ((uintptr_t) pixels & 3) { |
685 *pixels++ = c; | 685 *pixels++ = c; |
686 n--; | 686 n--; |
687 } | 687 } |
688 if (n >> 1) | 688 if (n >> 1) |
689 SDL_memset4 (pixels, cc, n >> 1); | 689 SDL_memset4(pixels, cc, n >> 1); |
690 if (n & 1) | 690 if (n & 1) |
691 pixels[n - 1] = c; | 691 pixels[n - 1] = c; |
692 row += dst->pitch; | 692 row += dst->pitch; |
693 } | 693 } |
694 break; | 694 break; |
698 color <<= 8; | 698 color <<= 8; |
699 #endif | 699 #endif |
700 for (y = dstrect->h; y; --y) { | 700 for (y = dstrect->h; y; --y) { |
701 Uint8 *pixels = row; | 701 Uint8 *pixels = row; |
702 for (x = dstrect->w; x; --x) { | 702 for (x = dstrect->w; x; --x) { |
703 SDL_memcpy (pixels, &color, 3); | 703 SDL_memcpy(pixels, &color, 3); |
704 pixels += 3; | 704 pixels += 3; |
705 } | 705 } |
706 row += dst->pitch; | 706 row += dst->pitch; |
707 } | 707 } |
708 break; | 708 break; |
709 | 709 |
710 case 4: | 710 case 4: |
711 for (y = dstrect->h; y; --y) { | 711 for (y = dstrect->h; y; --y) { |
712 SDL_memset4 (row, color, dstrect->w); | 712 SDL_memset4(row, color, dstrect->w); |
713 row += dst->pitch; | 713 row += dst->pitch; |
714 } | 714 } |
715 break; | 715 break; |
716 } | 716 } |
717 } | 717 } |
718 SDL_UnlockSurface (dst); | 718 SDL_UnlockSurface(dst); |
719 | 719 |
720 /* We're done! */ | 720 /* We're done! */ |
721 return (0); | 721 return (0); |
722 } | 722 } |
723 | 723 |
724 /* | 724 /* |
725 * Lock a surface to directly access the pixels | 725 * Lock a surface to directly access the pixels |
726 */ | 726 */ |
727 int | 727 int |
728 SDL_LockSurface (SDL_Surface * surface) | 728 SDL_LockSurface(SDL_Surface * surface) |
729 { | 729 { |
730 if (!surface->locked) { | 730 if (!surface->locked) { |
731 /* Perform the lock */ | 731 /* Perform the lock */ |
732 if (surface->flags & SDL_HWSURFACE) { | 732 if (surface->flags & SDL_HWSURFACE) { |
733 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 733 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
734 if (_this->LockHWSurface (_this, surface) < 0) { | 734 if (_this->LockHWSurface(_this, surface) < 0) { |
735 return (-1); | 735 return (-1); |
736 } | 736 } |
737 } | 737 } |
738 if (surface->flags & SDL_RLEACCEL) { | 738 if (surface->flags & SDL_RLEACCEL) { |
739 SDL_UnRLESurface (surface, 1); | 739 SDL_UnRLESurface(surface, 1); |
740 surface->flags |= SDL_RLEACCEL; /* save accel'd state */ | 740 surface->flags |= SDL_RLEACCEL; /* save accel'd state */ |
741 } | 741 } |
742 /* This needs to be done here in case pixels changes value */ | 742 /* This needs to be done here in case pixels changes value */ |
743 surface->pixels = (Uint8 *) surface->pixels + surface->offset; | 743 surface->pixels = (Uint8 *) surface->pixels + surface->offset; |
744 } | 744 } |
752 | 752 |
753 /* | 753 /* |
754 * Unlock a previously locked surface | 754 * Unlock a previously locked surface |
755 */ | 755 */ |
756 void | 756 void |
757 SDL_UnlockSurface (SDL_Surface * surface) | 757 SDL_UnlockSurface(SDL_Surface * surface) |
758 { | 758 { |
759 /* Only perform an unlock if we are locked */ | 759 /* Only perform an unlock if we are locked */ |
760 if (!surface->locked || (--surface->locked > 0)) { | 760 if (!surface->locked || (--surface->locked > 0)) { |
761 return; | 761 return; |
762 } | 762 } |
764 /* Perform the unlock */ | 764 /* Perform the unlock */ |
765 surface->pixels = (Uint8 *) surface->pixels - surface->offset; | 765 surface->pixels = (Uint8 *) surface->pixels - surface->offset; |
766 | 766 |
767 /* Unlock hardware or accelerated surfaces */ | 767 /* Unlock hardware or accelerated surfaces */ |
768 if (surface->flags & SDL_HWSURFACE) { | 768 if (surface->flags & SDL_HWSURFACE) { |
769 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 769 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
770 _this->UnlockHWSurface (_this, surface); | 770 _this->UnlockHWSurface(_this, surface); |
771 } else { | 771 } else { |
772 /* Update RLE encoded surface with new data */ | 772 /* Update RLE encoded surface with new data */ |
773 if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { | 773 if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { |
774 surface->flags &= ~SDL_RLEACCEL; /* stop lying */ | 774 surface->flags &= ~SDL_RLEACCEL; /* stop lying */ |
775 SDL_RLESurface (surface); | 775 SDL_RLESurface(surface); |
776 } | 776 } |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 /* | 780 /* |
781 * Convert a surface into the specified pixel format. | 781 * Convert a surface into the specified pixel format. |
782 */ | 782 */ |
783 SDL_Surface * | 783 SDL_Surface * |
784 SDL_ConvertSurface (SDL_Surface * surface, | 784 SDL_ConvertSurface(SDL_Surface * surface, |
785 SDL_PixelFormat * format, Uint32 flags) | 785 SDL_PixelFormat * format, Uint32 flags) |
786 { | 786 { |
787 SDL_Surface *convert; | 787 SDL_Surface *convert; |
788 Uint32 colorkey = 0; | 788 Uint32 colorkey = 0; |
789 Uint8 alpha = 0; | 789 Uint8 alpha = 0; |
790 Uint32 surface_flags; | 790 Uint32 surface_flags; |
798 (format->palette->colors[i].g != 0) || | 798 (format->palette->colors[i].g != 0) || |
799 (format->palette->colors[i].b != 0)) | 799 (format->palette->colors[i].b != 0)) |
800 break; | 800 break; |
801 } | 801 } |
802 if (i == format->palette->ncolors) { | 802 if (i == format->palette->ncolors) { |
803 SDL_SetError ("Empty destination palette"); | 803 SDL_SetError("Empty destination palette"); |
804 return (NULL); | 804 return (NULL); |
805 } | 805 } |
806 } | 806 } |
807 | 807 |
808 /* Only create hw surfaces with alpha channel if hw alpha blits | 808 /* Only create hw surfaces with alpha channel if hw alpha blits |
809 are supported */ | 809 are supported */ |
810 if (format->Amask != 0 && (flags & SDL_HWSURFACE)) { | 810 if (format->Amask != 0 && (flags & SDL_HWSURFACE)) { |
811 const SDL_VideoInfo *vi = SDL_GetVideoInfo (); | 811 const SDL_VideoInfo *vi = SDL_GetVideoInfo(); |
812 if (!vi || !vi->blit_hw_A) | 812 if (!vi || !vi->blit_hw_A) |
813 flags &= ~SDL_HWSURFACE; | 813 flags &= ~SDL_HWSURFACE; |
814 } | 814 } |
815 | 815 |
816 /* Create a new surface with the desired format */ | 816 /* Create a new surface with the desired format */ |
817 convert = SDL_CreateRGBSurface (flags, | 817 convert = SDL_CreateRGBSurface(flags, |
818 surface->w, surface->h, | 818 surface->w, surface->h, |
819 format->BitsPerPixel, format->Rmask, | 819 format->BitsPerPixel, format->Rmask, |
820 format->Gmask, format->Bmask, | 820 format->Gmask, format->Bmask, |
821 format->Amask); | 821 format->Amask); |
822 if (convert == NULL) { | 822 if (convert == NULL) { |
823 return (NULL); | 823 return (NULL); |
824 } | 824 } |
825 | 825 |
826 /* Copy the palette if any */ | 826 /* Copy the palette if any */ |
827 if (format->palette && convert->format->palette) { | 827 if (format->palette && convert->format->palette) { |
828 SDL_memcpy (convert->format->palette->colors, | 828 SDL_memcpy(convert->format->palette->colors, |
829 format->palette->colors, | 829 format->palette->colors, |
830 format->palette->ncolors * sizeof (SDL_Color)); | 830 format->palette->ncolors * sizeof(SDL_Color)); |
831 convert->format->palette->ncolors = format->palette->ncolors; | 831 convert->format->palette->ncolors = format->palette->ncolors; |
832 } | 832 } |
833 | 833 |
834 /* Save the original surface color key and alpha */ | 834 /* Save the original surface color key and alpha */ |
835 surface_flags = surface->flags; | 835 surface_flags = surface->flags; |
837 /* Convert colourkeyed surfaces to RGBA if requested */ | 837 /* Convert colourkeyed surfaces to RGBA if requested */ |
838 if ((flags & SDL_SRCCOLORKEY) != SDL_SRCCOLORKEY && format->Amask) { | 838 if ((flags & SDL_SRCCOLORKEY) != SDL_SRCCOLORKEY && format->Amask) { |
839 surface_flags &= ~SDL_SRCCOLORKEY; | 839 surface_flags &= ~SDL_SRCCOLORKEY; |
840 } else { | 840 } else { |
841 colorkey = surface->format->colorkey; | 841 colorkey = surface->format->colorkey; |
842 SDL_SetColorKey (surface, 0, 0); | 842 SDL_SetColorKey(surface, 0, 0); |
843 } | 843 } |
844 } | 844 } |
845 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { | 845 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { |
846 /* Copy over the alpha channel to RGBA if requested */ | 846 /* Copy over the alpha channel to RGBA if requested */ |
847 if (format->Amask) { | 847 if (format->Amask) { |
848 surface->flags &= ~SDL_SRCALPHA; | 848 surface->flags &= ~SDL_SRCALPHA; |
849 } else { | 849 } else { |
850 alpha = surface->format->alpha; | 850 alpha = surface->format->alpha; |
851 SDL_SetAlpha (surface, 0, 0); | 851 SDL_SetAlpha(surface, 0, 0); |
852 } | 852 } |
853 } | 853 } |
854 | 854 |
855 /* Copy over the image data */ | 855 /* Copy over the image data */ |
856 bounds.x = 0; | 856 bounds.x = 0; |
857 bounds.y = 0; | 857 bounds.y = 0; |
858 bounds.w = surface->w; | 858 bounds.w = surface->w; |
859 bounds.h = surface->h; | 859 bounds.h = surface->h; |
860 SDL_LowerBlit (surface, &bounds, convert, &bounds); | 860 SDL_LowerBlit(surface, &bounds, convert, &bounds); |
861 | 861 |
862 /* Clean up the original surface, and update converted surface */ | 862 /* Clean up the original surface, and update converted surface */ |
863 if (convert != NULL) { | 863 if (convert != NULL) { |
864 SDL_SetClipRect (convert, &surface->clip_rect); | 864 SDL_SetClipRect(convert, &surface->clip_rect); |
865 } | 865 } |
866 if ((surface_flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) { | 866 if ((surface_flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) { |
867 Uint32 cflags = surface_flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK); | 867 Uint32 cflags = surface_flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK); |
868 if (convert != NULL) { | 868 if (convert != NULL) { |
869 Uint8 keyR, keyG, keyB; | 869 Uint8 keyR, keyG, keyB; |
870 | 870 |
871 SDL_GetRGB (colorkey, surface->format, &keyR, &keyG, &keyB); | 871 SDL_GetRGB(colorkey, surface->format, &keyR, &keyG, &keyB); |
872 SDL_SetColorKey (convert, cflags | (flags & SDL_RLEACCELOK), | 872 SDL_SetColorKey(convert, cflags | (flags & SDL_RLEACCELOK), |
873 SDL_MapRGB (convert->format, keyR, keyG, keyB)); | 873 SDL_MapRGB(convert->format, keyR, keyG, keyB)); |
874 } | 874 } |
875 SDL_SetColorKey (surface, cflags, colorkey); | 875 SDL_SetColorKey(surface, cflags, colorkey); |
876 } | 876 } |
877 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { | 877 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { |
878 Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK); | 878 Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK); |
879 if (convert != NULL) { | 879 if (convert != NULL) { |
880 SDL_SetAlpha (convert, aflags | (flags & SDL_RLEACCELOK), alpha); | 880 SDL_SetAlpha(convert, aflags | (flags & SDL_RLEACCELOK), alpha); |
881 } | 881 } |
882 if (format->Amask) { | 882 if (format->Amask) { |
883 surface->flags |= SDL_SRCALPHA; | 883 surface->flags |= SDL_SRCALPHA; |
884 } else { | 884 } else { |
885 SDL_SetAlpha (surface, aflags, alpha); | 885 SDL_SetAlpha(surface, aflags, alpha); |
886 } | 886 } |
887 } | 887 } |
888 | 888 |
889 /* We're ready to go! */ | 889 /* We're ready to go! */ |
890 return (convert); | 890 return (convert); |
892 | 892 |
893 /* | 893 /* |
894 * Free a surface created by the above function. | 894 * Free a surface created by the above function. |
895 */ | 895 */ |
896 void | 896 void |
897 SDL_FreeSurface (SDL_Surface * surface) | 897 SDL_FreeSurface(SDL_Surface * surface) |
898 { | 898 { |
899 if (surface == NULL) { | 899 if (surface == NULL) { |
900 return; | 900 return; |
901 } | 901 } |
902 if (--surface->refcount > 0) { | 902 if (--surface->refcount > 0) { |
903 return; | 903 return; |
904 } | 904 } |
905 while (surface->locked > 0) { | 905 while (surface->locked > 0) { |
906 SDL_UnlockSurface (surface); | 906 SDL_UnlockSurface(surface); |
907 } | 907 } |
908 if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { | 908 if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { |
909 SDL_UnRLESurface (surface, 0); | 909 SDL_UnRLESurface(surface, 0); |
910 } | 910 } |
911 if (surface->format) { | 911 if (surface->format) { |
912 SDL_FreeFormat (surface->format); | 912 SDL_FreeFormat(surface->format); |
913 surface->format = NULL; | 913 surface->format = NULL; |
914 } | 914 } |
915 if (surface->map != NULL) { | 915 if (surface->map != NULL) { |
916 SDL_FreeBlitMap (surface->map); | 916 SDL_FreeBlitMap(surface->map); |
917 surface->map = NULL; | 917 surface->map = NULL; |
918 } | 918 } |
919 if (surface->hwdata) { | 919 if (surface->hwdata) { |
920 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 920 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
921 _this->FreeHWSurface (_this, surface); | 921 _this->FreeHWSurface(_this, surface); |
922 } | 922 } |
923 if (surface->pixels && ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC)) { | 923 if (surface->pixels && ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC)) { |
924 SDL_free (surface->pixels); | 924 SDL_free(surface->pixels); |
925 } | 925 } |
926 SDL_free (surface); | 926 SDL_free(surface); |
927 #ifdef CHECK_LEAKS | 927 #ifdef CHECK_LEAKS |
928 --surfaces_allocated; | 928 --surfaces_allocated; |
929 #endif | 929 #endif |
930 } | 930 } |
931 | 931 |