comparison src/video/cybergfx/SDL_cgxwm.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 c71e05b4dc2e
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
76 } 76 }
77 /* If we already have allocated colours from the default colormap, 77 /* If we already have allocated colours from the default colormap,
78 copy them */ 78 copy them */
79 if(SDL_Visual == dvis && SDL_XColorMap == SDL_DisplayColormap 79 if(SDL_Visual == dvis && SDL_XColorMap == SDL_DisplayColormap
80 && this->screen->format->palette && sicon->format->palette) { 80 && this->screen->format->palette && sicon->format->palette) {
81 memcpy(sicon->format->palette->colors, 81 SDL_memcpy(sicon->format->palette->colors,
82 this->screen->format->palette->colors, 82 this->screen->format->palette->colors,
83 this->screen->format->palette->ncolors * sizeof(SDL_Color)); 83 this->screen->format->palette->ncolors * sizeof(SDL_Color));
84 } 84 }
85 85
86 bounds.x = 0; 86 bounds.x = 0;
96 SDL_Palette *palette; 96 SDL_Palette *palette;
97 Uint8 *p; 97 Uint8 *p;
98 XColor wanted; 98 XColor wanted;
99 99
100 palette = sicon->format->palette; 100 palette = sicon->format->palette;
101 color_tried = malloc(palette->ncolors); 101 color_tried = SDL_malloc(palette->ncolors);
102 if ( color_tried == NULL ) { 102 if ( color_tried == NULL ) {
103 goto done; 103 goto done;
104 } 104 }
105 if ( SDL_iconcolors != NULL ) { 105 if ( SDL_iconcolors != NULL ) {
106 free(SDL_iconcolors); 106 SDL_free(SDL_iconcolors);
107 } 107 }
108 SDL_iconcolors = malloc(palette->ncolors 108 SDL_iconcolors = SDL_malloc(palette->ncolors
109 * sizeof(*SDL_iconcolors)); 109 * sizeof(*SDL_iconcolors));
110 if ( SDL_iconcolors == NULL ) { 110 if ( SDL_iconcolors == NULL ) {
111 free(color_tried); 111 SDL_free(color_tried);
112 goto done; 112 goto done;
113 } 113 }
114 memset(color_tried, 0, palette->ncolors); 114 SDL_memset(color_tried, 0, palette->ncolors);
115 memset(SDL_iconcolors, 0, 115 SDL_memset(SDL_iconcolors, 0,
116 palette->ncolors * sizeof(*SDL_iconcolors)); 116 palette->ncolors * sizeof(*SDL_iconcolors));
117 117
118 p = (Uint8 *)sicon->pixels; 118 p = (Uint8 *)sicon->pixels;
119 for ( i = sicon->w*sicon->h; i > 0; --i, ++p ) { 119 for ( i = sicon->w*sicon->h; i > 0; --i, ++p ) {
120 if ( ! color_tried[*p] ) { 120 if ( ! color_tried[*p] ) {
130 color_tried[*p] = 1; 130 color_tried[*p] = 1;
131 } 131 }
132 } 132 }
133 } 133 }
134 if ( color_tried != NULL ) { 134 if ( color_tried != NULL ) {
135 free(color_tried); 135 SDL_free(color_tried);
136 } 136 }
137 137
138 /* Translate mask data to LSB order and set the icon mask */ 138 /* Translate mask data to LSB order and set the icon mask */
139 i = (sicon->w/8)*sicon->h; 139 i = (sicon->w/8)*sicon->h;
140 LSBmask = (Uint8 *)malloc(i); 140 LSBmask = (Uint8 *)SDL_malloc(i);
141 if ( LSBmask == NULL ) { 141 if ( LSBmask == NULL ) {
142 goto done; 142 goto done;
143 } 143 }
144 memset(LSBmask, 0, i); 144 SDL_memset(LSBmask, 0, i);
145 while ( --i >= 0 ) { 145 while ( --i >= 0 ) {
146 for ( b=0; b<8; ++b ) 146 for ( b=0; b<8; ++b )
147 LSBmask[i] |= (((mask[i]>>b)&0x01)<<(7-b)); 147 LSBmask[i] |= (((mask[i]>>b)&0x01)<<(7-b));
148 } 148 }
149 mask_pixmap = XCreatePixmapFromBitmapData(SDL_Display, WMwindow, 149 mask_pixmap = XCreatePixmapFromBitmapData(SDL_Display, WMwindow,
161 GC = XCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues); 161 GC = XCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues);
162 XPutImage(SDL_Display, icon_pixmap, GC, icon_image, 162 XPutImage(SDL_Display, icon_pixmap, GC, icon_image,
163 0, 0, 0, 0, sicon->w, sicon->h); 163 0, 0, 0, 0, sicon->w, sicon->h);
164 XFreeGC(SDL_Display, GC); 164 XFreeGC(SDL_Display, GC);
165 XDestroyImage(icon_image); 165 XDestroyImage(icon_image);
166 free(LSBmask); 166 SDL_free(LSBmask);
167 sicon->pixels = NULL; 167 sicon->pixels = NULL;
168 168
169 #ifdef USE_ICON_WINDOW 169 #ifdef USE_ICON_WINDOW
170 /* Create an icon window and set the pixmap as its background */ 170 /* Create an icon window and set the pixmap as its background */
171 icon_window = XCreateSimpleWindow(SDL_Display, SDL_Root, 171 icon_window = XCreateSimpleWindow(SDL_Display, SDL_Root,