aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-02-18 10:34:20 +0800
committerPo Lu2022-02-18 10:35:21 +0800
commit7938410ac0fc17858a7195ecf4b9c19d3b0497e7 (patch)
tree5d931efd5acad31ea21d7c9214775b4f993d29d4 /src
parent1a8b3b639063d0662298c55bd20dc3d129e19476 (diff)
downloademacs-7938410ac0fc17858a7195ecf4b9c19d3b0497e7.tar.gz
emacs-7938410ac0fc17858a7195ecf4b9c19d3b0497e7.zip
Make stipple backgrounds respect `alpha-background'
* src/xterm.c (x_fill_rectangle): Respect `alpha-background' when drawing stipple.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/src/xterm.c b/src/xterm.c
index e3e67f23c61..70fa054bcfd 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,
1409 { 1409 {
1410 XRenderColor xc; 1410 XRenderColor xc;
1411 1411
1412#if RENDER_MAJOR > 0 || (RENDER_MINOR >= 10)
1413 XGCValues xgcv;
1414 XRenderPictureAttributes attrs;
1415 XRenderColor alpha;
1416 Picture stipple, fill;
1417#endif
1418
1412 x_xr_apply_ext_clip (f, gc); 1419 x_xr_apply_ext_clip (f, gc);
1413 x_xrender_color_from_gc_foreground (f, gc, &xc, true); 1420 x_xrender_color_from_gc_foreground (f, gc, &xc, true);
1414 XRenderFillRectangle (FRAME_X_DISPLAY (f), 1421
1415 PictOpSrc, FRAME_X_PICTURE (f), 1422#if RENDER_MAJOR > 0 || (RENDER_MINOR >= 10)
1416 &xc, x, y, width, height); 1423 XGetGCValues (FRAME_X_DISPLAY (f),
1424 gc, GCFillStyle | GCStipple, &xgcv);
1425
1426 if (xgcv.fill_style == FillOpaqueStippled
1427 && FRAME_CHECK_XR_VERSION (f, 0, 10))
1428 {
1429 alpha.red = 65535 * f->alpha_background;
1430 alpha.green = 65535 * f->alpha_background;
1431 alpha.blue = 65535 * f->alpha_background;
1432 alpha.alpha = 65535 * f->alpha_background;
1433
1434 fill = XRenderCreateSolidFill (FRAME_X_DISPLAY (f),
1435 &alpha);
1436 attrs.repeat = RepeatNormal;
1437 attrs.alpha_map = fill;
1438
1439 stipple = XRenderCreatePicture (FRAME_X_DISPLAY (f),
1440 xgcv.stipple,
1441 XRenderFindStandardFormat (FRAME_X_DISPLAY (f),
1442 PictStandardA1),
1443 CPRepeat, &attrs);
1444
1445 XRenderComposite (FRAME_X_DISPLAY (f),
1446 PictOpSrc, stipple,
1447 None, FRAME_X_PICTURE (f),
1448 x, y, 0, 0, x, y, width, height);
1449
1450 XRenderFreePicture (FRAME_X_DISPLAY (f), stipple);
1451 XRenderFreePicture (FRAME_X_DISPLAY (f), fill);
1452 }
1453 else
1454#endif
1455 XRenderFillRectangle (FRAME_X_DISPLAY (f),
1456 PictOpSrc, FRAME_X_PICTURE (f),
1457 &xc, x, y, width, height);
1417 x_xr_reset_ext_clip (f); 1458 x_xr_reset_ext_clip (f);
1418 x_mark_frame_dirty (f); 1459 x_mark_frame_dirty (f);
1419 1460
@@ -2539,7 +2580,7 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p)
2539 s->y + box_line_width, 2580 s->y + box_line_width,
2540 s->background_width, 2581 s->background_width,
2541 s->height - 2 * box_line_width, 2582 s->height - 2 * box_line_width,
2542 false); 2583 true);
2543 XSetFillStyle (display, s->gc, FillSolid); 2584 XSetFillStyle (display, s->gc, FillSolid);
2544 s->background_filled_p = true; 2585 s->background_filled_p = true;
2545 } 2586 }