comparison src/video/windx5/SDL_dx5yuv.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 450721ad5436
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
55 LPDIRECTDRAWSURFACE dd_surface1; 55 LPDIRECTDRAWSURFACE dd_surface1;
56 LPDIRECTDRAWSURFACE3 dd_surface3; 56 LPDIRECTDRAWSURFACE3 dd_surface3;
57 DDSURFACEDESC ddsd; 57 DDSURFACEDESC ddsd;
58 58
59 /* Set up the surface description */ 59 /* Set up the surface description */
60 memset(&ddsd, 0, sizeof(ddsd)); 60 SDL_memset(&ddsd, 0, sizeof(ddsd));
61 ddsd.dwSize = sizeof(ddsd); 61 ddsd.dwSize = sizeof(ddsd);
62 ddsd.dwFlags = (DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS|DDSD_PIXELFORMAT); 62 ddsd.dwFlags = (DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS|DDSD_PIXELFORMAT);
63 ddsd.dwWidth = width; 63 ddsd.dwWidth = width;
64 ddsd.dwHeight= height; 64 ddsd.dwHeight= height;
65 #ifdef USE_DIRECTX_OVERLAY 65 #ifdef USE_DIRECTX_OVERLAY
84 SetDDerror("DirectDrawSurface::QueryInterface", result); 84 SetDDerror("DirectDrawSurface::QueryInterface", result);
85 return(NULL); 85 return(NULL);
86 } 86 }
87 87
88 /* Make sure the surface format was set properly */ 88 /* Make sure the surface format was set properly */
89 memset(&ddsd, 0, sizeof(ddsd)); 89 SDL_memset(&ddsd, 0, sizeof(ddsd));
90 ddsd.dwSize = sizeof(ddsd); 90 ddsd.dwSize = sizeof(ddsd);
91 result = IDirectDrawSurface3_Lock(dd_surface3, NULL, 91 result = IDirectDrawSurface3_Lock(dd_surface3, NULL,
92 &ddsd, DDLOCK_NOSYSLOCK, NULL); 92 &ddsd, DDLOCK_NOSYSLOCK, NULL);
93 if ( result != DD_OK ) { 93 if ( result != DD_OK ) {
94 SetDDerror("DirectDrawSurface3::Lock", result); 94 SetDDerror("DirectDrawSurface3::Lock", result);
132 132
133 printf("FOURCC format requested: 0x%x\n", PrintFOURCC(format)); 133 printf("FOURCC format requested: 0x%x\n", PrintFOURCC(format));
134 IDirectDraw2_GetFourCCCodes(ddraw2, &numcodes, NULL); 134 IDirectDraw2_GetFourCCCodes(ddraw2, &numcodes, NULL);
135 if ( numcodes ) { 135 if ( numcodes ) {
136 DWORD i; 136 DWORD i;
137 codes = malloc(numcodes*sizeof(*codes)); 137 codes = SDL_malloc(numcodes*sizeof(*codes));
138 if ( codes ) { 138 if ( codes ) {
139 IDirectDraw2_GetFourCCCodes(ddraw2, &numcodes, codes); 139 IDirectDraw2_GetFourCCCodes(ddraw2, &numcodes, codes);
140 for ( i=0; i<numcodes; ++i ) { 140 for ( i=0; i<numcodes; ++i ) {
141 fprintf(stderr, "Code %d: 0x%x\n", i, PrintFOURCC(codes[i])); 141 fprintf(stderr, "Code %d: 0x%x\n", i, PrintFOURCC(codes[i]));
142 } 142 }
143 free(codes); 143 SDL_free(codes);
144 } 144 }
145 } else { 145 } else {
146 fprintf(stderr, "No FOURCC codes supported\n"); 146 fprintf(stderr, "No FOURCC codes supported\n");
147 } 147 }
148 #endif 148 #endif
149 149
150 /* Create the overlay structure */ 150 /* Create the overlay structure */
151 overlay = (SDL_Overlay *)malloc(sizeof *overlay); 151 overlay = (SDL_Overlay *)SDL_malloc(sizeof *overlay);
152 if ( overlay == NULL ) { 152 if ( overlay == NULL ) {
153 SDL_OutOfMemory(); 153 SDL_OutOfMemory();
154 return(NULL); 154 return(NULL);
155 } 155 }
156 memset(overlay, 0, (sizeof *overlay)); 156 SDL_memset(overlay, 0, (sizeof *overlay));
157 157
158 /* Fill in the basic members */ 158 /* Fill in the basic members */
159 overlay->format = format; 159 overlay->format = format;
160 overlay->w = width; 160 overlay->w = width;
161 overlay->h = height; 161 overlay->h = height;
162 162
163 /* Set up the YUV surface function structure */ 163 /* Set up the YUV surface function structure */
164 overlay->hwfuncs = &dx5_yuvfuncs; 164 overlay->hwfuncs = &dx5_yuvfuncs;
165 165
166 /* Create the pixel data and lookup tables */ 166 /* Create the pixel data and lookup tables */
167 hwdata = (struct private_yuvhwdata *)malloc(sizeof *hwdata); 167 hwdata = (struct private_yuvhwdata *)SDL_malloc(sizeof *hwdata);
168 overlay->hwdata = hwdata; 168 overlay->hwdata = hwdata;
169 if ( hwdata == NULL ) { 169 if ( hwdata == NULL ) {
170 SDL_OutOfMemory(); 170 SDL_OutOfMemory();
171 SDL_FreeYUVOverlay(overlay); 171 SDL_FreeYUVOverlay(overlay);
172 return(NULL); 172 return(NULL);
200 HRESULT result; 200 HRESULT result;
201 LPDIRECTDRAWSURFACE3 surface; 201 LPDIRECTDRAWSURFACE3 surface;
202 DDSURFACEDESC ddsd; 202 DDSURFACEDESC ddsd;
203 203
204 surface = overlay->hwdata->surface; 204 surface = overlay->hwdata->surface;
205 memset(&ddsd, 0, sizeof(ddsd)); 205 SDL_memset(&ddsd, 0, sizeof(ddsd));
206 ddsd.dwSize = sizeof(ddsd); 206 ddsd.dwSize = sizeof(ddsd);
207 result = IDirectDrawSurface3_Lock(surface, NULL, 207 result = IDirectDrawSurface3_Lock(surface, NULL,
208 &ddsd, DDLOCK_NOSYSLOCK, NULL); 208 &ddsd, DDLOCK_NOSYSLOCK, NULL);
209 if ( result == DDERR_SURFACELOST ) { 209 if ( result == DDERR_SURFACELOST ) {
210 result = IDirectDrawSurface3_Restore(surface); 210 result = IDirectDrawSurface3_Restore(surface);
289 hwdata = overlay->hwdata; 289 hwdata = overlay->hwdata;
290 if ( hwdata ) { 290 if ( hwdata ) {
291 if ( hwdata->surface ) { 291 if ( hwdata->surface ) {
292 IDirectDrawSurface_Release(hwdata->surface); 292 IDirectDrawSurface_Release(hwdata->surface);
293 } 293 }
294 free(hwdata); 294 SDL_free(hwdata);
295 } 295 }
296 } 296 }
297 297