Refactoring Xft clipping ref. #175

This commit is contained in:
Bakkeby 2025-05-06 14:41:20 +02:00
parent cb91e175ba
commit f8e451e26c

35
x.c
View file

@ -2234,20 +2234,9 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
else else
#endif // BACKGROUND_IMAGE_PATCH #endif // BACKGROUND_IMAGE_PATCH
#if !WIDE_GLYPHS_PATCH
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
#endif // WIDE_GLYPHS_PATCH
/* Set the clip region because Xft is sometimes dirty. */
r.x = 0;
r.y = 0;
r.height = win.ch;
r.width = width;
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
#if WIDE_GLYPHS_PATCH
/* Fill the background */ /* Fill the background */
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch); XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
#if WIDE_GLYPHS_PATCH
} }
#endif // WIDE_GLYPHS_PATCH #endif // WIDE_GLYPHS_PATCH
@ -2258,13 +2247,27 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
if (base.mode & ATTR_BOXDRAW) { if (base.mode & ATTR_BOXDRAW) {
drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len); drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len);
} else { } else {
/* Render the glyphs. */ #endif // BOXDRAW_PATCH
XftDrawGlyphFontSpec(xw.draw, fg, specs, len); /* Set the clip region because Xft is sometimes dirty. */
} #if WIDE_GLYPHS_PATCH
r.x = 0;
r.y = 0;
r.height = win.ch;
r.width = win.w;
XftDrawSetClipRectangles(xw.draw, 0, winy, &r, 1);
#else #else
r.x = 0;
r.y = 0;
r.height = win.ch;
r.width = width;
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
#endif // WIDE_GLYPHS_PATCH
#if BOXDRAW_PATCH
}
#endif // BOXDRAW_PATCH
/* Render the glyphs. */ /* Render the glyphs. */
XftDrawGlyphFontSpec(xw.draw, fg, specs, len); XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
#endif // BOXDRAW_PATCH
/* Render underline and strikethrough. */ /* Render underline and strikethrough. */
if (base.mode & ATTR_UNDERLINE) { if (base.mode & ATTR_UNDERLINE) {