rootless: Fix Glyphs damage bounding box origin and coordinate space

The glyph bounding box in RootlessGlyphs is computed in
drawable-relative (window-local) coordinates, but RootlessDamageBox
expects global (screen) coordinates.  Without translating by
drawable.x/y, the damage region often fell outside the window's
borderClip and was silently discarded by RootlessDamageRegion.

RootlessGlyphs accumulated glyph positions starting from (xSrc, ySrc)
instead of (0, 0).  The xSrc/ySrc parameters are the source picture
reference point, not destination offsets.  Every standard Glyphs
implementation (fbGlyphs, miGlyphs) starts position accumulation
from (0, 0) and builds up destination coordinates by adding each
GlyphList's xOff/yOff deltas.

Starting from xSrc shifted the entire damage bounding box by
(xSrc, ySrc), causing it to miss the actual rendered region.  For
typical text rendering where xSrc equals the destination x position,
this doubled the offset, placing the damage box well outside the
window's borderClip and causing RootlessDamageRegion to silently
discard it.

Fixes [1/2]: https://github.com/XQuartz/XQuartz/issues/323

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston Sequoia 2026-03-21 17:05:20 -07:00
parent eb2bf8d1b8
commit 0f2f8e3a10

View file

@ -297,8 +297,8 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
//SCREEN_WRAP(ps, Glyphs);
if (dstWin && IsFramedWindow(dstWin)) {
x = xSrc;
y = ySrc;
x = 0;
y = 0;
while (nlist--) {
x += list->xOff;
@ -341,6 +341,11 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
y += glyph->info.yOff;
}
/* RootlessDamageBox expects global (screen) coordinates */
box.x1 += dstWin->drawable.x;
box.y1 += dstWin->drawable.y;
box.x2 += dstWin->drawable.x;
box.y2 += dstWin->drawable.y;
RootlessDamageBox(dstWin, &box);
}
list++;