~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/glut/glx/glut_cmap.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
    }
178
178
    break;
179
179
  case TrueColor:
180
 
  case DirectColor:
181
180
    *colormap = NULL;   /* NULL if RGBA */
182
181
 
183
182
    /* Hewlett-Packard supports a feature called "HP Color
250
249
       private one. */
251
250
    /* XXX Should do a better job of internal sharing for
252
251
       privately allocated TrueColor colormaps. */
253
 
    /* XXX DirectColor probably needs ramps hand initialized! */
254
252
    *cmap = XCreateColormap(__glutDisplay, __glutRoot,
255
253
      vi->visual, AllocNone);
256
254
    break;
 
255
  case DirectColor:
 
256
    *colormap = NULL;   /* NULL if RGBA */
 
257
    *cmap = XCreateColormap(__glutDisplay, __glutRoot,
 
258
                            vi->visual, AllocAll);
 
259
    if (vi->depth == 24) {
 
260
      /* init the red, green, blue maps to linear ramps */
 
261
      XColor xc[256];
 
262
      int i;
 
263
      for (i = 0; i < 256; i++) {
 
264
        xc[i].pixel = (i << 16) | (i << 8) | i;
 
265
        xc[i].red = (i << 8) | i;
 
266
        xc[i].green = (i << 8) | i;
 
267
        xc[i].blue = (i << 8) | i;
 
268
        xc[i].flags = DoRed | DoGreen | DoBlue;
 
269
      }
 
270
      XStoreColors(__glutDisplay, *cmap, xc, 256);
 
271
    }
 
272
    else {
 
273
       fprintf(stderr, "GLUT Error: DirectColor visuals other than 24-bits "
 
274
               "not fully supported.\n");
 
275
    }
 
276
    break;
257
277
  case StaticColor:
258
278
  case StaticGray:
259
279
  case GrayScale: