[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7938410ac0: Make stipple backgrounds respect `alpha-background'
From: |
Po Lu |
Subject: |
master 7938410ac0: Make stipple backgrounds respect `alpha-background' |
Date: |
Thu, 17 Feb 2022 21:36:49 -0500 (EST) |
branch: master
commit 7938410ac0fc17858a7195ecf4b9c19d3b0497e7
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Make stipple backgrounds respect `alpha-background'
* src/xterm.c (x_fill_rectangle): Respect `alpha-background'
when drawing stipple.
---
src/xterm.c | 49 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 4 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index e3e67f23c6..70fa054bcf 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1409,11 +1409,52 @@ x_fill_rectangle (struct frame *f, GC gc, int x, int y,
int width, int height,
{
XRenderColor xc;
+#if RENDER_MAJOR > 0 || (RENDER_MINOR >= 10)
+ XGCValues xgcv;
+ XRenderPictureAttributes attrs;
+ XRenderColor alpha;
+ Picture stipple, fill;
+#endif
+
x_xr_apply_ext_clip (f, gc);
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);
+
+#if RENDER_MAJOR > 0 || (RENDER_MINOR >= 10)
+ XGetGCValues (FRAME_X_DISPLAY (f),
+ gc, GCFillStyle | GCStipple, &xgcv);
+
+ 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);
+ attrs.repeat = RepeatNormal;
+ attrs.alpha_map = fill;
+
+ stipple = XRenderCreatePicture (FRAME_X_DISPLAY (f),
+ xgcv.stipple,
+ XRenderFindStandardFormat
(FRAME_X_DISPLAY (f),
+
PictStandardA1),
+ CPRepeat, &attrs);
+
+ XRenderComposite (FRAME_X_DISPLAY (f),
+ PictOpSrc, stipple,
+ None, FRAME_X_PICTURE (f),
+ x, y, 0, 0, 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_xr_reset_ext_clip (f);
x_mark_frame_dirty (f);
@@ -2539,7 +2580,7 @@ x_draw_glyph_string_background (struct glyph_string *s,
bool force_p)
s->y + box_line_width,
s->background_width,
s->height - 2 * box_line_width,
- false);
+ true);
XSetFillStyle (display, s->gc, FillSolid);
s->background_filled_p = true;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7938410ac0: Make stipple backgrounds respect `alpha-background',
Po Lu <=