mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-10 06:02:10 -05:00
GTK: clear target Pixmap for X font rendering with Cairo
CreatePixmap returns a Pixmap with undefined contents, and ImageText16 doesn't quite erase the whole rectangle covered by the text (and hence the whole Pixmap. So to be on the safe side we should make sure to erase the entire Pixmap before drawing the text. Conveniently, ImageText16 ignores the function specified in the GC, so we can set that to GXclear and avoid needing to change the GC thereafter.
This commit is contained in:
parent
c3e2bf980f
commit
10fdd29fea
@ -643,11 +643,13 @@ static void x11font_cairo_init_gc(x11font_individual *xfi, Display *disp,
|
|||||||
if (xfi->gc == None) {
|
if (xfi->gc == None) {
|
||||||
XGCValues gcvals;
|
XGCValues gcvals;
|
||||||
|
|
||||||
|
gcvals.function = GXclear;
|
||||||
gcvals.foreground = 1;
|
gcvals.foreground = 1;
|
||||||
gcvals.background = 0;
|
gcvals.background = 0;
|
||||||
gcvals.font = xfi->xfs->fid;
|
gcvals.font = xfi->xfs->fid;
|
||||||
xfi->gc = XCreateGC(disp, pixmap,
|
xfi->gc = XCreateGC(disp, pixmap,
|
||||||
GCForeground | GCBackground | GCFont, &gcvals);
|
GCFunction | GCForeground | GCBackground | GCFont,
|
||||||
|
&gcvals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,6 +672,7 @@ static void x11font_cairo_draw_16(
|
|||||||
pixmap = XCreatePixmap(disp, GDK_DRAWABLE_XID(widgetwin),
|
pixmap = XCreatePixmap(disp, GDK_DRAWABLE_XID(widgetwin),
|
||||||
pixwidth, pixheight, 1);
|
pixwidth, pixheight, 1);
|
||||||
x11font_cairo_init_gc(xfi, disp, pixmap);
|
x11font_cairo_init_gc(xfi, disp, pixmap);
|
||||||
|
XFillRectangle(disp, pixmap, xfi->gc, 0, 0, pixwidth, pixheight);
|
||||||
XDrawImageString16(disp, pixmap, xfi->gc,
|
XDrawImageString16(disp, pixmap, xfi->gc,
|
||||||
-bounds.lbearing, bounds.ascent,
|
-bounds.lbearing, bounds.ascent,
|
||||||
string+start, length);
|
string+start, length);
|
||||||
@ -709,6 +712,7 @@ static void x11font_cairo_draw_8(
|
|||||||
pixmap = XCreatePixmap(disp, GDK_DRAWABLE_XID(widgetwin),
|
pixmap = XCreatePixmap(disp, GDK_DRAWABLE_XID(widgetwin),
|
||||||
pixwidth, pixheight, 1);
|
pixwidth, pixheight, 1);
|
||||||
x11font_cairo_init_gc(xfi, disp, pixmap);
|
x11font_cairo_init_gc(xfi, disp, pixmap);
|
||||||
|
XFillRectangle(disp, pixmap, xfi->gc, 0, 0, pixwidth, pixheight);
|
||||||
XDrawImageString(disp, pixmap, xfi->gc,
|
XDrawImageString(disp, pixmap, xfi->gc,
|
||||||
-bounds.lbearing, bounds.ascent,
|
-bounds.lbearing, bounds.ascent,
|
||||||
string+start, length);
|
string+start, length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user