comparison src/video/ps2gs/SDL_gsyuv.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
112 SDL_SetError("Unsupported YUV format"); 112 SDL_SetError("Unsupported YUV format");
113 return(NULL); 113 return(NULL);
114 } 114 }
115 115
116 /* Create the overlay structure */ 116 /* Create the overlay structure */
117 overlay = (SDL_Overlay *)malloc(sizeof *overlay); 117 overlay = (SDL_Overlay *)SDL_malloc(sizeof *overlay);
118 if ( overlay == NULL ) { 118 if ( overlay == NULL ) {
119 SDL_OutOfMemory(); 119 SDL_OutOfMemory();
120 return(NULL); 120 return(NULL);
121 } 121 }
122 memset(overlay, 0, (sizeof *overlay)); 122 SDL_memset(overlay, 0, (sizeof *overlay));
123 123
124 /* Fill in the basic members */ 124 /* Fill in the basic members */
125 overlay->format = format; 125 overlay->format = format;
126 overlay->w = width; 126 overlay->w = width;
127 overlay->h = height; 127 overlay->h = height;
129 /* Set up the YUV surface function structure */ 129 /* Set up the YUV surface function structure */
130 overlay->hwfuncs = &gs_yuvfuncs; 130 overlay->hwfuncs = &gs_yuvfuncs;
131 overlay->hw_overlay = 1; 131 overlay->hw_overlay = 1;
132 132
133 /* Create the pixel data */ 133 /* Create the pixel data */
134 hwdata = (struct private_yuvhwdata *)malloc(sizeof *hwdata); 134 hwdata = (struct private_yuvhwdata *)SDL_malloc(sizeof *hwdata);
135 overlay->hwdata = hwdata; 135 overlay->hwdata = hwdata;
136 if ( hwdata == NULL ) { 136 if ( hwdata == NULL ) {
137 SDL_FreeYUVOverlay(overlay); 137 SDL_FreeYUVOverlay(overlay);
138 SDL_OutOfMemory(); 138 SDL_OutOfMemory();
139 return(NULL); 139 return(NULL);
140 } 140 }
141 hwdata->ipu_fd = -1; 141 hwdata->ipu_fd = -1;
142 hwdata->pixels = (Uint8 *)malloc(width*height*2); 142 hwdata->pixels = (Uint8 *)SDL_malloc(width*height*2);
143 if ( hwdata->pixels == NULL ) { 143 if ( hwdata->pixels == NULL ) {
144 SDL_FreeYUVOverlay(overlay); 144 SDL_FreeYUVOverlay(overlay);
145 SDL_OutOfMemory(); 145 SDL_OutOfMemory();
146 return(NULL); 146 return(NULL);
147 } 147 }
200 hwdata->macroblocks * (16 * 16 + 8 * 8 + 8 * 8); 200 hwdata->macroblocks * (16 * 16 + 8 * 8 + 8 * 8);
201 hwdata->dma_tags = hwdata->ipu_omem + width * height * bpp; 201 hwdata->dma_tags = hwdata->ipu_omem + width * height * bpp;
202 202
203 /* Allocate memory for the DMA packets */ 203 /* Allocate memory for the DMA packets */
204 hwdata->plist.num = hwdata->macroblocks * 4 + 1; 204 hwdata->plist.num = hwdata->macroblocks * 4 + 1;
205 hwdata->plist.packet = (struct ps2_packet *)malloc( 205 hwdata->plist.packet = (struct ps2_packet *)SDL_malloc(
206 hwdata->plist.num*sizeof(struct ps2_packet)); 206 hwdata->plist.num*sizeof(struct ps2_packet));
207 if ( ! hwdata->plist.packet ) { 207 if ( ! hwdata->plist.packet ) {
208 SDL_FreeYUVOverlay(overlay); 208 SDL_FreeYUVOverlay(overlay);
209 SDL_OutOfMemory(); 209 SDL_OutOfMemory();
210 return(NULL); 210 return(NULL);
451 } 451 }
452 if ( hwdata->dma_mem ) { 452 if ( hwdata->dma_mem ) {
453 munmap(hwdata->dma_mem, hwdata->dma_len); 453 munmap(hwdata->dma_mem, hwdata->dma_len);
454 } 454 }
455 if ( hwdata->plist.packet ) { 455 if ( hwdata->plist.packet ) {
456 free(hwdata->plist.packet); 456 SDL_free(hwdata->plist.packet);
457 } 457 }
458 if ( hwdata->pixels ) { 458 if ( hwdata->pixels ) {
459 free(hwdata->pixels); 459 SDL_free(hwdata->pixels);
460 } 460 }
461 free(hwdata); 461 SDL_free(hwdata);
462 } 462 }
463 } 463 }