Mercurial > sdl-ios-xcode
comparison src/video/SDL_yuv_sw.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 |
---|---|
958 SDL_SetError("Unsupported YUV format"); | 958 SDL_SetError("Unsupported YUV format"); |
959 return(NULL); | 959 return(NULL); |
960 } | 960 } |
961 | 961 |
962 /* Create the overlay structure */ | 962 /* Create the overlay structure */ |
963 overlay = (SDL_Overlay *)malloc(sizeof *overlay); | 963 overlay = (SDL_Overlay *)SDL_malloc(sizeof *overlay); |
964 if ( overlay == NULL ) { | 964 if ( overlay == NULL ) { |
965 SDL_OutOfMemory(); | 965 SDL_OutOfMemory(); |
966 return(NULL); | 966 return(NULL); |
967 } | 967 } |
968 memset(overlay, 0, (sizeof *overlay)); | 968 SDL_memset(overlay, 0, (sizeof *overlay)); |
969 | 969 |
970 /* Fill in the basic members */ | 970 /* Fill in the basic members */ |
971 overlay->format = format; | 971 overlay->format = format; |
972 overlay->w = width; | 972 overlay->w = width; |
973 overlay->h = height; | 973 overlay->h = height; |
974 | 974 |
975 /* Set up the YUV surface function structure */ | 975 /* Set up the YUV surface function structure */ |
976 overlay->hwfuncs = &sw_yuvfuncs; | 976 overlay->hwfuncs = &sw_yuvfuncs; |
977 | 977 |
978 /* Create the pixel data and lookup tables */ | 978 /* Create the pixel data and lookup tables */ |
979 swdata = (struct private_yuvhwdata *)malloc(sizeof *swdata); | 979 swdata = (struct private_yuvhwdata *)SDL_malloc(sizeof *swdata); |
980 overlay->hwdata = swdata; | 980 overlay->hwdata = swdata; |
981 if ( swdata == NULL ) { | 981 if ( swdata == NULL ) { |
982 SDL_OutOfMemory(); | 982 SDL_OutOfMemory(); |
983 SDL_FreeYUVOverlay(overlay); | 983 SDL_FreeYUVOverlay(overlay); |
984 return(NULL); | 984 return(NULL); |
985 } | 985 } |
986 swdata->stretch = NULL; | 986 swdata->stretch = NULL; |
987 swdata->display = display; | 987 swdata->display = display; |
988 swdata->pixels = (Uint8 *) malloc(width*height*2); | 988 swdata->pixels = (Uint8 *) SDL_malloc(width*height*2); |
989 swdata->colortab = (int *)malloc(4*256*sizeof(int)); | 989 swdata->colortab = (int *)SDL_malloc(4*256*sizeof(int)); |
990 Cr_r_tab = &swdata->colortab[0*256]; | 990 Cr_r_tab = &swdata->colortab[0*256]; |
991 Cr_g_tab = &swdata->colortab[1*256]; | 991 Cr_g_tab = &swdata->colortab[1*256]; |
992 Cb_g_tab = &swdata->colortab[2*256]; | 992 Cb_g_tab = &swdata->colortab[2*256]; |
993 Cb_b_tab = &swdata->colortab[3*256]; | 993 Cb_b_tab = &swdata->colortab[3*256]; |
994 swdata->rgb_2_pix = (Uint32 *)malloc(3*768*sizeof(Uint32)); | 994 swdata->rgb_2_pix = (Uint32 *)SDL_malloc(3*768*sizeof(Uint32)); |
995 r_2_pix_alloc = &swdata->rgb_2_pix[0*768]; | 995 r_2_pix_alloc = &swdata->rgb_2_pix[0*768]; |
996 g_2_pix_alloc = &swdata->rgb_2_pix[1*768]; | 996 g_2_pix_alloc = &swdata->rgb_2_pix[1*768]; |
997 b_2_pix_alloc = &swdata->rgb_2_pix[2*768]; | 997 b_2_pix_alloc = &swdata->rgb_2_pix[2*768]; |
998 if ( ! swdata->pixels || ! swdata->colortab || ! swdata->rgb_2_pix ) { | 998 if ( ! swdata->pixels || ! swdata->colortab || ! swdata->rgb_2_pix ) { |
999 SDL_OutOfMemory(); | 999 SDL_OutOfMemory(); |
1277 if ( swdata ) { | 1277 if ( swdata ) { |
1278 if ( swdata->stretch ) { | 1278 if ( swdata->stretch ) { |
1279 SDL_FreeSurface(swdata->stretch); | 1279 SDL_FreeSurface(swdata->stretch); |
1280 } | 1280 } |
1281 if ( swdata->pixels ) { | 1281 if ( swdata->pixels ) { |
1282 free(swdata->pixels); | 1282 SDL_free(swdata->pixels); |
1283 } | 1283 } |
1284 if ( swdata->colortab ) { | 1284 if ( swdata->colortab ) { |
1285 free(swdata->colortab); | 1285 SDL_free(swdata->colortab); |
1286 } | 1286 } |
1287 if ( swdata->rgb_2_pix ) { | 1287 if ( swdata->rgb_2_pix ) { |
1288 free(swdata->rgb_2_pix); | 1288 SDL_free(swdata->rgb_2_pix); |
1289 } | 1289 } |
1290 free(swdata); | 1290 SDL_free(swdata); |
1291 } | 1291 } |
1292 } | 1292 } |