[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xterm.c
From: |
Jan Djärv |
Subject: |
[Emacs-diffs] Changes to emacs/src/xterm.c |
Date: |
Sat, 30 Aug 2003 13:44:41 -0400 |
Index: emacs/src/xterm.c
diff -c emacs/src/xterm.c:1.806 emacs/src/xterm.c:1.807
*** emacs/src/xterm.c:1.806 Thu Aug 21 15:54:47 2003
--- emacs/src/xterm.c Sat Aug 30 13:44:40 2003
***************
*** 10120,10125 ****
--- 10120,10153 ----
}
#endif
+ /* Count number of set bits in mask and number of bits to shift to
+ get to the first bit. With MASK 0x7e0, *BITS is set to 6, and *OFFSET
+ to 5. */
+ static void
+ get_bits_and_offset (mask, bits, offset)
+ unsigned long mask;
+ int *bits;
+ int *offset;
+ {
+ int nr = 0;
+ int off = 0;
+
+ while (!(mask & 1))
+ {
+ off++;
+ mask >>= 1;
+ }
+
+ while (mask & 1)
+ {
+ nr++;
+ mask >>= 1;
+ }
+
+ *offset = off;
+ *bits = nr;
+ }
+
struct x_display_info *
x_term_init (display_name, xrm_option, resource_name)
Lisp_Object display_name;
***************
*** 10367,10372 ****
--- 10395,10414 ----
dpyinfo->x_highlight_frame = 0;
dpyinfo->image_cache = make_image_cache ();
+ /* See if we can construct pixel values from RGB values. */
+ dpyinfo->red_bits = dpyinfo->blue_bits = dpyinfo->green_bits = 0;
+ dpyinfo->red_offset = dpyinfo->blue_offset = dpyinfo->green_offset = 0;
+
+ if (dpyinfo->visual->class == TrueColor)
+ {
+ get_bits_and_offset (dpyinfo->visual->red_mask,
+ &dpyinfo->red_bits, &dpyinfo->red_offset);
+ get_bits_and_offset (dpyinfo->visual->blue_mask,
+ &dpyinfo->blue_bits, &dpyinfo->blue_offset);
+ get_bits_and_offset (dpyinfo->visual->green_mask,
+ &dpyinfo->green_bits, &dpyinfo->green_offset);
+ }
+
/* See if a private colormap is requested. */
if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen))
{