comparison src/video/gem/SDL_gemvideo.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
123 return 1; 123 return 1;
124 } 124 }
125 125
126 static void GEM_DeleteDevice(SDL_VideoDevice *device) 126 static void GEM_DeleteDevice(SDL_VideoDevice *device)
127 { 127 {
128 free(device->hidden); 128 SDL_free(device->hidden);
129 free(device); 129 SDL_free(device);
130 } 130 }
131 131
132 static SDL_VideoDevice *GEM_CreateDevice(int devindex) 132 static SDL_VideoDevice *GEM_CreateDevice(int devindex)
133 { 133 {
134 SDL_VideoDevice *device; 134 SDL_VideoDevice *device;
135 int vectors_mask; 135 int vectors_mask;
136 unsigned long dummy; 136 unsigned long dummy;
137 137
138 /* Initialize all variables that we clean on shutdown */ 138 /* Initialize all variables that we clean on shutdown */
139 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 139 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
140 if ( device ) { 140 if ( device ) {
141 memset(device, 0, (sizeof *device)); 141 SDL_memset(device, 0, (sizeof *device));
142 device->hidden = (struct SDL_PrivateVideoData *) 142 device->hidden = (struct SDL_PrivateVideoData *)
143 malloc((sizeof *device->hidden)); 143 SDL_malloc((sizeof *device->hidden));
144 device->gl_data = (struct SDL_PrivateGLData *) 144 device->gl_data = (struct SDL_PrivateGLData *)
145 malloc((sizeof *device->gl_data)); 145 SDL_malloc((sizeof *device->gl_data));
146 } 146 }
147 if ( (device == NULL) || (device->hidden == NULL) ) { 147 if ( (device == NULL) || (device->hidden == NULL) ) {
148 SDL_OutOfMemory(); 148 SDL_OutOfMemory();
149 if ( device ) { 149 if ( device ) {
150 free(device); 150 SDL_free(device);
151 } 151 }
152 return(0); 152 return(0);
153 } 153 }
154 memset(device->hidden, 0, (sizeof *device->hidden)); 154 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
155 memset(device->gl_data, 0, sizeof(*device->gl_data)); 155 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
156 156
157 /* Set the function pointers */ 157 /* Set the function pointers */
158 device->VideoInit = GEM_VideoInit; 158 device->VideoInit = GEM_VideoInit;
159 device->ListModes = GEM_ListModes; 159 device->ListModes = GEM_ListModes;
160 device->SetVideoMode = GEM_SetVideoMode; 160 device->SetVideoMode = GEM_SetVideoMode;
398 VDI_oldpalette[i][0] = rgb[0]; 398 VDI_oldpalette[i][0] = rgb[0];
399 VDI_oldpalette[i][1] = rgb[1]; 399 VDI_oldpalette[i][1] = rgb[1];
400 VDI_oldpalette[i][2] = rgb[2]; 400 VDI_oldpalette[i][2] = rgb[2];
401 } 401 }
402 VDI_setpalette = GEM_SetNewPalette; 402 VDI_setpalette = GEM_SetNewPalette;
403 memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette)); 403 SDL_memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette));
404 404
405 /* Setup screen info */ 405 /* Setup screen info */
406 GEM_title_name = empty_name; 406 GEM_title_name = empty_name;
407 GEM_icon_name = empty_name; 407 GEM_icon_name = empty_name;
408 408
451 /* Menu bar save buffer */ 451 /* Menu bar save buffer */
452 menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize; 452 menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize;
453 GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM); 453 GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM);
454 454
455 /* Fill video modes list */ 455 /* Fill video modes list */
456 SDL_modelist[0] = malloc(sizeof(SDL_Rect)); 456 SDL_modelist[0] = SDL_malloc(sizeof(SDL_Rect));
457 SDL_modelist[0]->x = 0; 457 SDL_modelist[0]->x = 0;
458 SDL_modelist[0]->y = 0; 458 SDL_modelist[0]->y = 0;
459 SDL_modelist[0]->w = VDI_w; 459 SDL_modelist[0]->w = VDI_w;
460 SDL_modelist[0]->h = VDI_h; 460 SDL_modelist[0]->h = VDI_h;
461 461
677 GEM_buffer1 = Atari_SysMalloc(screensize, MX_PREFTTRAM); 677 GEM_buffer1 = Atari_SysMalloc(screensize, MX_PREFTTRAM);
678 if (GEM_buffer1==NULL) { 678 if (GEM_buffer1==NULL) {
679 SDL_SetError("Can not allocate %d KB for frame buffer", screensize>>10); 679 SDL_SetError("Can not allocate %d KB for frame buffer", screensize>>10);
680 return NULL; 680 return NULL;
681 } 681 }
682 memset(GEM_buffer1, 0, screensize); 682 SDL_memset(GEM_buffer1, 0, screensize);
683 #ifdef DEBUG_VIDEO_GEM 683 #ifdef DEBUG_VIDEO_GEM
684 printf("sdl:video:gem: setvideomode(): allocated buffer 1\n"); 684 printf("sdl:video:gem: setvideomode(): allocated buffer 1\n");
685 #endif 685 #endif
686 } 686 }
687 687
689 GEM_buffer2 = Atari_SysMalloc(screensize, MX_PREFTTRAM); 689 GEM_buffer2 = Atari_SysMalloc(screensize, MX_PREFTTRAM);
690 if (GEM_buffer2==NULL) { 690 if (GEM_buffer2==NULL) {
691 SDL_SetError("Can not allocate %d KB for shadow buffer", screensize>>10); 691 SDL_SetError("Can not allocate %d KB for shadow buffer", screensize>>10);
692 return NULL; 692 return NULL;
693 } 693 }
694 memset(GEM_buffer2, 0, screensize); 694 SDL_memset(GEM_buffer2, 0, screensize);
695 #ifdef DEBUG_VIDEO_GEM 695 #ifdef DEBUG_VIDEO_GEM
696 printf("sdl:video:gem: setvideomode(): allocated buffer 2\n"); 696 printf("sdl:video:gem: setvideomode(): allocated buffer 2\n");
697 #endif 697 #endif
698 } 698 }
699 699
1130 v_clsvwk(VDI_handle); 1130 v_clsvwk(VDI_handle);
1131 } 1131 }
1132 1132
1133 /* Free mode list */ 1133 /* Free mode list */
1134 if (SDL_modelist[0]) { 1134 if (SDL_modelist[0]) {
1135 free(SDL_modelist[0]); 1135 SDL_free(SDL_modelist[0]);
1136 SDL_modelist[0]=NULL; 1136 SDL_modelist[0]=NULL;
1137 } 1137 }
1138 1138
1139 this->screen->pixels = NULL; 1139 this->screen->pixels = NULL;
1140 } 1140 }