comparison src/video/x11/SDL_x11gamma.c @ 3052:b7197d7e8566

indent
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Jan 2009 06:38:44 +0000
parents b36579172f27
children 4b594623401b
comparison
equal deleted inserted replaced
3051:1a45bc89db0c 3052:b7197d7e8566
95 cmapTable[numCmaps].colormap = colormap; 95 cmapTable[numCmaps].colormap = colormap;
96 SDL_memcpy(&cmapTable[numCmaps].visual, visual, sizeof(Visual)); 96 SDL_memcpy(&cmapTable[numCmaps].visual, visual, sizeof(Visual));
97 cmapTable[numCmaps].ramp = NULL; 97 cmapTable[numCmaps].ramp = NULL;
98 98
99 if (ramp != NULL) { 99 if (ramp != NULL) {
100 newramp = SDL_malloc(SDL_GammaRampSize); 100 newramp = SDL_malloc(SDL_GammaRampSize);
101 if (NULL == newramp) { 101 if (NULL == newramp) {
102 SDL_SetError("Out of memory in X11_TrackColormap()"); 102 SDL_SetError("Out of memory in X11_TrackColormap()");
103 return; 103 return;
104 } 104 }
105 SDL_memset(newramp, 0, SDL_GammaRampSize); 105 SDL_memset(newramp, 0, SDL_GammaRampSize);
106 cmapTable[numCmaps].ramp = newramp; 106 cmapTable[numCmaps].ramp = newramp;
107 107
108 ncolors = cmapTable[numCmaps].visual.map_entries; 108 ncolors = cmapTable[numCmaps].visual.map_entries;
109 109
110 for (i = 0; i < ncolors; i++) { 110 for (i = 0; i < ncolors; i++) {
111 newramp[(0 * 256) + i] = ramp[i].red; 111 newramp[(0 * 256) + i] = ramp[i].red;
112 newramp[(1 * 256) + i] = ramp[i].green; 112 newramp[(1 * 256) + i] = ramp[i].green;
113 newramp[(2 * 256) + i] = ramp[i].blue; 113 newramp[(2 * 256) + i] = ramp[i].blue;
114 } 114 }
115 } 115 }
116 116
117 numCmaps++; 117 numCmaps++;
118 } 118 }
119 119
147 if (NULL == colorcells) { 147 if (NULL == colorcells) {
148 SDL_SetError("out of memory in X11_SetDisplayGammaRamp"); 148 SDL_SetError("out of memory in X11_SetDisplayGammaRamp");
149 return -1; 149 return -1;
150 } 150 }
151 /* remember the new ramp */ 151 /* remember the new ramp */
152 if (cmapTable[j].ramp == NULL) { 152 if (cmapTable[j].ramp == NULL) {
153 Uint16 * newramp = SDL_malloc(SDL_GammaRampSize); 153 Uint16 *newramp = SDL_malloc(SDL_GammaRampSize);
154 if (NULL == newramp) { 154 if (NULL == newramp) {
155 SDL_SetError("Out of memory in X11_TrackColormap()"); 155 SDL_SetError("Out of memory in X11_TrackColormap()");
156 return -1; 156 return -1;
157 } 157 }
158 cmapTable[j].ramp = newramp; 158 cmapTable[j].ramp = newramp;
159 } 159 }
160 SDL_memcpy(cmapTable[j].ramp, ramp, SDL_GammaRampSize); 160 SDL_memcpy(cmapTable[j].ramp, ramp, SDL_GammaRampSize);
161 161
162 rshift = 0; 162 rshift = 0;
163 rmask = visual->red_mask; 163 rmask = visual->red_mask;
164 while (0 == (rmask & 1)) { 164 while (0 == (rmask & 1)) {