[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xfns.c
From: |
Jan Djärv |
Subject: |
[Emacs-diffs] Changes to emacs/src/xfns.c |
Date: |
Sat, 30 Aug 2003 13:44:41 -0400 |
Index: emacs/src/xfns.c
diff -c emacs/src/xfns.c:1.593 emacs/src/xfns.c:1.594
*** emacs/src/xfns.c:1.593 Fri Aug 29 05:29:16 2003
--- emacs/src/xfns.c Sat Aug 30 13:44:40 2003
***************
*** 6755,6770 ****
unsigned hash = CT_HASH_RGB (r, g, b);
int i = hash % CT_SIZE;
struct ct_color *p;
! Visual *visual;
/* Handle TrueColor visuals specially, which improves performance by
two orders of magnitude. Freeing colors on TrueColor visuals is
a nop, and pixel colors specify RGB values directly. See also
the Xlib spec, chapter 3.1. */
! visual = FRAME_X_DISPLAY_INFO (f)->visual;
! if (visual->class == TrueColor)
{
- int bits = visual->bits_per_rgb;
unsigned long pr, pg, pb;
/* Apply gamma-correction like normal color allocation does. */
--- 6755,6769 ----
unsigned hash = CT_HASH_RGB (r, g, b);
int i = hash % CT_SIZE;
struct ct_color *p;
! struct x_display_info *dpyinfo;
/* Handle TrueColor visuals specially, which improves performance by
two orders of magnitude. Freeing colors on TrueColor visuals is
a nop, and pixel colors specify RGB values directly. See also
the Xlib spec, chapter 3.1. */
! dpyinfo = FRAME_X_DISPLAY_INFO (f);
! if (dpyinfo->red_bits > 0)
{
unsigned long pr, pg, pb;
/* Apply gamma-correction like normal color allocation does. */
***************
*** 6779,6792 ****
/* Scale down RGB values to the visual's bits per RGB, and shift
them to the right position in the pixel color. Note that the
original RGB values are 16-bit values, as usual in X. */
! pr = (r >> (16 - bits)) << 2 * bits;
! pg = (g >> (16 - bits)) << 1 * bits;
! pb = (b >> (16 - bits)) << 0 * bits;
!
! /* Apply RGB masks of the visual. */
! pr &= visual->red_mask;
! pg &= visual->green_mask;
! pb &= visual->blue_mask;
/* Assemble the pixel color. */
return pr | pg | pb;
--- 6778,6786 ----
/* Scale down RGB values to the visual's bits per RGB, and shift
them to the right position in the pixel color. Note that the
original RGB values are 16-bit values, as usual in X. */
! pr = (r >> (16 - dpyinfo->red_bits)) << dpyinfo->red_offset;
! pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
! pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
/* Assemble the pixel color. */
return pr | pg | pb;