comparison src/video/x11/SDL_x11gamma.c @ 2213:59a667370c57

make indent
author Bob Pendleton <bob@pendleton.com>
date Tue, 24 Jul 2007 18:46:45 +0000
parents 9462f4408ecb
children e7164a4dac62
comparison
equal deleted inserted replaced
2212:fdadda42d4d4 2213:59a667370c57
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 #include "../SDL_sysvideo.h" 23 #include "../SDL_sysvideo.h"
24 #include "SDL_x11video.h" 24 #include "SDL_x11video.h"
25 25
26 static int numCmaps = 0;
27
28 typedef struct
29 {
30 Display *display;
31 int scrNum;
32 XStandardColormap cmap;
33 Visual visual;
34 } cmapTableEntry;
35
36 cmapTableEntry *cmapTable = NULL;
37
38 void
39 X11_TrackColormap(Display * display, int scrNum,
40 XStandardColormap * cmap, Visual * visual)
41 {
42 int i;
43 cmapTableEntry *newTable = NULL;
44
45 /* only tracking DirectColor colormaps because they're the only ones
46 with gamma ramps */
47 if (DirectColor != visual->class) {
48 return;
49 }
50
51 /* search the table to find out if we already have this one. We only
52 want one entry for each display, screen number, visualid
53 combination */
54 for (i = 0; i < numCmaps; i++) {
55 if (cmapTable[i].display == display &&
56 cmapTable[i].scrNum == scrNum &&
57 cmapTable[i].cmap.visualid == cmap->visualid) {
58 return;
59 }
60 }
61
62 /* increase the table by one entry. If the table is NULL create the
63 first entrty */
64 newTable = SDL_malloc((numCmaps + 1) * sizeof(cmapTableEntry));
65 if (NULL == newTable) {
66 SDL_SetError("Out of memory in X11_TrackColormap()");
67 return;
68 }
69
70 if (NULL != cmapTable) {
71 SDL_memcpy(newTable, cmapTable, numCmaps * sizeof(cmapTableEntry));
72 SDL_free(cmapTable);
73 }
74 cmapTable = newTable;
75
76 cmapTable[numCmaps].display = display;
77 cmapTable[numCmaps].scrNum = scrNum;
78 SDL_memcpy(&cmapTable[numCmaps].cmap, cmap, sizeof(XStandardColormap));
79 SDL_memcpy(&cmapTable[numCmaps].visual, visual, sizeof(Visual));
80
81 numCmaps++;
82 }
83
26 int 84 int
27 X11_SetDisplayGammaRamp(_THIS, Uint16 * ramp) 85 X11_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
28 { 86 {
29 return -1; 87 return -1;
30 } 88 }