ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_x.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/video_x.cpp (file contents):
Revision 1.46 by cebix, 2001-06-30T22:23:44Z vs.
Revision 1.47 by cebix, 2001-07-01T00:46:37Z

# Line 384 | Line 384 | void driver_base::update_palette(void)
384   {
385          if (cmap[0] && cmap[1]) {
386                  int num = 256;
387 <                if (vis->c_class == DirectColor && VideoMonitor.mode.depth == VDEPTH_16BIT)
388 <                        num = vis->map_entries;
387 >                if (IsDirectMode(VideoMonitor.mode))
388 >                        num = vis->map_entries; // Palette is gamma table
389 >                else if (vis->c_class == DirectColor)
390 >                        return; // Indexed mode on true color screen, don't set CLUT
391                  XStoreColors(x_display, cmap[0], palette, num);
392                  XStoreColors(x_display, cmap[1], palette, num);
393          }
# Line 1185 | Line 1187 | bool VideoInit(bool classic)
1187                  cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocAll);
1188                  cmap[1] = XCreateColormap(x_display, rootwin, vis, AllocAll);
1189  
1190 <                // Preset pixel members for gamma table
1190 >                int num = 256;
1191                  if (color_class == DirectColor) {
1192 <                        int num = vis->map_entries;
1192 >                        num = vis->map_entries;
1193 >
1194 >                        // Preset pixel values for gamma table
1195                          uint32 rmask = vis->red_mask, gmask = vis->green_mask, bmask = vis->blue_mask;
1196                          uint32 mask;
1197                          int rloss = 8, rshift = 0;
# Line 1210 | Line 1214 | bool VideoInit(bool classic)
1214                                  palette[i].pixel = ((c >> rloss) << rshift) | ((c >> gloss) << gshift) | ((c >> bloss) << bshift);
1215                          }
1216                  }
1217 +
1218 +                // Load gray ramp
1219 +                for (int i=0; i<num; i++) {
1220 +                        int c = (i * 256) / num;
1221 +                        palette[i].red = c * 0x0101;
1222 +                        palette[i].green = c * 0x0101;
1223 +                        palette[i].blue = c * 0x0101;
1224 +                        if (color_class == PseudoColor)
1225 +                                palette[i].pixel = i;
1226 +                        palette[i].flags = DoRed | DoGreen | DoBlue;
1227 +                }
1228 +                XStoreColors(x_display, cmap[0], palette, num);
1229          }
1230  
1231          // Get screen mode from preferences
# Line 1392 | Line 1408 | void video_set_palette(uint8 *pal)
1408  
1409          // Convert colors to XColor array
1410          int num_in = 256, num_out = 256;
1411 <        if (VideoMonitor.mode.depth == VDEPTH_16BIT) {
1411 >        if (VideoMonitor.mode.depth == VDEPTH_16BIT)
1412                  num_in = 32;
1413 +        if (IsDirectMode(VideoMonitor.mode)) {
1414                  // If X is in 565 mode we have to stretch the palette from 32 to 64 entries
1415 <                if (vis->c_class == DirectColor)
1399 <                        num_out = vis->map_entries;
1415 >                num_out = vis->map_entries;
1416          }
1417          XColor *p = palette;
1418          for (int i=0; i<num_out; i++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines