|
|
| |
inline uint16 COLOR_SUB(uint16 C1, uint16 C2) | inline uint16 COLOR_SUB(uint16 C1, uint16 C2) |
{ | { |
uint16 mC1, mC2, v = 0; |
uint16 mC1, mC2, v = ALPHA_BITS_MASK; |
| |
mC1 = C1 & FIRST_COLOR_MASK; | mC1 = C1 & FIRST_COLOR_MASK; |
mC2 = C2 & FIRST_COLOR_MASK; | mC2 = C2 & FIRST_COLOR_MASK; |
|
|
| |
// Strip dots from the version string | // Strip dots from the version string |
char *ptr; | char *ptr; |
while (ptr = strchr (ver, '.')) |
while ( (ptr = strchr (ver, '.')) != 0) |
memmove (ptr, ptr + 1, strlen (ptr + 1) + 1); | memmove (ptr, ptr + 1, strlen (ptr + 1) + 1); |
| |
// Pad the string with zeros to 4 digits |
|
while (strlen (ver) < 4) |
|
strcat (ver, "0"); |
|
|
|
OpenGL.version = atoi (ver); | OpenGL.version = atoi (ver); |
|
|
|
// Pad the number with zeros to 4 digits |
|
while (OpenGL.version < 1000) |
|
OpenGL.version *= 10; |
} | } |
else | else |
OpenGL.version = 1100; | OpenGL.version = 1100; |
|
|
int i = 0; | int i = 0; |
for (uint32 y = 0; y < pheight; y++) | for (uint32 y = 0; y < pheight; y++) |
{ | { |
uint16 *ptr = (uint16 *) (GFX.Screen + (y + startl) * GFX.Pitch) + startx; |
uint16 *ptr = (uint16 *) (GFX.Screen + (y + startl) * GFX.Pitch/2) + startx; |
for (uint32 x = 0; x < pwidth; x++) | for (uint32 x = 0; x < pwidth; x++) |
{ | { |
int color = *ptr++; | int color = *ptr++; |
|
|
for (uint32 y = 0; y < pheight; y++) | for (uint32 y = 0; y < pheight; y++) |
{ | { |
memmove (basetexbuffer + sizeof (uint16) * texture_size * y, | memmove (basetexbuffer + sizeof (uint16) * texture_size * y, |
(GFX.Screen + (y + startl) * GFX.Pitch) + startx, |
(GFX.Screen + (y + startl) * GFX.Pitch/2) + startx, |
sizeof (uint16) * texture_size); | sizeof (uint16) * texture_size); |
} | } |
data = basetexbuffer; | data = basetexbuffer; |
|
|
} | } |
delete[] color_diff; | delete[] color_diff; |
| |
|
GUI.cmap = XCreateColormap (GUI.display, RootWindowOfScreen (GUI.screen), |
|
GUI.visual, GUI.pseudo ? AllocAll : AllocNone); |
|
if (GUI.pseudo) |
|
{ |
|
for (i = 0; i < 256; i++) |
|
{ |
|
GUI.colors[i].red = GUI.colors[i].green = GUI.colors[i].blue = 0; |
|
GUI.colors[i].pixel = i; |
|
GUI.colors[i].flags = DoRed | DoGreen | DoBlue; |
|
} |
|
XStoreColors (GUI.display, GUI.cmap, GUI.colors, 256); |
|
} |
|
|
XSetWindowAttributes attrib; | XSetWindowAttributes attrib; |
| |
attrib.background_pixel = BlackPixelOfScreen (GUI.screen); | attrib.background_pixel = BlackPixelOfScreen (GUI.screen); |
|
attrib.colormap = GUI.cmap; |
GUI.window = XCreateWindow (GUI.display, RootWindowOfScreen (GUI.screen), | GUI.window = XCreateWindow (GUI.display, RootWindowOfScreen (GUI.screen), |
(WidthOfScreen(GUI.screen) - GUI.window_width) / 2, | (WidthOfScreen(GUI.screen) - GUI.window_width) / 2, |
(HeightOfScreen(GUI.screen) - GUI.window_height) / 2, | (HeightOfScreen(GUI.screen) - GUI.window_height) / 2, |
GUI.window_width, GUI.window_height, 0, | GUI.window_width, GUI.window_height, 0, |
GUI.depth, InputOutput, GUI.visual, | GUI.depth, InputOutput, GUI.visual, |
CWBackPixel, &attrib); |
CWBackPixel | CWColormap, &attrib); |
| |
#ifdef USE_DGA_EXTENSION | #ifdef USE_DGA_EXTENSION |
CreateFullScreenWindow (); | CreateFullScreenWindow (); |
|
|
ButtonPressMask | ButtonReleaseMask); | ButtonPressMask | ButtonReleaseMask); |
#endif | #endif |
| |
if (GUI.pseudo) |
|
{ |
|
GUI.cmap = XCreateColormap (GUI.display, GUI.window, GUI.visual, True); |
|
XSetWindowColormap (GUI.display, GUI.window, GUI.cmap); |
|
for (i = 0; i < 256; i++) |
|
{ |
|
GUI.colors[i].red = GUI.colors[i].green = GUI.colors[i].blue = 0; |
|
GUI.colors[i].pixel = i; |
|
GUI.colors[i].flags = DoRed | DoGreen | DoBlue; |
|
} |
|
XStoreColors (GUI.display, GUI.cmap, GUI.colors, 256); |
|
} |
|
XMapRaised (GUI.display, GUI.window); | XMapRaised (GUI.display, GUI.window); |
XClearWindow (GUI.display, GUI.window); | XClearWindow (GUI.display, GUI.window); |
SetupImage (); | SetupImage (); |