/[emacs]/emacs/src/xfns.c
ViewVC logotype

Diff of /emacs/src/xfns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.593 by gerd, Fri Aug 29 09:29:16 2003 UTC revision 1.594 by jhd, Sat Aug 30 17:44:40 2003 UTC
# Line 6755  lookup_rgb_color (f, r, g, b) Line 6755  lookup_rgb_color (f, r, g, b)
6755    unsigned hash = CT_HASH_RGB (r, g, b);    unsigned hash = CT_HASH_RGB (r, g, b);
6756    int i = hash % CT_SIZE;    int i = hash % CT_SIZE;
6757    struct ct_color *p;    struct ct_color *p;
6758    Visual *visual;    struct x_display_info *dpyinfo;
6759    
6760    /* Handle TrueColor visuals specially, which improves performance by    /* Handle TrueColor visuals specially, which improves performance by
6761       two orders of magnitude.  Freeing colors on TrueColor visuals is       two orders of magnitude.  Freeing colors on TrueColor visuals is
6762       a nop, and pixel colors specify RGB values directly.  See also       a nop, and pixel colors specify RGB values directly.  See also
6763       the Xlib spec, chapter 3.1.  */       the Xlib spec, chapter 3.1.  */
6764    visual = FRAME_X_DISPLAY_INFO (f)->visual;    dpyinfo = FRAME_X_DISPLAY_INFO (f);
6765    if (visual->class == TrueColor)    if (dpyinfo->red_bits > 0)
6766      {      {
       int bits = visual->bits_per_rgb;  
6767        unsigned long pr, pg, pb;        unsigned long pr, pg, pb;
6768    
6769        /* Apply gamma-correction like normal color allocation does.  */        /* Apply gamma-correction like normal color allocation does.  */
# Line 6779  lookup_rgb_color (f, r, g, b) Line 6778  lookup_rgb_color (f, r, g, b)
6778        /* Scale down RGB values to the visual's bits per RGB, and shift        /* Scale down RGB values to the visual's bits per RGB, and shift
6779           them to the right position in the pixel color.  Note that the           them to the right position in the pixel color.  Note that the
6780           original RGB values are 16-bit values, as usual in X.  */           original RGB values are 16-bit values, as usual in X.  */
6781        pr = (r >> (16 - bits)) << 2 * bits;        pr = (r >> (16 - dpyinfo->red_bits))   << dpyinfo->red_offset;
6782        pg = (g >> (16 - bits)) << 1 * bits;        pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
6783        pb = (b >> (16 - bits)) << 0 * bits;        pb = (b >> (16 - dpyinfo->blue_bits))  << dpyinfo->blue_offset;
   
       /* Apply RGB masks of the visual.  */  
       pr &= visual->red_mask;  
       pg &= visual->green_mask;  
       pb &= visual->blue_mask;  
6784    
6785        /* Assemble the pixel color.  */        /* Assemble the pixel color.  */
6786        return pr | pg | pb;        return pr | pg | pb;

Legend:
Removed from v.1.593  
changed lines
  Added in v.1.594

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26