From 2d5b2192398c6ddda15a50a3057832f80ee4a00f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 11 Feb 2022 13:30:11 +0800 Subject: [PATCH] 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. --- src/xfns.c | 2 +- src/xterm.h | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index 58f5cb847bd..7d91f32ad4a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -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; diff --git a/src/xterm.h b/src/xterm.h index afd6a1757c5..3a69c028797 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -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; } -- 2.39.5