Changed the offscreen-rendering handling in SetProjection to be

more like the Tk/X11 model than the OpenGL model, since Cairo
isn't picky about pixmaps.
This commit is contained in:
Tim Edwards 2017-09-01 09:12:02 -04:00
parent 21d558c67d
commit 37e7b7ffeb
2 changed files with 11 additions and 23 deletions

View File

@ -421,9 +421,6 @@ GrTCairoFlush ()
*---------------------------------------------------------
*/
//static GLXPixmap glpmap = None;
Pixmap cairopmap = (Pixmap)NULL;
#define glTransYs(n) (DisplayHeight(grXdpy, grXscrn)-(n))
/*
@ -436,28 +433,9 @@ void
tcairoSetProjection(llx, lly, width, height)
int llx, lly, width, height;
{
if (tcairoCurrent.mw->w_flags & WIND_OFFSCREEN)
{
/*
if (glpmap != None) glXDestroyGLXPixmap(grXdpy, glpmap);
glpmap = glXCreateGLXPixmap(grXdpy, grVisualInfo,
(Pixmap)tcairoCurrent.windowid);
glXMakeCurrent(grXdpy, (GLXDrawable)glpmap, grXcontext);
*/
cairopmap = XCreatePixmap(grXdpy, tcairoCurrent.windowid, width, height, tcairoCurrent.depth);
grCairoSurface = cairo_xlib_surface_create(grXdpy, cairopmap, grVisualInfo->visual, width, height);
}
else {
//glXMakeCurrent(grXdpy, (GLXDrawable)tcairoCurrent.windowid, grXcontext);
grCairoSurface = cairo_xlib_surface_create(grXdpy, tcairoCurrent.windowid, grVisualInfo->visual, Tk_Width(tcairoCurrent.window), Tk_Height(tcairoCurrent.window));
}
grCairoSurface = cairo_xlib_surface_create(grXdpy, tcairoCurrent.windowid, grVisualInfo->visual, width, height);
grCairoContext = cairo_create(grCairoSurface);
// #ifndef Cairo_SERVER_SIDE_ONLY
// For batch-processing lines and rectangles
// glEnableClientState(GL_VERTEX_ARRAY);
// #endif
/* Because this tends to result in thick lines, it has been moved */
/* the line drawing routine so it can be enabled for individual */
/* lines. */

View File

@ -470,10 +470,20 @@ grtcairoScrollBackingStore(MagWindow *w, Point *shift)
yshift = 0;
}
/*
XCopyArea(grXdpy, pmap, pmap, grXcopyGC, xorigin, yorigin, width, height,
xshift, yshift);
*/
/* TxPrintf("grx11ScrollBackingStore %d %d\n", shift->p_x, shift->p_y); */
cairo_surface_t *backingStoreSurface;
backingStoreSurface = cairo_xlib_surface_create(grXdpy, pmap, DefaultVisual(grXdpy, DefaultScreen(grXdpy)), width, height);
cairo_set_source_surface(grCairoContext, backingStoreSurface, xshift, yshift);
cairo_rectangle(grCairoContext, xorigin, yorigin, width, height);
cairo_set_operator(grCairoContext, CAIRO_OPERATOR_SOURCE);
cairo_fill(grCairoContext);
return TRUE;
}