emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2d5b219239: Fix fallout from switch to 32-bit visuals


From: Po Lu
Subject: master 2d5b219239: Fix fallout from switch to 32-bit visuals
Date: Fri, 11 Feb 2022 00:31:05 -0500 (EST)

branch: master
commit 2d5b2192398c6ddda15a50a3057832f80ee4a00f
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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 58f5cb847b..7d91f32ad4 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 afd6a1757c..3a69c02879 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;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]