comparison src/video/cybergfx/SDL_cgximage.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
55 55
56 if(screen->flags&SDL_HWSURFACE) { 56 if(screen->flags&SDL_HWSURFACE) {
57 ULONG pitch; 57 ULONG pitch;
58 58
59 if(!screen->hwdata) { 59 if(!screen->hwdata) {
60 if(!(screen->hwdata=malloc(sizeof(struct private_hwdata)))) 60 if(!(screen->hwdata=SDL_malloc(sizeof(struct private_hwdata))))
61 return -1; 61 return -1;
62 62
63 D(bug("Creating system accel struct\n")); 63 D(bug("Creating system accel struct\n"));
64 } 64 }
65 screen->hwdata->lock=NULL; 65 screen->hwdata->lock=NULL;
69 screen->hwdata->videodata=this; 69 screen->hwdata->videodata=this;
70 70
71 if(!(screen->hwdata->lock=LockBitMapTags(screen->hwdata->bmap, 71 if(!(screen->hwdata->lock=LockBitMapTags(screen->hwdata->bmap,
72 LBMI_BASEADDRESS,(ULONG)&screen->pixels, 72 LBMI_BASEADDRESS,(ULONG)&screen->pixels,
73 LBMI_BYTESPERROW,(ULONG)&pitch,TAG_DONE))) { 73 LBMI_BYTESPERROW,(ULONG)&pitch,TAG_DONE))) {
74 free(screen->hwdata); 74 SDL_free(screen->hwdata);
75 screen->hwdata=NULL; 75 screen->hwdata=NULL;
76 return -1; 76 return -1;
77 } 77 }
78 else { 78 else {
79 UnLockBitMap(screen->hwdata->lock); 79 UnLockBitMap(screen->hwdata->lock);
86 86
87 D(bug("Accel video image configured (%lx, pitch %ld).\n",screen->pixels,screen->pitch)); 87 D(bug("Accel video image configured (%lx, pitch %ld).\n",screen->pixels,screen->pitch));
88 return 0; 88 return 0;
89 } 89 }
90 90
91 screen->pixels = malloc(screen->h*screen->pitch); 91 screen->pixels = SDL_malloc(screen->h*screen->pitch);
92 92
93 if ( screen->pixels == NULL ) { 93 if ( screen->pixels == NULL ) {
94 SDL_OutOfMemory(); 94 SDL_OutOfMemory();
95 return(-1); 95 return(-1);
96 } 96 }
108 } 108 }
109 109
110 void CGX_DestroyImage(_THIS, SDL_Surface *screen) 110 void CGX_DestroyImage(_THIS, SDL_Surface *screen)
111 { 111 {
112 if ( SDL_Ximage ) { 112 if ( SDL_Ximage ) {
113 free(SDL_Ximage); 113 SDL_free(SDL_Ximage);
114 SDL_Ximage = NULL; 114 SDL_Ximage = NULL;
115 } 115 }
116 if ( screen ) { 116 if ( screen ) {
117 screen->pixels = NULL; 117 screen->pixels = NULL;
118 118
119 if(screen->hwdata) { 119 if(screen->hwdata) {
120 free(screen->hwdata); 120 SDL_free(screen->hwdata);
121 screen->hwdata=NULL; 121 screen->hwdata=NULL;
122 } 122 }
123 } 123 }
124 } 124 }
125 125
161 return 0; 161 return 0;
162 } 162 }
163 163
164 if(!surface->hwdata) 164 if(!surface->hwdata)
165 { 165 {
166 if(!(surface->hwdata=malloc(sizeof(struct private_hwdata)))) 166 if(!(surface->hwdata=SDL_malloc(sizeof(struct private_hwdata))))
167 return -1; 167 return -1;
168 } 168 }
169 169
170 surface->hwdata->mask=NULL; 170 surface->hwdata->mask=NULL;
171 surface->hwdata->lock=NULL; 171 surface->hwdata->lock=NULL;
179 D(bug("...OK\n")); 179 D(bug("...OK\n"));
180 return 0; 180 return 0;
181 } 181 }
182 else 182 else
183 { 183 {
184 free(surface->hwdata); 184 SDL_free(surface->hwdata);
185 surface->hwdata=NULL; 185 surface->hwdata=NULL;
186 } 186 }
187 187
188 return(-1); 188 return(-1);
189 } 189 }
192 if(surface && surface!=SDL_VideoSurface && surface->hwdata) 192 if(surface && surface!=SDL_VideoSurface && surface->hwdata)
193 { 193 {
194 D(bug("Free hw surface.\n")); 194 D(bug("Free hw surface.\n"));
195 195
196 if(surface->hwdata->mask) 196 if(surface->hwdata->mask)
197 free(surface->hwdata->mask); 197 SDL_free(surface->hwdata->mask);
198 198
199 if(surface->hwdata->bmap&&surface->hwdata->allocated) 199 if(surface->hwdata->bmap&&surface->hwdata->allocated)
200 FreeBitMap(surface->hwdata->bmap); 200 FreeBitMap(surface->hwdata->bmap);
201 201
202 free(surface->hwdata); 202 SDL_free(surface->hwdata);
203 surface->hwdata=NULL; 203 surface->hwdata=NULL;
204 surface->pixels=NULL; 204 surface->pixels=NULL;
205 D(bug("end of free hw surface\n")); 205 D(bug("end of free hw surface\n"));
206 } 206 }
207 return; 207 return;
652 652
653 // D(bug("Rects: %ld,%ld %ld,%ld Src:%lx Dest:%lx\n",rects[i].x,rects[i].y,rects[i].w,rects[i].h,src,dest)); 653 // D(bug("Rects: %ld,%ld %ld,%ld Src:%lx Dest:%lx\n",rects[i].x,rects[i].y,rects[i].w,rects[i].h,src,dest));
654 654
655 for(j=rects[i].h;j;--j) 655 for(j=rects[i].h;j;--j)
656 { 656 {
657 memcpy(dest,src,srcwidth); 657 SDL_memcpy(dest,src,srcwidth);
658 src+=this->screen->pitch; 658 src+=this->screen->pitch;
659 dest+=destpitch; 659 dest+=destpitch;
660 } 660 }
661 } 661 }
662 UnLockBitMap(handle); 662 UnLockBitMap(handle);
881 881
882 // D(bug("addr: %lx pitch: %ld src:%lx srcpitch: %ld\n",dest,destpitch,this->screen->pixels,this->screen->pitch)); 882 // D(bug("addr: %lx pitch: %ld src:%lx srcpitch: %ld\n",dest,destpitch,this->screen->pixels,this->screen->pitch));
883 883
884 if(this->screen->pitch==destpitch) 884 if(this->screen->pitch==destpitch)
885 { 885 {
886 memcpy(dest,src,this->screen->pitch*this->screen->h); 886 SDL_memcpy(dest,src,this->screen->pitch*this->screen->h);
887 } 887 }
888 else 888 else
889 { 889 {
890 for(j=this->screen->h;j;--j) 890 for(j=this->screen->h;j;--j)
891 { 891 {
892 memcpy(dest,src,this->screen->pitch); 892 SDL_memcpy(dest,src,this->screen->pitch);
893 src+=this->screen->pitch; 893 src+=this->screen->pitch;
894 dest+=destpitch; 894 dest+=destpitch;
895 } 895 }
896 } 896 }
897 897