emacs-diffs
[Top][All Lists]
Advanced

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

master b76cd8af05: Fix background stipple with `alpha_background'


From: Po Lu
Subject: master b76cd8af05: Fix background stipple with `alpha_background'
Date: Fri, 18 Feb 2022 08:25:45 -0500 (EST)

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

    Fix background stipple with `alpha_background'
    
    * src/xterm.c (x_fill_rectangle): Fix treatment of foreground
    and background colors when there is a stipple.
---
 src/xterm.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 930d9cf370..53cb7a2ac4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1417,7 +1417,6 @@ x_fill_rectangle (struct frame *f, GC gc, int x, int y, 
int width, int height,
 #endif
 
          x_xr_apply_ext_clip (f, gc);
-         x_xrender_color_from_gc_foreground (f, gc, &xc, true);
 
 #if RENDER_MAJOR > 0 || (RENDER_MINOR >= 10)
          XGetGCValues (FRAME_X_DISPLAY (f),
@@ -1426,15 +1425,9 @@ x_fill_rectangle (struct frame *f, GC gc, int x, int y, 
int width, int height,
          if (xgcv.fill_style == FillOpaqueStippled
              && FRAME_CHECK_XR_VERSION (f, 0, 10))
            {
-             alpha.red = 65535 * f->alpha_background;
-             alpha.green = 65535 * f->alpha_background;
-             alpha.blue = 65535 * f->alpha_background;
-             alpha.alpha = 65535 * f->alpha_background;
-
-             fill = XRenderCreateSolidFill (FRAME_X_DISPLAY (f),
-                                            &alpha);
+             x_xrender_color_from_gc_background (f, gc, &alpha, true);
+             x_xrender_color_from_gc_foreground (f, gc, &xc, true);
              attrs.repeat = RepeatNormal;
-             attrs.alpha_map = fill;
 
              stipple = XRenderCreatePicture (FRAME_X_DISPLAY (f),
                                              xgcv.stipple,
@@ -1442,19 +1435,26 @@ x_fill_rectangle (struct frame *f, GC gc, int x, int y, 
int width, int height,
                                                                         
PictStandardA1),
                                              CPRepeat, &attrs);
 
-             XRenderComposite (FRAME_X_DISPLAY (f),
-                               PictOpSrc, stipple,
-                               None, FRAME_X_PICTURE (f),
-                               x, y, 0, 0, x, y, width, height);
+             XRenderFillRectangle (FRAME_X_DISPLAY (f), PictOpSrc,
+                                   FRAME_X_PICTURE (f),
+                                   &alpha, x, y, width, height);
+
+             fill = XRenderCreateSolidFill (FRAME_X_DISPLAY (f), &xc);
+
+             XRenderComposite (FRAME_X_DISPLAY (f), PictOpOver, fill, stipple,
+                               FRAME_X_PICTURE (f), 0, 0, x, y, x, y, width, 
height);
 
              XRenderFreePicture (FRAME_X_DISPLAY (f), stipple);
              XRenderFreePicture (FRAME_X_DISPLAY (f), fill);
            }
          else
 #endif
-           XRenderFillRectangle (FRAME_X_DISPLAY (f),
-                                 PictOpSrc, FRAME_X_PICTURE (f),
-                                 &xc, x, y, width, height);
+           {
+             x_xrender_color_from_gc_foreground (f, gc, &xc, true);
+             XRenderFillRectangle (FRAME_X_DISPLAY (f),
+                                   PictOpSrc, FRAME_X_PICTURE (f),
+                                   &xc, x, y, width, height);
+           }
          x_xr_reset_ext_clip (f);
          x_mark_frame_dirty (f);
 



reply via email to

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