Merge branch 'work' into tomerge
This commit is contained in:
commit
1610d28c72
|
|
@ -82,8 +82,6 @@ int nb;
|
||||||
cairo_move_to(tcairodata->context, lines[i].r_ll.p_x, lines[i].r_ll.p_y);
|
cairo_move_to(tcairodata->context, lines[i].r_ll.p_x, lines[i].r_ll.p_y);
|
||||||
cairo_line_to(tcairodata->context, lines[i].r_ur.p_x, lines[i].r_ur.p_y);
|
cairo_line_to(tcairodata->context, lines[i].r_ur.p_x, lines[i].r_ur.p_y);
|
||||||
}
|
}
|
||||||
// cairo_set_source_rgba(tcairodata->context, r, g, b, a);
|
|
||||||
// cairo_set_line_width(tcairodata->context, width);
|
|
||||||
cairo_stroke(tcairodata->context);
|
cairo_stroke(tcairodata->context);
|
||||||
cairo_restore(tcairodata->context);
|
cairo_restore(tcairodata->context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ GrTOGLFlush ()
|
||||||
*---------------------------------------------------------
|
*---------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static GLXPixmap glpmap = None;
|
static GLXPbuffer pbuffer = None;
|
||||||
|
|
||||||
#define glTransYs(n) (DisplayHeight(grXdpy, grXscrn)-(n))
|
#define glTransYs(n) (DisplayHeight(grXdpy, grXscrn)-(n))
|
||||||
|
|
||||||
|
|
@ -385,10 +385,23 @@ toglSetProjection(llx, lly, width, height)
|
||||||
{
|
{
|
||||||
if (toglCurrent.mw->w_flags & WIND_OFFSCREEN)
|
if (toglCurrent.mw->w_flags & WIND_OFFSCREEN)
|
||||||
{
|
{
|
||||||
if (glpmap != None) glXDestroyGLXPixmap(grXdpy, glpmap);
|
int count = 0;
|
||||||
glpmap = glXCreateGLXPixmap(grXdpy, grVisualInfo,
|
int PBattrib[] = {
|
||||||
(Pixmap)toglCurrent.windowid);
|
GLX_PBUFFER_WIDTH, width,
|
||||||
glXMakeCurrent(grXdpy, (GLXDrawable)glpmap, grXcontext);
|
GLX_PBUFFER_HEIGHT, height,
|
||||||
|
GLX_LARGEST_PBUFFER, False,
|
||||||
|
None
|
||||||
|
};
|
||||||
|
GLXFBConfig *config;
|
||||||
|
|
||||||
|
if (pbuffer != None) glXDestroyPbuffer(grXdpy, pbuffer);
|
||||||
|
config = glXGetFBConfigs(grXdpy, grXscrn, &count);
|
||||||
|
if (config != NULL && count != 0)
|
||||||
|
{
|
||||||
|
pbuffer = glXCreatePbuffer(grXdpy, config[0], PBattrib);
|
||||||
|
glXMakeCurrent(grXdpy, (GLXDrawable)pbuffer, grXcontext);
|
||||||
|
}
|
||||||
|
if (config != NULL) XFree(config);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
glXMakeCurrent(grXdpy, (GLXDrawable)toglCurrent.windowid, grXcontext);
|
glXMakeCurrent(grXdpy, (GLXDrawable)toglCurrent.windowid, grXcontext);
|
||||||
|
|
@ -423,6 +436,9 @@ toglSetProjection(llx, lly, width, height)
|
||||||
|
|
||||||
glTranslated(-(GLsizei)(width >> 1), -(GLsizei)(height >> 1), 0);
|
glTranslated(-(GLsizei)(width >> 1), -(GLsizei)(height >> 1), 0);
|
||||||
|
|
||||||
|
if (toglCurrent.mw->w_flags & WIND_OFFSCREEN)
|
||||||
|
glTranslatef((float)0.5, (float)0.5, 0);
|
||||||
|
|
||||||
/* Remaining transformations are done on the modelview matrix */
|
/* Remaining transformations are done on the modelview matrix */
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
@ -1326,12 +1342,63 @@ void
|
||||||
GrTOGLUnlock(w)
|
GrTOGLUnlock(w)
|
||||||
MagWindow *w;
|
MagWindow *w;
|
||||||
{
|
{
|
||||||
/* GR_TOGL_FLUSH_BATCH(); */
|
GrTOGLFlush();
|
||||||
GrTOGLFlush(); /* (?) Adds glFlush and glFinish to the above. */
|
|
||||||
|
if ((w != GR_LOCK_SCREEN) && (w->w_flags & WIND_OFFSCREEN))
|
||||||
|
{
|
||||||
|
GC grXcopyGC;
|
||||||
|
XGCValues gcValues;
|
||||||
|
unsigned char *pdata, *tdata;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
Window root_return;
|
||||||
|
int x_return, y_return;
|
||||||
|
unsigned int pbwidth, pbheight, wborder, depth;
|
||||||
|
|
||||||
|
XGetGeometry(grXdpy, (Drawable)toglCurrent.windowid, &root_return,
|
||||||
|
&x_return, &y_return, &pbwidth, &pbheight, &wborder, &depth);
|
||||||
|
|
||||||
|
pdata = (unsigned char *)mallocMagic((pbwidth * pbheight * 3)
|
||||||
|
* sizeof(unsigned int));
|
||||||
|
|
||||||
|
/* In offscreen-rendering mode, copy Pbuffer back to window */
|
||||||
|
glReadBuffer(GL_FRONT);
|
||||||
|
glReadPixels(0, 0, pbwidth, pbheight, GL_RGB, GL_UNSIGNED_BYTE, pdata);
|
||||||
|
|
||||||
|
gcValues.graphics_exposures = FALSE;
|
||||||
|
grXcopyGC = XCreateGC(grXdpy, (Drawable)toglCurrent.windowid,
|
||||||
|
GCGraphicsExposures, &gcValues);
|
||||||
|
|
||||||
|
/* This is very slow, but the only way I've found to copy data */
|
||||||
|
/* from a Pbuffer into a Pixmap. It is only used to make the */
|
||||||
|
/* icon images for the toolbar, so it does not need to be */
|
||||||
|
/* efficient. */
|
||||||
|
|
||||||
|
tdata = pdata;
|
||||||
|
for (i = 0; i < pbwidth; i++) {
|
||||||
|
for (j = 0; j < pbheight; j++)
|
||||||
|
{
|
||||||
|
unsigned long pcolor;
|
||||||
|
pcolor = *tdata++;
|
||||||
|
pcolor <<= 8;
|
||||||
|
pcolor |= *tdata++;
|
||||||
|
pcolor <<= 8;
|
||||||
|
pcolor |= *tdata++;
|
||||||
|
XSetForeground(grXdpy, grXcopyGC, pcolor);
|
||||||
|
XDrawPoint(grXdpy, (Drawable)toglCurrent.windowid, grXcopyGC,
|
||||||
|
pbwidth - i - 1, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
freeMagic(pdata);
|
||||||
|
XFreeGC(grXdpy, grXcopyGC);
|
||||||
|
}
|
||||||
|
|
||||||
grSimpleUnlock(w);
|
grSimpleUnlock(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
* GrTOGLEventPending --
|
* GrTOGLEventPending --
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue