Corrected an error that prevents the compile option

"--enable-cairo-offscreen" from working.  Because the option
does not run the full Cario initialization, the grTCairoVisualInfo
is not set, and the first attempt to create a Cairo surface
fails with a segfault.
This commit is contained in:
Tim Edwards 2018-09-13 10:19:48 -04:00
parent fe765bb006
commit 54e6171e9c
1 changed files with 19 additions and 0 deletions

View File

@ -363,6 +363,25 @@ int llx, lly, width, height;
/* surface and context, so we need to make them. */
if (tcairodata == NULL) {
/* For OpenGL using Cairo for off-screen rendering, */
/* grTCairoVisualInfo may be NULL and need to be set. */
if (grTCairoVisualInfo == NULL)
{
XVisualInfo grtemplate;
int gritems;
grtemplate.screen = grXscrn;
grtemplate.depth = 0;
grTCairoVisualInfo = XGetVisualInfo(grXdpy, VisualScreenMask,
&grtemplate, &gritems);
if (!grTCairoVisualInfo)
{
TxError("No suitable visual!\n");
return;
}
}
tcairodata = (TCairoData *)mallocMagic(sizeof(TCairoData));
tcairodata->surface = cairo_xlib_surface_create(grXdpy,
tcairoCurrent.windowid, grTCairoVisualInfo->visual,