comparison src/video/cybergfx/SDL_cgxvideo.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
147 147
148 148
149 this->hidden->SB[0]=this->hidden->SB[1]=NULL; 149 this->hidden->SB[0]=this->hidden->SB[1]=NULL;
150 150
151 if(SDL_RastPort && SDL_RastPort != &SDL_Display->RastPort) 151 if(SDL_RastPort && SDL_RastPort != &SDL_Display->RastPort)
152 free(SDL_RastPort); 152 SDL_free(SDL_RastPort);
153 153
154 SDL_RastPort=NULL; 154 SDL_RastPort=NULL;
155 } 155 }
156 CloseScreen(GFX_Display); 156 CloseScreen(GFX_Display);
157 currently_fullscreen=0; 157 currently_fullscreen=0;
179 179
180 static void CGX_DeleteDevice(SDL_VideoDevice *device) 180 static void CGX_DeleteDevice(SDL_VideoDevice *device)
181 { 181 {
182 if ( device ) { 182 if ( device ) {
183 if ( device->hidden ) { 183 if ( device->hidden ) {
184 free(device->hidden); 184 SDL_free(device->hidden);
185 } 185 }
186 if ( device->gl_data ) { 186 if ( device->gl_data ) {
187 free(device->gl_data); 187 SDL_free(device->gl_data);
188 } 188 }
189 free(device); 189 SDL_free(device);
190 } 190 }
191 } 191 }
192 192
193 static SDL_VideoDevice *CGX_CreateDevice(int devindex) 193 static SDL_VideoDevice *CGX_CreateDevice(int devindex)
194 { 194 {
195 SDL_VideoDevice *device; 195 SDL_VideoDevice *device;
196 196
197 /* Initialize all variables that we clean on shutdown */ 197 /* Initialize all variables that we clean on shutdown */
198 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 198 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
199 if ( device ) { 199 if ( device ) {
200 memset(device, 0, (sizeof *device)); 200 SDL_memset(device, 0, (sizeof *device));
201 device->hidden = (struct SDL_PrivateVideoData *) 201 device->hidden = (struct SDL_PrivateVideoData *)
202 malloc((sizeof *device->hidden)); 202 SDL_malloc((sizeof *device->hidden));
203 device->gl_data = (struct SDL_PrivateGLData *) 203 device->gl_data = (struct SDL_PrivateGLData *)
204 malloc((sizeof *device->gl_data)); 204 SDL_malloc((sizeof *device->gl_data));
205 } 205 }
206 if ( (device == NULL) || (device->hidden == NULL) || 206 if ( (device == NULL) || (device->hidden == NULL) ||
207 (device->gl_data == NULL) ) { 207 (device->gl_data == NULL) ) {
208 D(bug("Unable to create video device!\n")); 208 D(bug("Unable to create video device!\n"));
209 SDL_OutOfMemory(); 209 SDL_OutOfMemory();
210 CGX_DeleteDevice(device); 210 CGX_DeleteDevice(device);
211 return(0); 211 return(0);
212 } 212 }
213 memset(device->hidden, 0, sizeof(*device->hidden)); 213 SDL_memset(device->hidden, 0, sizeof(*device->hidden));
214 memset(device->gl_data, 0, sizeof(*device->gl_data)); 214 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
215 215
216 /* Set the driver flags */ 216 /* Set the driver flags */
217 device->handles_any_size = 1; 217 device->handles_any_size = 1;
218 218
219 /* Set the function pointers */ 219 /* Set the function pointers */
579 vformat->Bmask = MakeBitMask(this,2,form,&this->hidden->depth); 579 vformat->Bmask = MakeBitMask(this,2,form,&this->hidden->depth);
580 } 580 }
581 } 581 }
582 582
583 /* See if we have been passed a window to use */ 583 /* See if we have been passed a window to use */
584 /* SDL_windowid = getenv("SDL_WINDOWID"); */ 584 /* SDL_windowid = SDL_getenv("SDL_WINDOWID"); */
585 SDL_windowid=NULL; 585 SDL_windowid=NULL;
586 586
587 /* Create the blank cursor */ 587 /* Create the blank cursor */
588 SDL_BlankCursor = AllocMem(16,MEMF_CHIP|MEMF_CLEAR); 588 SDL_BlankCursor = AllocMem(16,MEMF_CHIP|MEMF_CLEAR);
589 589
647 if(SDL_XPixels[pixel]>=0) 647 if(SDL_XPixels[pixel]>=0)
648 ReleasePen(GFX_Display->ViewPort.ColorMap,SDL_XPixels[pixel]); 648 ReleasePen(GFX_Display->ViewPort.ColorMap,SDL_XPixels[pixel]);
649 } 649 }
650 } 650 }
651 } 651 }
652 free(SDL_XPixels); 652 SDL_free(SDL_XPixels);
653 SDL_XPixels = NULL; 653 SDL_XPixels = NULL;
654 } 654 }
655 } 655 }
656 } 656 }
657 657
662 } else { 662 } else {
663 WindowLimits(SDL_Window, w,h,w,h); 663 WindowLimits(SDL_Window, w,h,w,h);
664 } 664 }
665 if ( flags & SDL_FULLSCREEN ) { 665 if ( flags & SDL_FULLSCREEN ) {
666 flags&=~SDL_RESIZABLE; 666 flags&=~SDL_RESIZABLE;
667 } else if ( getenv("SDL_VIDEO_CENTERED") ) { 667 } else if ( SDL_getenv("SDL_VIDEO_CENTERED") ) {
668 int display_w, display_h; 668 int display_w, display_h;
669 669
670 display_w = SDL_Display->Width; 670 display_w = SDL_Display->Width;
671 display_h = SDL_Display->Height; 671 display_h = SDL_Display->Height;
672 ChangeWindowBox(SDL_Window,(display_w - w - SDL_Window->BorderLeft-SDL_Window->BorderRight)/2, 672 ChangeWindowBox(SDL_Window,(display_w - w - SDL_Window->BorderLeft-SDL_Window->BorderRight)/2,
775 if(bpp==8) 775 if(bpp==8)
776 ncolors=256; 776 ncolors=256;
777 else 777 else
778 ncolors = 1 << screen->format->BitsPerPixel; 778 ncolors = 1 << screen->format->BitsPerPixel;
779 779
780 SDL_XPixels = (Sint32 *)malloc(ncolors * sizeof(Sint32)); 780 SDL_XPixels = (Sint32 *)SDL_malloc(ncolors * sizeof(Sint32));
781 781
782 if(SDL_XPixels == NULL) { 782 if(SDL_XPixels == NULL) {
783 SDL_OutOfMemory(); 783 SDL_OutOfMemory();
784 return -1; 784 return -1;
785 } 785 }
834 834
835 this->hidden->BytesPerPixel=GetCyberMapAttr(SDL_Window->RPort->BitMap,CYBRMATTR_BPPIX); 835 this->hidden->BytesPerPixel=GetCyberMapAttr(SDL_Window->RPort->BitMap,CYBRMATTR_BPPIX);
836 836
837 if(screen->flags & SDL_DOUBLEBUF) 837 if(screen->flags & SDL_DOUBLEBUF)
838 { 838 {
839 if(SDL_RastPort=malloc(sizeof(struct RastPort))) 839 if(SDL_RastPort=SDL_malloc(sizeof(struct RastPort)))
840 { 840 {
841 InitRastPort(SDL_RastPort); 841 InitRastPort(SDL_RastPort);
842 SDL_RastPort->BitMap=this->hidden->SB[1]->sb_BitMap; 842 SDL_RastPort->BitMap=this->hidden->SB[1]->sb_BitMap;
843 } 843 }
844 else 844 else