emacs-diffs
[Top][All Lists]
Advanced

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

master b6a4766388: Use XDrawPoint to clear relief rect corners


From: Po Lu
Subject: master b6a4766388: Use XDrawPoint to clear relief rect corners
Date: Sun, 29 May 2022 20:49:39 -0400 (EDT)

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

    Use XDrawPoint to clear relief rect corners
    
    * xterm.c (x_clear_point): New function.
    (x_draw_relief_rect): Use that instead.
---
 src/xterm.c | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 908185c3d1..ab36c1681a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6573,6 +6573,31 @@ x_clear_glyph_string_rect (struct glyph_string *s, int 
x, int y, int w, int h)
   x_clear_rectangle (s->f, s->gc, x, y, w, h, s->hl != DRAW_CURSOR);
 }
 
+#ifndef USE_CAIRO
+
+static void
+x_clear_point (struct frame *f, GC gc, int x, int y,
+              bool respect_alpha_background)
+{
+  XGCValues xgcv;
+  Display *dpy;
+
+  dpy = FRAME_X_DISPLAY (f);
+
+  if (f->alpha_background != 1.0
+      && respect_alpha_background)
+    {
+      x_clear_rectangle (f, gc, x, y, 1, 1, true);
+      return;
+    }
+
+  XGetGCValues (dpy, gc, GCBackground | GCForeground, &xgcv);
+  XSetForeground (dpy, gc, xgcv.background);
+  XDrawPoint (dpy, FRAME_X_DRAWABLE (f), gc, x, y);
+  XSetForeground (dpy, gc, xgcv.foreground);
+}
+
+#endif
 
 /* Draw the background of glyph_string S.  If S->background_filled_p
    is non-zero don't draw it.  FORCE_P non-zero means draw the
@@ -7985,25 +8010,21 @@ x_draw_relief_rect (struct frame *f, int left_x, int 
top_y, int right_x,
     {
       if (left_p && top_p && x_inside_rect_p (clip_rect, 1,
                                              left_x, top_y))
-       /* This should respect `alpha-backgroun' since it's being
+       /* This should respect `alpha-background' since it's being
           cleared with the background color of the frame.  */
-       x_clear_rectangle (f, normal_gc, left_x, top_y, 1, 1,
-                          true);
+       x_clear_point (f, normal_gc, left_x, top_y, true);
 
       if (left_p && bot_p && x_inside_rect_p (clip_rect, 1,
                                              left_x, bottom_y))
-       x_clear_rectangle (f, normal_gc, left_x, bottom_y, 1, 1,
-                          true);
+       x_clear_point (f, normal_gc, left_x, bottom_y, true);
 
       if (right_p && top_p && x_inside_rect_p (clip_rect, 1,
                                               right_x, top_y))
-       x_clear_rectangle (f, normal_gc, right_x, top_y, 1, 1,
-                          true);
+       x_clear_point (f, normal_gc, right_x, top_y, true);
 
       if (right_p && bot_p && x_inside_rect_p (clip_rect, 1,
                                               right_x, bottom_y))
-       x_clear_rectangle (f, normal_gc, right_x, bottom_y, 1, 1,
-                          true);
+       x_clear_point (f, normal_gc, right_x, bottom_y, true);
     }
 
   x_reset_clip_rectangles (f, white_gc);



reply via email to

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