Mercurial > sdl-ios-xcode
comparison src/video/photon/SDL_ph_image.c @ 1336:3692456e7b0f
Use SDL_ prefixed versions of C library functions.
FIXME:
Change #include <stdlib.h> to #include "SDL_stdlib.h"
Change #include <string.h> to #include "SDL_string.h"
Make sure nothing else broke because of this...
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 07 Feb 2006 06:59:48 +0000 |
parents | c9b51268668f |
children | 604d73db6802 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
75 | 75 |
76 /* palette emulation code */ | 76 /* palette emulation code */ |
77 if ((bpp==8) && (desktoppal==SDLPH_PAL_EMULATE)) | 77 if ((bpp==8) && (desktoppal==SDLPH_PAL_EMULATE)) |
78 { | 78 { |
79 /* creating image palette */ | 79 /* creating image palette */ |
80 palette=malloc(_Pg_MAX_PALETTE*sizeof(PgColor_t)); | 80 palette=SDL_malloc(_Pg_MAX_PALETTE*sizeof(PgColor_t)); |
81 if (palette==NULL) | 81 if (palette==NULL) |
82 { | 82 { |
83 SDL_SetError("ph_SetupImage(): can't allocate memory for palette !\n"); | 83 SDL_SetError("ph_SetupImage(): can't allocate memory for palette !\n"); |
84 return -1; | 84 return -1; |
85 } | 85 } |
87 | 87 |
88 /* using shared memory for speed (set last param to 1) */ | 88 /* using shared memory for speed (set last param to 1) */ |
89 if ((SDL_Image = PhCreateImage(NULL, screen->w, screen->h, type, palette, _Pg_MAX_PALETTE, 1)) == NULL) | 89 if ((SDL_Image = PhCreateImage(NULL, screen->w, screen->h, type, palette, _Pg_MAX_PALETTE, 1)) == NULL) |
90 { | 90 { |
91 SDL_SetError("ph_SetupImage(): PhCreateImage() failed for bpp=8 !\n"); | 91 SDL_SetError("ph_SetupImage(): PhCreateImage() failed for bpp=8 !\n"); |
92 free(palette); | 92 SDL_free(palette); |
93 return -1; | 93 return -1; |
94 } | 94 } |
95 } | 95 } |
96 else | 96 else |
97 { | 97 { |
252 { | 252 { |
253 int i; | 253 int i; |
254 | 254 |
255 for (i=0; i<40; i++) | 255 for (i=0; i<40; i++) |
256 { | 256 { |
257 memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); | 257 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
258 } | 258 } |
259 for (i=440; i<480; i++) | 259 for (i=440; i<480; i++) |
260 { | 260 { |
261 memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); | 261 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
262 } | 262 } |
263 screen->pixels+=screen->pitch*40; | 263 screen->pixels+=screen->pitch*40; |
264 } | 264 } |
265 PgSwapDisplay(OCImage.offscreen_backcontext, 0); | 265 PgSwapDisplay(OCImage.offscreen_backcontext, 0); |
266 } | 266 } |
276 { | 276 { |
277 int i; | 277 int i; |
278 | 278 |
279 for (i=0; i<40; i++) | 279 for (i=0; i<40; i++) |
280 { | 280 { |
281 memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); | 281 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
282 } | 282 } |
283 for (i=440; i<480; i++) | 283 for (i=440; i<480; i++) |
284 { | 284 { |
285 memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); | 285 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
286 } | 286 } |
287 screen->pixels+=screen->pitch*40; | 287 screen->pixels+=screen->pitch*40; |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
389 if (SDL_Image) | 389 if (SDL_Image) |
390 { | 390 { |
391 /* if palette allocated, free it */ | 391 /* if palette allocated, free it */ |
392 if (SDL_Image->palette) | 392 if (SDL_Image->palette) |
393 { | 393 { |
394 free(SDL_Image->palette); | 394 SDL_free(SDL_Image->palette); |
395 } | 395 } |
396 PgShmemDestroy(SDL_Image->image); | 396 PgShmemDestroy(SDL_Image->image); |
397 free(SDL_Image); | 397 SDL_free(SDL_Image); |
398 } | 398 } |
399 | 399 |
400 /* Must be zeroed everytime */ | 400 /* Must be zeroed everytime */ |
401 SDL_Image = NULL; | 401 SDL_Image = NULL; |
402 | 402 |
529 if (surface->hwdata!=NULL) | 529 if (surface->hwdata!=NULL) |
530 { | 530 { |
531 SDL_SetError("ph_AllocHWSurface(): hwdata already exists!\n"); | 531 SDL_SetError("ph_AllocHWSurface(): hwdata already exists!\n"); |
532 return -1; | 532 return -1; |
533 } | 533 } |
534 surface->hwdata=malloc(sizeof(struct private_hwdata)); | 534 surface->hwdata=SDL_malloc(sizeof(struct private_hwdata)); |
535 memset(surface->hwdata, 0x00, sizeof(struct private_hwdata)); | 535 SDL_memset(surface->hwdata, 0x00, sizeof(struct private_hwdata)); |
536 surface->hwdata->offscreenctx=PdCreateOffscreenContext(0, surface->w, surface->h, Pg_OSC_MEM_PAGE_ALIGN); | 536 surface->hwdata->offscreenctx=PdCreateOffscreenContext(0, surface->w, surface->h, Pg_OSC_MEM_PAGE_ALIGN); |
537 if (surface->hwdata->offscreenctx == NULL) | 537 if (surface->hwdata->offscreenctx == NULL) |
538 { | 538 { |
539 SDL_SetError("ph_AllocHWSurface(): PdCreateOffscreenContext() function failed !\n"); | 539 SDL_SetError("ph_AllocHWSurface(): PdCreateOffscreenContext() function failed !\n"); |
540 return -1; | 540 return -1; |
599 PdDestroyOffscreenLock(surface->hwdata->offscreenctx); | 599 PdDestroyOffscreenLock(surface->hwdata->offscreenctx); |
600 #endif /* 0 */ | 600 #endif /* 0 */ |
601 | 601 |
602 PhDCRelease(surface->hwdata->offscreenctx); | 602 PhDCRelease(surface->hwdata->offscreenctx); |
603 | 603 |
604 free(surface->hwdata); | 604 SDL_free(surface->hwdata); |
605 surface->hwdata=NULL; | 605 surface->hwdata=NULL; |
606 | 606 |
607 /* Update video ram amount */ | 607 /* Update video ram amount */ |
608 if (PgGetGraphicsHWCaps(&hwcaps) < 0) | 608 if (PgGetGraphicsHWCaps(&hwcaps) < 0) |
609 { | 609 { |