Fix fallout from switch to 32-bit visuals

* src/xfns.c (x_decode_color): Make return type wide enough to
hold any pixel value.
* src/xterm.h (x_make_truecolor_pixel): Simplify.
This commit is contained in:
Po Lu 2022-02-11 13:30:11 +08:00
parent c7bde98806
commit 2d5b219239
2 changed files with 2 additions and 8 deletions

View file

@ -687,7 +687,7 @@ x_defined_color (struct frame *f, const char *color_name,
is a monochrome frame, return MONO_COLOR regardless of what ARG says.
Signal an error if color can't be allocated. */
static int
static unsigned long
x_decode_color (struct frame *f, Lisp_Object color_name, int mono_color)
{
XColor cdef;

View file

@ -1307,7 +1307,7 @@ x_display_pixel_width (struct x_display_info *dpyinfo)
INLINE unsigned long
x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
{
unsigned long pr, pg, pb, pa = 0;
unsigned long pr, pg, pb, pa = dpyinfo->alpha_mask;
/* 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
@ -1316,12 +1316,6 @@ x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
if (dpyinfo->alpha_bits)
pa = (((unsigned long) 0xffff >> (16 - dpyinfo->alpha_bits))
<< dpyinfo->alpha_offset);
else
pa = 0;
/* Assemble the pixel color. */
return pr | pg | pb | pa;
}