Merge branch 'work' into tomerge
This commit is contained in:
commit
e42508b5eb
4
defs.mak
4
defs.mak
|
|
@ -61,14 +61,14 @@ LIB_SPECS = -L/usr/lib64 -ltk8.6 -L/usr/lib64 -ltcl8.6
|
|||
WISH_EXE = /usr/bin/wish
|
||||
TCL_LIB_DIR = /usr/lib
|
||||
MAGIC_VERSION = 8.2
|
||||
MAGIC_REVISION = 27
|
||||
MAGIC_REVISION = 29
|
||||
|
||||
CC = gcc
|
||||
CPP = gcc -E
|
||||
CXX = g++
|
||||
|
||||
CPPFLAGS = -I. -I${MAGICDIR}
|
||||
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"27\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DCAIRO_OFFSCREEN_RENDER=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
|
||||
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"29\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
|
||||
DFLAGS += -DSHDLIB_EXT=\".so\"
|
||||
CFLAGS = -g -m64 -fPIC -Wimplicit-int -fPIC
|
||||
|
||||
|
|
|
|||
|
|
@ -562,7 +562,9 @@ pipehandler()
|
|||
if (mw->w_backingStore != (ClientData)NULL)
|
||||
{
|
||||
Rect surface;
|
||||
(*GrLockPtr)(mw, FALSE);
|
||||
(*GrGetBackingStorePtr)(mw, &screenRect);
|
||||
(*GrUnlockPtr)(mw);
|
||||
WindScreenToSurface(mw, &screenRect, &surface);
|
||||
DBWHLRedrawPrepWindow(mw, &surface);
|
||||
WindDrawBorder(mw, &screenRect);
|
||||
|
|
|
|||
|
|
@ -816,7 +816,9 @@ keys_and_buttons:
|
|||
if (mw->w_backingStore != (ClientData)NULL)
|
||||
{
|
||||
Rect surface;
|
||||
(*GrLockPtr)(mw, FALSE);
|
||||
(*GrGetBackingStorePtr)(mw, &screenRect);
|
||||
(*GrUnlockPtr)(mw);
|
||||
WindScreenToSurface(mw, &screenRect, &surface);
|
||||
DBWHLRedrawPrepWindow(mw, &surface);
|
||||
WindDrawBorder(mw, &screenRect);
|
||||
|
|
|
|||
|
|
@ -299,9 +299,28 @@ GrTOGLInit ()
|
|||
grXscrn = grVisualInfo->screen;
|
||||
toglCurrent.depth = grVisualInfo->depth;
|
||||
|
||||
/* TRUE = Direct rendering, FALSE = Indirect rendering */
|
||||
/* (note that direct rendering may not be able to deal with pixmaps) */
|
||||
/* glXCreateContext() 4th argument: */
|
||||
/* TRUE = Direct rendering, FALSE = Indirect rendering */
|
||||
|
||||
/* Direct rendering may not be able to deal with pixmaps. */
|
||||
/* Normally, magic should compile with OpenGL framebuffer */
|
||||
/* backing store and pbuffer offscreen rendering. However, */
|
||||
/* if X11_BACKING_STORE is selected then force indirect */
|
||||
/* rendering. This can be avoided if the backing store */
|
||||
/* functions sync between OpenGL and X11; this has not */
|
||||
/* been done yet. */
|
||||
|
||||
/* The CAIRO_OFFSCREEN_RENDER compile-time option uses */
|
||||
/* Cairo to do the off-screen rendering, which allows */
|
||||
/* OpenGL to run in direct-rendering mode only. To do: */
|
||||
/* determine from OpenGL attributes if indirect rendering */
|
||||
/* is allowed, and handle automatically. */
|
||||
|
||||
#ifdef X11_BACKING_STORE
|
||||
grXcontext = glXCreateContext(grXdpy, grVisualInfo, NULL, GL_FALSE);
|
||||
#else
|
||||
grXcontext = glXCreateContext(grXdpy, grVisualInfo, NULL, GL_TRUE);
|
||||
#endif
|
||||
|
||||
/* Basic GL parameters */
|
||||
|
||||
|
|
@ -868,7 +887,9 @@ keys_and_buttons:
|
|||
if (mw->w_backingStore != (ClientData)NULL)
|
||||
{
|
||||
Rect surface;
|
||||
(*GrLockPtr)(mw, FALSE);
|
||||
(*GrGetBackingStorePtr)(mw, &screenRect);
|
||||
(*GrUnlockPtr)(mw);
|
||||
WindScreenToSurface(mw, &screenRect, &surface);
|
||||
DBWHLRedrawPrepWindow(mw, &surface);
|
||||
WindDrawBorder(mw, &screenRect);
|
||||
|
|
@ -898,8 +919,6 @@ keys_and_buttons:
|
|||
void
|
||||
toglOnScreen()
|
||||
{
|
||||
// GrLockPtr = GrTOGLLock;
|
||||
// GrUnlockPtr = GrTOGLUnlock;
|
||||
GrSetCMapPtr = GrTOGLSetCMap;
|
||||
GrFlushPtr = GrTOGLFlush;
|
||||
|
||||
|
|
@ -1377,7 +1396,6 @@ void
|
|||
GrTOGLUnlock(w)
|
||||
MagWindow *w;
|
||||
{
|
||||
GrTOGLFlush();
|
||||
|
||||
#ifdef CAIRO_OFFSCREEN_RENDER
|
||||
/* Use Cairo graphics for off-screen rendering */
|
||||
|
|
@ -1390,6 +1408,8 @@ GrTOGLUnlock(w)
|
|||
}
|
||||
#endif
|
||||
|
||||
GrTOGLFlush();
|
||||
|
||||
if ((w != GR_LOCK_SCREEN) && (w->w_flags & WIND_OFFSCREEN))
|
||||
{
|
||||
GC grXcopyGC;
|
||||
|
|
@ -1439,7 +1459,6 @@ GrTOGLUnlock(w)
|
|||
freeMagic(pdata);
|
||||
XFreeGC(grXdpy, grXcopyGC);
|
||||
}
|
||||
|
||||
grSimpleUnlock(w);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ extern Display *grXdpy;
|
|||
|
||||
GLuint grXBases[4];
|
||||
|
||||
typedef struct {
|
||||
GLuint framebuffer;
|
||||
GLuint renderbuffer;
|
||||
} RenderFrame;
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglDrawGrid:
|
||||
|
|
@ -241,15 +246,24 @@ GrTOGLTextSize(text, size, r)
|
|||
/* backing store contains valid data or not. */
|
||||
|
||||
void
|
||||
grtoglFreeBackingStore(MagWindow *window)
|
||||
grtoglFreeBackingStore(MagWindow *w)
|
||||
{
|
||||
window->w_backingStore = (ClientData)0;
|
||||
RenderFrame *rf;
|
||||
|
||||
rf = (RenderFrame *)w->w_backingStore;
|
||||
glDeleteFramebuffers(1, &rf->framebuffer);
|
||||
glDeleteRenderbuffers(1, &rf->renderbuffer);
|
||||
freeMagic(w->w_backingStore);
|
||||
w->w_backingStore = (ClientData)0;
|
||||
}
|
||||
|
||||
void
|
||||
grtoglCreateBackingStore(MagWindow *w)
|
||||
{
|
||||
RenderFrame *rf;
|
||||
|
||||
Tk_Window tkwind = (Tk_Window)w->w_grdata;
|
||||
unsigned int width, height;
|
||||
|
||||
/* ignore all windows other than layout */
|
||||
if (w->w_client != DBWclientID) return;
|
||||
|
|
@ -257,19 +271,33 @@ grtoglCreateBackingStore(MagWindow *w)
|
|||
/* Deferred */
|
||||
if (tkwind == NULL) return;
|
||||
|
||||
w->w_backingStore = (ClientData)1;
|
||||
width = w->w_screenArea.r_xtop - w->w_screenArea.r_xbot;
|
||||
height = w->w_screenArea.r_ytop - w->w_screenArea.r_ybot;
|
||||
|
||||
rf = (RenderFrame *)w->w_backingStore;
|
||||
if (rf != (ClientData)NULL) {
|
||||
glDeleteFramebuffers(1, &rf->framebuffer);
|
||||
glDeleteRenderbuffers(1, &rf->renderbuffer);
|
||||
}
|
||||
else {
|
||||
rf = (RenderFrame *)mallocMagic(sizeof(RenderFrame));
|
||||
w->w_backingStore = (ClientData)rf;
|
||||
}
|
||||
|
||||
glGenFramebuffers(1, &rf->framebuffer);
|
||||
glGenRenderbuffers(1, &rf->renderbuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, rf->renderbuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB, width, height);
|
||||
}
|
||||
|
||||
bool
|
||||
grtoglGetBackingStore(MagWindow *w, Rect *area)
|
||||
{
|
||||
RenderFrame *rf;
|
||||
unsigned int width, height;
|
||||
int xbot, ybot;
|
||||
Rect r;
|
||||
|
||||
// GLboolean result;
|
||||
// GLint rasterpos[4];
|
||||
|
||||
if (w->w_backingStore == (ClientData)0) return FALSE;
|
||||
|
||||
GEO_EXPAND(area, 1, &r);
|
||||
|
|
@ -281,22 +309,20 @@ grtoglGetBackingStore(MagWindow *w, Rect *area)
|
|||
xbot = r.r_xbot;
|
||||
ybot = r.r_ybot;
|
||||
|
||||
rf = (RenderFrame *)w->w_backingStore;
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, rf->framebuffer);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, rf->renderbuffer);
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_BACK);
|
||||
glRasterPos2i((GLint)xbot, (GLint)ybot);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
|
||||
/* Check for valid raster position */
|
||||
// glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, (GLboolean *)(&result));
|
||||
// glGetIntegerv(GL_CURRENT_RASTER_POSITION, (GLint *)(&rasterpos[0]));
|
||||
|
||||
// TxPrintf("Raster valid = %d, position = %d %d %d %d\n",
|
||||
// (int)result, (int)rasterpos[0], (int)rasterpos[1],
|
||||
// (int)rasterpos[2], (int)rasterpos[3]);
|
||||
// if (result == 0)
|
||||
// TxPrintf("Intended position = %d %d\n", xbot, ybot);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glCopyPixels(xbot, ybot, width, height, GL_COLOR);
|
||||
glBlitFramebuffer(r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -305,12 +331,14 @@ grtoglGetBackingStore(MagWindow *w, Rect *area)
|
|||
bool
|
||||
grtoglScrollBackingStore(MagWindow *w, Point *shift)
|
||||
{
|
||||
RenderFrame *rf;
|
||||
GLuint FramebufferName, RenderbufferName;
|
||||
unsigned int width, height;
|
||||
int xorigin, yorigin, xshift, yshift;
|
||||
|
||||
if (w->w_backingStore == (ClientData)0)
|
||||
{
|
||||
TxPrintf("grtoglScrollBackingStore %d %d failure\n",
|
||||
fprintf(stdout, "grtoglScrollBackingStore %d %d failure\n",
|
||||
shift->p_x, shift->p_y);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -339,13 +367,23 @@ grtoglScrollBackingStore(MagWindow *w, Point *shift)
|
|||
yshift = 0;
|
||||
}
|
||||
|
||||
glDrawBuffer(GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
glRasterPos2i((GLint)xshift, (GLint)yshift);
|
||||
glDisable(GL_BLEND);
|
||||
glCopyPixels(xorigin, yorigin, width, height, GL_COLOR);
|
||||
rf = (RenderFrame *)w->w_backingStore;
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, rf->framebuffer);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, rf->renderbuffer);
|
||||
|
||||
glBlitFramebuffer(xorigin, yorigin, xorigin + width, yorigin + height,
|
||||
xshift, yshift, xshift + width, yshift + height,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, rf->framebuffer);
|
||||
glBlitFramebuffer(xshift, yshift, xshift + width, yshift + height,
|
||||
xshift, yshift, xshift + width, yshift + height,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -353,48 +391,41 @@ grtoglScrollBackingStore(MagWindow *w, Point *shift)
|
|||
void
|
||||
grtoglPutBackingStore(MagWindow *w, Rect *area)
|
||||
{
|
||||
RenderFrame *rf;
|
||||
GLuint FramebufferName, RenderbufferName;
|
||||
unsigned int width, height;
|
||||
int ybot, xbot;
|
||||
|
||||
// GLboolean result;
|
||||
// GLint rasterpos[4];
|
||||
Rect r;
|
||||
|
||||
if (w->w_backingStore == (ClientData)0) return;
|
||||
|
||||
width = area->r_xtop - area->r_xbot;
|
||||
height = area->r_ytop - area->r_ybot;
|
||||
|
||||
ybot = area->r_ybot;
|
||||
xbot = area->r_xbot;
|
||||
|
||||
if (xbot < 0) {
|
||||
width -= xbot;
|
||||
xbot = 0;
|
||||
if (w->w_flags & WIND_OBSCURED)
|
||||
{
|
||||
grtoglFreeBackingStore(w);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ybot < 0) {
|
||||
height -= ybot;
|
||||
ybot = 0;
|
||||
}
|
||||
GEO_EXPAND(area, 1, &r);
|
||||
GeoClip(&r, &(w->w_screenArea));
|
||||
|
||||
width = r.r_xtop - r.r_xbot;
|
||||
height = r.r_ytop - r.r_ybot;
|
||||
ybot = r.r_ybot;
|
||||
xbot = r.r_xbot;
|
||||
|
||||
rf = (RenderFrame *)w->w_backingStore;
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, rf->framebuffer);
|
||||
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, rf->renderbuffer);
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glReadBuffer(GL_FRONT);
|
||||
glDrawBuffer(GL_BACK);
|
||||
glRasterPos2i((GLint)xbot, (GLint)ybot);
|
||||
|
||||
/* Check for valid raster position */
|
||||
// glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, (GLboolean *)(&result));
|
||||
// glGetIntegerv(GL_CURRENT_RASTER_POSITION, (GLint *)(&rasterpos[0]));
|
||||
|
||||
// TxPrintf("Raster valid = %d, position = %d %d %d %d\n",
|
||||
// (int)result, (int)rasterpos[0], (int)rasterpos[1],
|
||||
// (int)rasterpos[2], (int)rasterpos[3]);
|
||||
// if (result == 0)
|
||||
// TxPrintf("Intended position = %d %d\n", xbot, ybot);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glCopyPixels(xbot, ybot, width, height, GL_COLOR);
|
||||
|
||||
glDrawBuffer(GL_FRONT); /* Return to normal front rendering */
|
||||
glBlitFramebuffer(r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,804 @@
|
|||
/* grTOGL3.c -
|
||||
*
|
||||
* Copyright 2003 Open Circuit Design, Inc., for MultiGiG Ltd.
|
||||
*
|
||||
* This file contains additional functions to manipulate an X window system
|
||||
* color display. Included here are device-dependent routines to draw and
|
||||
* erase text and draw a grid.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "utils/malloc.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
#include "graphics/graphicsInt.h"
|
||||
#include "dbwind/dbwind.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/signals.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/hash.h"
|
||||
#include "graphics/grTOGLInt.h"
|
||||
#include "graphics/grTkCommon.h"
|
||||
#include "database/fonts.h"
|
||||
|
||||
extern Display *grXdpy;
|
||||
|
||||
/* locals */
|
||||
|
||||
GLuint grXBases[4];
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglDrawGrid:
|
||||
* grxDrawGrid adds a grid to the grid layer, using the current
|
||||
* write mask and color.
|
||||
*
|
||||
* Results:
|
||||
* TRUE is returned normally. However, if the grid gets too small
|
||||
* to be useful, then nothing is drawn and FALSE is returned.
|
||||
*
|
||||
* Side Effects: None.
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
bool
|
||||
grtoglDrawGrid (prect, outline, clip)
|
||||
Rect *prect; /* A rectangle that forms the template
|
||||
* for the grid. Note: in order to maintain
|
||||
* precision for the grid, the rectangle
|
||||
* coordinates are specified in units of
|
||||
* screen coordinates multiplied by SUBPIXEL.
|
||||
*/
|
||||
int outline; /* the outline style */
|
||||
Rect *clip; /* a clipping rectangle */
|
||||
{
|
||||
int xsize, ysize;
|
||||
int x, y;
|
||||
int xstart, ystart;
|
||||
int snum, low, hi, shifted;
|
||||
|
||||
xsize = prect->r_xtop - prect->r_xbot;
|
||||
ysize = prect->r_ytop - prect->r_ybot;
|
||||
if (!xsize || !ysize || GRID_TOO_SMALL(xsize, ysize))
|
||||
return FALSE;
|
||||
|
||||
xstart = prect->r_xbot % xsize;
|
||||
while (xstart < clip->r_xbot << SUBPIXELBITS) xstart += xsize;
|
||||
ystart = prect->r_ybot % ysize;
|
||||
while (ystart < clip->r_ybot << SUBPIXELBITS) ystart += ysize;
|
||||
|
||||
grtoglSetLineStyle(outline);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
|
||||
snum = 0;
|
||||
low = clip->r_ybot;
|
||||
hi = clip->r_ytop;
|
||||
for (x = xstart; x < (clip->r_xtop+1) << SUBPIXELBITS; x += xsize)
|
||||
{
|
||||
shifted = x >> SUBPIXELBITS;
|
||||
glVertex2i(shifted, low);
|
||||
glVertex2i(shifted, hi);
|
||||
snum++;
|
||||
}
|
||||
|
||||
snum = 0;
|
||||
low = clip->r_xbot;
|
||||
hi = clip->r_xtop;
|
||||
for (y = ystart; y < (clip->r_ytop+1) << SUBPIXELBITS; y += ysize)
|
||||
{
|
||||
shifted = y >> SUBPIXELBITS;
|
||||
glVertex2i(low, shifted);
|
||||
glVertex2i(hi, shifted);
|
||||
snum++;
|
||||
}
|
||||
glEnd();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglLoadFont
|
||||
* This local routine transfers the X font bitmaps
|
||||
* into OpenGL display lists for simple text
|
||||
* rendering.
|
||||
*
|
||||
* Results: Success/Failure
|
||||
*
|
||||
* Side Effects: None.
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
bool
|
||||
grtoglLoadFont()
|
||||
{
|
||||
Font id;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
id = Tk_FontId(grTkFonts[i]);
|
||||
|
||||
grXBases[i] = glGenLists(256);
|
||||
if (grXBases[i] == 0) {
|
||||
TxError("Out of display lists!\n");
|
||||
return FALSE;
|
||||
}
|
||||
glXUseXFont(id, 0, 256, grXBases[i]);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglSetCharSize:
|
||||
* This local routine sets the character size in the display,
|
||||
* if necessary.
|
||||
*
|
||||
* Results: None.
|
||||
*
|
||||
* Side Effects: None.
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglSetCharSize (size)
|
||||
int size; /* Width of characters, in pixels (6 or 8). */
|
||||
{
|
||||
toglCurrent.fontSize = size;
|
||||
switch (size)
|
||||
{
|
||||
case GR_TEXT_DEFAULT:
|
||||
case GR_TEXT_SMALL:
|
||||
toglCurrent.font = grSmallFont;
|
||||
break;
|
||||
case GR_TEXT_MEDIUM:
|
||||
toglCurrent.font = grMediumFont;
|
||||
break;
|
||||
case GR_TEXT_LARGE:
|
||||
toglCurrent.font = grLargeFont;
|
||||
break;
|
||||
case GR_TEXT_XLARGE:
|
||||
toglCurrent.font = grXLargeFont;
|
||||
break;
|
||||
default:
|
||||
TxError("%s%d\n", "grtoglSetCharSize: Unknown character size ",
|
||||
size );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* GrTOGLTextSize --
|
||||
*
|
||||
* Determine the size of a text string.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* A rectangle is filled in that is the size of the text in pixels.
|
||||
* The origin (0, 0) of this rectangle is located on the baseline
|
||||
* at the far left side of the string.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
GrTOGLTextSize(text, size, r)
|
||||
char *text;
|
||||
int size;
|
||||
Rect *r;
|
||||
{
|
||||
Tk_FontMetrics overall;
|
||||
Tk_Font font;
|
||||
int width;
|
||||
|
||||
switch (size) {
|
||||
case GR_TEXT_DEFAULT:
|
||||
case GR_TEXT_SMALL:
|
||||
font = grSmallFont;
|
||||
break;
|
||||
case GR_TEXT_MEDIUM:
|
||||
font = grMediumFont;
|
||||
break;
|
||||
case GR_TEXT_LARGE:
|
||||
font = grLargeFont;
|
||||
break;
|
||||
case GR_TEXT_XLARGE:
|
||||
font = grXLargeFont;
|
||||
break;
|
||||
default:
|
||||
TxError("%s%d\n", "GrTOGLTextSize: Unknown character size ",
|
||||
size );
|
||||
break;
|
||||
}
|
||||
if (font == NULL) return;
|
||||
Tk_GetFontMetrics(font, &overall);
|
||||
width = Tk_TextWidth(font, text, strlen(text));
|
||||
/* Hack alert! Tk_TextWidth returns values too small! */
|
||||
width = width + (width >> 4);
|
||||
r->r_ytop = overall.ascent;
|
||||
r->r_ybot = -overall.descent;
|
||||
r->r_xtop = width;
|
||||
r->r_xbot = 0;
|
||||
}
|
||||
|
||||
static GLuint FramebufferName = 0;
|
||||
|
||||
/* OpenGL backing store functions (now removed from the X11-based ones) */
|
||||
/* Since we always paint into the front buffer, the back buffer is */
|
||||
/* always available for backing store. We need not create or destroy */
|
||||
/* it. We just use the w_backingStore location to store whether the */
|
||||
/* backing store contains valid data or not. */
|
||||
|
||||
void
|
||||
grtoglFreeBackingStore(MagWindow *window)
|
||||
{
|
||||
GLuint RenderbufferName;
|
||||
|
||||
RenderbufferName = (GLuint)window->w_backingStore;
|
||||
glDeleteRenderbuffers(1, &RenderbufferName);
|
||||
window->w_backingStore = (ClientData)0;
|
||||
}
|
||||
|
||||
void
|
||||
grtoglCreateBackingStore(MagWindow *w)
|
||||
{
|
||||
GLuint RenderbufferName;
|
||||
Tk_Window tkwind = (Tk_Window)w->w_grdata;
|
||||
unsigned int width, height;
|
||||
|
||||
/* ignore all windows other than layout */
|
||||
if (w->w_client != DBWclientID) return;
|
||||
|
||||
/* Deferred */
|
||||
if (tkwind == NULL) return;
|
||||
|
||||
width = w->w_screenArea.r_xtop - w->w_screenArea.r_xbot;
|
||||
height = w->w_screenArea.r_ytop - w->w_screenArea.r_ybot;
|
||||
|
||||
/* Do this only once */
|
||||
if (FramebufferName == 0) {
|
||||
glGenFramebuffers(1, &FramebufferName);
|
||||
}
|
||||
|
||||
RenderbufferName = (GLuint)(w->w_backingStore);
|
||||
if (RenderbufferName != 0) {
|
||||
glDeleteRenderbuffers(1, &RenderbufferName);
|
||||
}
|
||||
|
||||
glGenRenderbuffers(1, &RenderbufferName);
|
||||
TxPrintf("create: Renderbuffer is %d\n", RenderbufferName);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, RenderbufferName);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB, width, height);
|
||||
w->w_backingStore = (ClientData)RenderbufferName;
|
||||
}
|
||||
|
||||
bool
|
||||
grtoglGetBackingStore(MagWindow *w, Rect *area)
|
||||
{
|
||||
GLuint RenderbufferName;
|
||||
unsigned int width, height;
|
||||
int xbot, ybot;
|
||||
Rect r;
|
||||
|
||||
// GLboolean result;
|
||||
// GLint rasterpos[4];
|
||||
|
||||
if (w->w_backingStore == (ClientData)0) return FALSE;
|
||||
|
||||
GEO_EXPAND(area, 1, &r);
|
||||
GeoClip(&r, &(w->w_screenArea));
|
||||
|
||||
width = r.r_xtop - r.r_xbot;
|
||||
height = r.r_ytop - r.r_ybot;
|
||||
|
||||
xbot = r.r_xbot;
|
||||
ybot = r.r_ybot;
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferName);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
RenderbufferName = (GLuint)w->w_backingStore;
|
||||
TxPrintf("get: Renderbuffer is %d\n", RenderbufferName);
|
||||
glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, RenderbufferName);
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
|
||||
// glDrawBuffer(GL_FRONT);
|
||||
// glReadBuffer(GL_BACK);
|
||||
// glRasterPos2i((GLint)xbot, (GLint)ybot);
|
||||
|
||||
/* Check for valid raster position */
|
||||
// glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, (GLboolean *)(&result));
|
||||
// glGetIntegerv(GL_CURRENT_RASTER_POSITION, (GLint *)(&rasterpos[0]));
|
||||
|
||||
// TxPrintf("Raster valid = %d, position = %d %d %d %d\n",
|
||||
// (int)result, (int)rasterpos[0], (int)rasterpos[1],
|
||||
// (int)rasterpos[2], (int)rasterpos[3]);
|
||||
// if (result == 0)
|
||||
// TxPrintf("Intended position = %d %d\n", xbot, ybot);
|
||||
|
||||
// glDisable(GL_BLEND);
|
||||
// glCopyPixels(xbot, ybot, width, height, GL_COLOR);
|
||||
|
||||
glBlitFramebuffer(r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
grtoglScrollBackingStore(MagWindow *w, Point *shift)
|
||||
{
|
||||
GLuint RenderbufferName;
|
||||
unsigned int width, height;
|
||||
int xorigin, yorigin, xshift, yshift;
|
||||
|
||||
if (w->w_backingStore == (ClientData)0)
|
||||
{
|
||||
TxPrintf("grtoglScrollBackingStore %d %d failure\n",
|
||||
shift->p_x, shift->p_y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
width = w->w_screenArea.r_xtop - w->w_screenArea.r_xbot;
|
||||
height = w->w_screenArea.r_ytop - w->w_screenArea.r_ybot;
|
||||
xorigin = 0;
|
||||
yorigin = 0;
|
||||
xshift = shift->p_x;
|
||||
yshift = shift->p_y;
|
||||
|
||||
if (xshift > 0)
|
||||
width -= xshift;
|
||||
else if (xshift < 0)
|
||||
{
|
||||
width += xshift;
|
||||
xorigin = -xshift;
|
||||
xshift = 0;
|
||||
}
|
||||
if (yshift > 0)
|
||||
height -= yshift;
|
||||
else if (yshift < 0)
|
||||
{
|
||||
height += yshift;
|
||||
yorigin = -yshift;
|
||||
yshift = 0;
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferName);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
RenderbufferName = (GLuint)w->w_backingStore;
|
||||
TxPrintf("scroll: Renderbuffer is %d\n", RenderbufferName);
|
||||
glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, RenderbufferName);
|
||||
|
||||
|
||||
// glDrawBuffer(GL_BACK);
|
||||
// glReadBuffer(GL_BACK);
|
||||
// glRasterPos2i((GLint)xshift, (GLint)yshift);
|
||||
// glDisable(GL_BLEND);
|
||||
// glCopyPixels(xorigin, yorigin, width, height, GL_COLOR);
|
||||
|
||||
glBlitFramebuffer(xorigin, yorigin, xorigin + width, yorigin + height,
|
||||
xshift, yshift, xshift + width, yshift + height,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
|
||||
/*
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferName);
|
||||
|
||||
glBlitFramebuffer(xshift, yshift, xshift + width, yshift + height,
|
||||
xshift, yshift, xshift + width, yshift + height,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
*/
|
||||
// glDrawBuffer(GL_FRONT);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
grtoglPutBackingStore(MagWindow *w, Rect *area)
|
||||
{
|
||||
GLuint RenderbufferName;
|
||||
unsigned int width, height;
|
||||
int ybot, xbot;
|
||||
Rect r;
|
||||
|
||||
// GLboolean result;
|
||||
// GLint rasterpos[4];
|
||||
|
||||
if (w->w_backingStore == (ClientData)0) return;
|
||||
|
||||
GEO_EXPAND(area, 1, &r);
|
||||
GeoClip(&r, &(w->w_screenArea));
|
||||
|
||||
/*
|
||||
width = area->r_xtop - area->r_xbot;
|
||||
height = area->r_ytop - area->r_ybot;
|
||||
|
||||
ybot = area->r_ybot;
|
||||
xbot = area->r_xbot;
|
||||
*/
|
||||
|
||||
width = r.r_xtop - r.r_xbot;
|
||||
height = r.r_ytop - r.r_ybot;
|
||||
ybot = r.r_ybot;
|
||||
xbot = r.r_xbot;
|
||||
|
||||
/*
|
||||
if (xbot < 0) {
|
||||
width -= xbot;
|
||||
xbot = 0;
|
||||
}
|
||||
|
||||
if (ybot < 0) {
|
||||
height -= ybot;
|
||||
ybot = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferName);
|
||||
|
||||
RenderbufferName = (GLuint)w->w_backingStore;
|
||||
TxPrintf("put: Renderbuffer is %d\n", RenderbufferName);
|
||||
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, RenderbufferName);
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glReadBuffer(GL_FRONT);
|
||||
// glReadBuffer(GL_FRONT);
|
||||
// glDrawBuffer(GL_BACK);
|
||||
// glRasterPos2i((GLint)xbot, (GLint)ybot);
|
||||
|
||||
/* Check for valid raster position */
|
||||
// glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, (GLboolean *)(&result));
|
||||
// glGetIntegerv(GL_CURRENT_RASTER_POSITION, (GLint *)(&rasterpos[0]));
|
||||
|
||||
// TxPrintf("Raster valid = %d, position = %d %d %d %d\n",
|
||||
// (int)result, (int)rasterpos[0], (int)rasterpos[1],
|
||||
// (int)rasterpos[2], (int)rasterpos[3]);
|
||||
// if (result == 0)
|
||||
// TxPrintf("Intended position = %d %d\n", xbot, ybot);
|
||||
|
||||
/* This area may need to be expanded by a pixel and/or */
|
||||
/* expanded by GrPixelCorrect to compensate for the OpenGL */
|
||||
/* coordinate system. */
|
||||
|
||||
// glDisable(GL_BLEND);
|
||||
// glCopyPixels(xbot, ybot, width, height, GL_COLOR);
|
||||
|
||||
glBlitFramebuffer(r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
r.r_xbot, r.r_ybot, r.r_xtop, r.r_ytop,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
// glDrawBuffer(GL_FRONT); /* Return to normal front rendering */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* GrTOGLReadPixel --
|
||||
*
|
||||
* Read one pixel from the screen.
|
||||
*
|
||||
* Results:
|
||||
* An integer containing the pixel's color.
|
||||
*
|
||||
* Side effects:
|
||||
* none.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
GrTOGLReadPixel (w, x, y)
|
||||
MagWindow *w;
|
||||
int x,y; /* the location of a pixel in screen coords */
|
||||
{
|
||||
return 0; /* OpenGL has no such function, so return 0 */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* GrTOGLBitBlt --
|
||||
*
|
||||
* Copy information in bit block transfers.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* changes the screen.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
GrTOGLBitBlt(r, p)
|
||||
Rect *r;
|
||||
Point *p;
|
||||
{
|
||||
glCopyPixels(r->r_xbot, r->r_ybot, r->r_xtop - r->r_xbot + 1,
|
||||
r->r_ytop - r->r_ybot + 1, GL_COLOR);
|
||||
}
|
||||
|
||||
#ifdef VECTOR_FONTS
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Technically, there should be no self-intersecting polygons in outline
|
||||
* fonts. However, decomposition of bezier curves into line segments
|
||||
* may occasionally produce one, so it needs to be handled.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
myCombine(GLdouble coords[3], GLdouble *vertex_data[4],
|
||||
GLfloat weight[4], GLdouble **outData, void *dataptr)
|
||||
{
|
||||
/* This needs to be free'd at the end of gluTessEndPolygon()! */
|
||||
GLdouble *new = (GLdouble *)mallocMagic(2 * sizeof(GLdouble));
|
||||
new[0] = coords[0];
|
||||
new[1] = coords[1];
|
||||
*outData = new;
|
||||
/* Diagnostic */
|
||||
TxError("Intersecting polygon in char \"%c\" at %g %g!\n",
|
||||
*((char *)dataptr), coords[0], coords[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
* Draw a text character
|
||||
* This routine differs from grtoglFillPolygon() in that it uses the
|
||||
* glu library to handle non-convex polygons as may appear in font
|
||||
* outlines.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglDrawCharacter(clist, tc, pixsize)
|
||||
FontChar *clist;
|
||||
unsigned char tc;
|
||||
int pixsize;
|
||||
{
|
||||
Point *tp;
|
||||
int np, nptotal;
|
||||
int i, j;
|
||||
static GLUtesselator *tess = NULL;
|
||||
static GLdouble *v = NULL;
|
||||
static int maxnp = 0;
|
||||
FontChar *ccur;
|
||||
|
||||
if (pixsize < 5) return; /* Label too small to be useful */
|
||||
|
||||
if (tess == NULL)
|
||||
{
|
||||
tess = gluNewTess();
|
||||
gluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)glBegin);
|
||||
gluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)glVertex3dv);
|
||||
gluTessCallback(tess, GLU_TESS_END, (_GLUfuncptr)glEnd);
|
||||
gluTessCallback(tess, GLU_TESS_COMBINE_DATA, (_GLUfuncptr)myCombine);
|
||||
}
|
||||
// Boundary-only does not look particularly good. . .
|
||||
gluTessProperty(tess, GLU_TESS_BOUNDARY_ONLY, GL_FALSE);
|
||||
|
||||
nptotal = 0;
|
||||
for (ccur = clist; ccur != NULL; ccur = ccur->fc_next)
|
||||
nptotal += ccur->fc_numpoints;
|
||||
|
||||
if (nptotal > maxnp)
|
||||
{
|
||||
if (v != NULL) freeMagic((char *)v);
|
||||
maxnp = nptotal;
|
||||
v = (GLdouble *)mallocMagic(nptotal * 3 * sizeof(GLdouble));
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (ccur = clist; ccur != NULL; ccur = ccur->fc_next)
|
||||
{
|
||||
tp = ccur->fc_points;
|
||||
np = ccur->fc_numpoints;
|
||||
|
||||
for (i = 0; i < np; i++, j += 3) {
|
||||
v[j] = tp[i].p_x;
|
||||
v[j + 1] = tp[i].p_y;
|
||||
v[j + 2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gluTessBeginPolygon(tess, (GLvoid *)(&tc));
|
||||
j = 0;
|
||||
for (ccur = clist; ccur != NULL; ccur = ccur->fc_next)
|
||||
{
|
||||
np = ccur->fc_numpoints;
|
||||
gluTessBeginContour(tess);
|
||||
for (i = 0; i < np; i++, j += 3) {
|
||||
gluTessVertex(tess, &v[j], &v[j]);
|
||||
}
|
||||
gluTessEndContour(tess);
|
||||
}
|
||||
gluTessEndPolygon(tess);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglFontText:
|
||||
*
|
||||
* This routine draws text from font vectors using the
|
||||
* font vector routines in DBlabel.c. Text is clipped
|
||||
* to the clipping rectangle.
|
||||
*
|
||||
* For speed, we should be transferring the font
|
||||
* vectors into OpenGL display lists!
|
||||
*
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglFontText(text, font, size, rotate, pos, clip, obscure)
|
||||
char *text; /* The text to be drawn */
|
||||
int font; /* Font to use from fontList */
|
||||
int size; /* Pixel size of the font */
|
||||
int rotate; /* Text rotation */
|
||||
Point *pos; /* Text base position */
|
||||
Rect *clip; /* Clipping area */
|
||||
LinkedRect *obscure; /* List of obscuring areas */
|
||||
{
|
||||
char *tptr;
|
||||
Point *coffset; /* vector to next character */
|
||||
Rect *cbbox;
|
||||
GLfloat fsize, matvals[16];
|
||||
FontChar *clist;
|
||||
int cheight, baseline;
|
||||
float tmp;
|
||||
|
||||
/* Keep it simple for now---ignore clip and obscure */
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glPushMatrix();
|
||||
glTranslated(pos->p_x, pos->p_y, 0);
|
||||
glRotated(rotate, 0, 0, 1);
|
||||
|
||||
/* Get label size */
|
||||
cbbox = &DBFontList[font]->mf_extents;
|
||||
|
||||
fsize = (GLfloat)size / (GLfloat)cbbox->r_ytop;
|
||||
glScalef(fsize, fsize, 1.0);
|
||||
|
||||
/* Adjust to baseline */
|
||||
baseline = 0;
|
||||
for (tptr = text; *tptr != '\0'; tptr++)
|
||||
{
|
||||
DBFontChar(font, *tptr, NULL, NULL, &cbbox);
|
||||
if (cbbox->r_ybot < baseline)
|
||||
baseline = cbbox->r_ybot;
|
||||
}
|
||||
glTranslated(0, -baseline, 0);
|
||||
|
||||
for (tptr = text; *tptr != '\0'; tptr++)
|
||||
{
|
||||
DBFontChar(font, *tptr, &clist, &coffset, NULL);
|
||||
grtoglDrawCharacter(clist, *tptr, size);
|
||||
glTranslated(coffset->p_x, coffset->p_y, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
#endif /* VECTOR_FONTS */
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglPutText:
|
||||
* (modified on SunPutText)
|
||||
*
|
||||
* This routine puts a chunk of text on the screen in the current
|
||||
* color, size, etc. The caller must ensure that it fits on
|
||||
* the screen -- no clipping is done except to the obscuring rectangle
|
||||
* list and the clip rectangle.
|
||||
*
|
||||
* Results:
|
||||
* none.
|
||||
*
|
||||
* Side Effects:
|
||||
* The text is drawn on the screen.
|
||||
*
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglPutText (text, pos, clip, obscure)
|
||||
char *text; /* The text to be drawn. */
|
||||
Point *pos; /* A point located at the leftmost point of
|
||||
* the baseline for this string.
|
||||
*/
|
||||
Rect *clip; /* A rectangle to clip against */
|
||||
LinkedRect *obscure; /* A list of obscuring rectangles */
|
||||
|
||||
{
|
||||
Rect location;
|
||||
Rect overlap;
|
||||
Rect textrect;
|
||||
LinkedRect *ob;
|
||||
void grTOGLGeoSub();
|
||||
int i;
|
||||
float tscale;
|
||||
|
||||
GrTOGLTextSize(text, toglCurrent.fontSize, &textrect);
|
||||
|
||||
location.r_xbot = pos->p_x + textrect.r_xbot;
|
||||
location.r_xtop = pos->p_x + textrect.r_xtop;
|
||||
location.r_ybot = pos->p_y + textrect.r_ybot;
|
||||
location.r_ytop = pos->p_y + textrect.r_ytop;
|
||||
|
||||
/* erase parts of the bitmap that are obscured */
|
||||
for (ob = obscure; ob != NULL; ob = ob->r_next)
|
||||
{
|
||||
if (GEO_TOUCH(&ob->r_r, &location))
|
||||
{
|
||||
overlap = location;
|
||||
GeoClip(&overlap, &ob->r_r);
|
||||
grTOGLGeoSub(&location, &overlap);
|
||||
}
|
||||
}
|
||||
|
||||
overlap = location;
|
||||
GeoClip(&overlap, clip);
|
||||
|
||||
/* copy the text to the color screen */
|
||||
if ((overlap.r_xbot < overlap.r_xtop)&&(overlap.r_ybot <= overlap.r_ytop))
|
||||
{
|
||||
glScissor(overlap.r_xbot, overlap.r_ybot, overlap.r_xtop - overlap.r_xbot,
|
||||
overlap.r_ytop - overlap.r_ybot);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
glRasterPos2i(pos->p_x, pos->p_y);
|
||||
glListBase(grXBases[(toglCurrent.fontSize == GR_TEXT_DEFAULT) ?
|
||||
GR_TEXT_SMALL : toglCurrent.fontSize]);
|
||||
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (unsigned char *)text);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* grTOGLGeoSub:
|
||||
* return the tallest sub-rectangle of r not obscured by area
|
||||
* area must be within r.
|
||||
*/
|
||||
|
||||
void
|
||||
grTOGLGeoSub(r, area)
|
||||
Rect *r; /* Rectangle to be subtracted from. */
|
||||
Rect *area; /* Area to be subtracted. */
|
||||
|
||||
{
|
||||
if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop;
|
||||
else
|
||||
if (r->r_xtop == area->r_xtop) r->r_xtop = area->r_xbot;
|
||||
else
|
||||
if (r->r_ybot <= area->r_ybot) r->r_ybot = area->r_ytop;
|
||||
else
|
||||
if (r->r_ytop == area->r_ytop) r->r_ytop = area->r_ybot;
|
||||
else
|
||||
r->r_xtop = area->r_xbot;
|
||||
}
|
||||
|
|
@ -0,0 +1,723 @@
|
|||
/* grTOGL3.c -
|
||||
*
|
||||
* Copyright 2003 Open Circuit Design, Inc., for MultiGiG Ltd.
|
||||
*
|
||||
* This file contains additional functions to manipulate an X window system
|
||||
* color display. Included here are device-dependent routines to draw and
|
||||
* erase text and draw a grid.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "utils/malloc.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
#include "graphics/graphicsInt.h"
|
||||
#include "dbwind/dbwind.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/signals.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/hash.h"
|
||||
#include "graphics/grTOGLInt.h"
|
||||
#include "graphics/grTkCommon.h"
|
||||
#include "database/fonts.h"
|
||||
|
||||
extern Display *grXdpy;
|
||||
|
||||
/* locals */
|
||||
|
||||
GLuint grXBases[4];
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglDrawGrid:
|
||||
* grxDrawGrid adds a grid to the grid layer, using the current
|
||||
* write mask and color.
|
||||
*
|
||||
* Results:
|
||||
* TRUE is returned normally. However, if the grid gets too small
|
||||
* to be useful, then nothing is drawn and FALSE is returned.
|
||||
*
|
||||
* Side Effects: None.
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
bool
|
||||
grtoglDrawGrid (prect, outline, clip)
|
||||
Rect *prect; /* A rectangle that forms the template
|
||||
* for the grid. Note: in order to maintain
|
||||
* precision for the grid, the rectangle
|
||||
* coordinates are specified in units of
|
||||
* screen coordinates multiplied by SUBPIXEL.
|
||||
*/
|
||||
int outline; /* the outline style */
|
||||
Rect *clip; /* a clipping rectangle */
|
||||
{
|
||||
int xsize, ysize;
|
||||
int x, y;
|
||||
int xstart, ystart;
|
||||
int snum, low, hi, shifted;
|
||||
|
||||
xsize = prect->r_xtop - prect->r_xbot;
|
||||
ysize = prect->r_ytop - prect->r_ybot;
|
||||
if (!xsize || !ysize || GRID_TOO_SMALL(xsize, ysize))
|
||||
return FALSE;
|
||||
|
||||
xstart = prect->r_xbot % xsize;
|
||||
while (xstart < clip->r_xbot << SUBPIXELBITS) xstart += xsize;
|
||||
ystart = prect->r_ybot % ysize;
|
||||
while (ystart < clip->r_ybot << SUBPIXELBITS) ystart += ysize;
|
||||
|
||||
grtoglSetLineStyle(outline);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
|
||||
snum = 0;
|
||||
low = clip->r_ybot;
|
||||
hi = clip->r_ytop;
|
||||
for (x = xstart; x < (clip->r_xtop+1) << SUBPIXELBITS; x += xsize)
|
||||
{
|
||||
shifted = x >> SUBPIXELBITS;
|
||||
glVertex2i(shifted, low);
|
||||
glVertex2i(shifted, hi);
|
||||
snum++;
|
||||
}
|
||||
|
||||
snum = 0;
|
||||
low = clip->r_xbot;
|
||||
hi = clip->r_xtop;
|
||||
for (y = ystart; y < (clip->r_ytop+1) << SUBPIXELBITS; y += ysize)
|
||||
{
|
||||
shifted = y >> SUBPIXELBITS;
|
||||
glVertex2i(low, shifted);
|
||||
glVertex2i(hi, shifted);
|
||||
snum++;
|
||||
}
|
||||
glEnd();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglLoadFont
|
||||
* This local routine transfers the X font bitmaps
|
||||
* into OpenGL display lists for simple text
|
||||
* rendering.
|
||||
*
|
||||
* Results: Success/Failure
|
||||
*
|
||||
* Side Effects: None.
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
bool
|
||||
grtoglLoadFont()
|
||||
{
|
||||
Font id;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
id = Tk_FontId(grTkFonts[i]);
|
||||
|
||||
grXBases[i] = glGenLists(256);
|
||||
if (grXBases[i] == 0) {
|
||||
TxError("Out of display lists!\n");
|
||||
return FALSE;
|
||||
}
|
||||
glXUseXFont(id, 0, 256, grXBases[i]);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglSetCharSize:
|
||||
* This local routine sets the character size in the display,
|
||||
* if necessary.
|
||||
*
|
||||
* Results: None.
|
||||
*
|
||||
* Side Effects: None.
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglSetCharSize (size)
|
||||
int size; /* Width of characters, in pixels (6 or 8). */
|
||||
{
|
||||
toglCurrent.fontSize = size;
|
||||
switch (size)
|
||||
{
|
||||
case GR_TEXT_DEFAULT:
|
||||
case GR_TEXT_SMALL:
|
||||
toglCurrent.font = grSmallFont;
|
||||
break;
|
||||
case GR_TEXT_MEDIUM:
|
||||
toglCurrent.font = grMediumFont;
|
||||
break;
|
||||
case GR_TEXT_LARGE:
|
||||
toglCurrent.font = grLargeFont;
|
||||
break;
|
||||
case GR_TEXT_XLARGE:
|
||||
toglCurrent.font = grXLargeFont;
|
||||
break;
|
||||
default:
|
||||
TxError("%s%d\n", "grtoglSetCharSize: Unknown character size ",
|
||||
size );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* GrTOGLTextSize --
|
||||
*
|
||||
* Determine the size of a text string.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* A rectangle is filled in that is the size of the text in pixels.
|
||||
* The origin (0, 0) of this rectangle is located on the baseline
|
||||
* at the far left side of the string.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
GrTOGLTextSize(text, size, r)
|
||||
char *text;
|
||||
int size;
|
||||
Rect *r;
|
||||
{
|
||||
Tk_FontMetrics overall;
|
||||
Tk_Font font;
|
||||
int width;
|
||||
|
||||
switch (size) {
|
||||
case GR_TEXT_DEFAULT:
|
||||
case GR_TEXT_SMALL:
|
||||
font = grSmallFont;
|
||||
break;
|
||||
case GR_TEXT_MEDIUM:
|
||||
font = grMediumFont;
|
||||
break;
|
||||
case GR_TEXT_LARGE:
|
||||
font = grLargeFont;
|
||||
break;
|
||||
case GR_TEXT_XLARGE:
|
||||
font = grXLargeFont;
|
||||
break;
|
||||
default:
|
||||
TxError("%s%d\n", "GrTOGLTextSize: Unknown character size ",
|
||||
size );
|
||||
break;
|
||||
}
|
||||
if (font == NULL) return;
|
||||
Tk_GetFontMetrics(font, &overall);
|
||||
width = Tk_TextWidth(font, text, strlen(text));
|
||||
/* Hack alert! Tk_TextWidth returns values too small! */
|
||||
width = width + (width >> 4);
|
||||
r->r_ytop = overall.ascent;
|
||||
r->r_ybot = -overall.descent;
|
||||
r->r_xtop = width;
|
||||
r->r_xbot = 0;
|
||||
}
|
||||
|
||||
/* OpenGL backing store functions (now removed from the X11-based ones) */
|
||||
/* Since we always paint into the front buffer, the back buffer is */
|
||||
/* always available for backing store. We need not create or destroy */
|
||||
/* it. We just use the w_backingStore location to store whether the */
|
||||
/* backing store contains valid data or not. */
|
||||
|
||||
void
|
||||
grtoglFreeBackingStore(MagWindow *window)
|
||||
{
|
||||
window->w_backingStore = (ClientData)0;
|
||||
}
|
||||
|
||||
void
|
||||
grtoglCreateBackingStore(MagWindow *w)
|
||||
{
|
||||
Tk_Window tkwind = (Tk_Window)w->w_grdata;
|
||||
|
||||
/* ignore all windows other than layout */
|
||||
if (w->w_client != DBWclientID) return;
|
||||
|
||||
/* Deferred */
|
||||
if (tkwind == NULL) return;
|
||||
|
||||
w->w_backingStore = (ClientData)1;
|
||||
}
|
||||
|
||||
bool
|
||||
grtoglGetBackingStore(MagWindow *w, Rect *area)
|
||||
{
|
||||
unsigned int width, height;
|
||||
int xbot, ybot;
|
||||
Rect r;
|
||||
|
||||
// GLboolean result;
|
||||
// GLint rasterpos[4];
|
||||
|
||||
if (w->w_backingStore == (ClientData)0) return FALSE;
|
||||
|
||||
GEO_EXPAND(area, 1, &r);
|
||||
GeoClip(&r, &(w->w_screenArea));
|
||||
|
||||
width = r.r_xtop - r.r_xbot;
|
||||
height = r.r_ytop - r.r_ybot;
|
||||
|
||||
xbot = r.r_xbot;
|
||||
ybot = r.r_ybot;
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_BACK);
|
||||
glRasterPos2i((GLint)xbot, (GLint)ybot);
|
||||
|
||||
/* Check for valid raster position */
|
||||
// glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, (GLboolean *)(&result));
|
||||
// glGetIntegerv(GL_CURRENT_RASTER_POSITION, (GLint *)(&rasterpos[0]));
|
||||
|
||||
// TxPrintf("Raster valid = %d, position = %d %d %d %d\n",
|
||||
// (int)result, (int)rasterpos[0], (int)rasterpos[1],
|
||||
// (int)rasterpos[2], (int)rasterpos[3]);
|
||||
// if (result == 0)
|
||||
// TxPrintf("Intended position = %d %d\n", xbot, ybot);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glCopyPixels(xbot, ybot, width, height, GL_COLOR);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
grtoglScrollBackingStore(MagWindow *w, Point *shift)
|
||||
{
|
||||
unsigned int width, height;
|
||||
int xorigin, yorigin, xshift, yshift;
|
||||
|
||||
if (w->w_backingStore == (ClientData)0)
|
||||
{
|
||||
TxPrintf("grtoglScrollBackingStore %d %d failure\n",
|
||||
shift->p_x, shift->p_y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
width = w->w_screenArea.r_xtop - w->w_screenArea.r_xbot;
|
||||
height = w->w_screenArea.r_ytop - w->w_screenArea.r_ybot;
|
||||
xorigin = 0;
|
||||
yorigin = 0;
|
||||
xshift = shift->p_x;
|
||||
yshift = shift->p_y;
|
||||
|
||||
if (xshift > 0)
|
||||
width -= xshift;
|
||||
else if (xshift < 0)
|
||||
{
|
||||
width += xshift;
|
||||
xorigin = -xshift;
|
||||
xshift = 0;
|
||||
}
|
||||
if (yshift > 0)
|
||||
height -= yshift;
|
||||
else if (yshift < 0)
|
||||
{
|
||||
height += yshift;
|
||||
yorigin = -yshift;
|
||||
yshift = 0;
|
||||
}
|
||||
|
||||
glDrawBuffer(GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
glRasterPos2i((GLint)xshift, (GLint)yshift);
|
||||
glDisable(GL_BLEND);
|
||||
glCopyPixels(xorigin, yorigin, width, height, GL_COLOR);
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
grtoglPutBackingStore(MagWindow *w, Rect *area)
|
||||
{
|
||||
unsigned int width, height;
|
||||
int ybot, xbot;
|
||||
Rect r;
|
||||
|
||||
// GLboolean result;
|
||||
// GLint rasterpos[4];
|
||||
|
||||
if (w->w_backingStore == (ClientData)0) return;
|
||||
|
||||
GEO_EXPAND(area, 1, &r);
|
||||
GeoClip(&r, &(w->w_screenArea));
|
||||
|
||||
/*
|
||||
width = area->r_xtop - area->r_xbot;
|
||||
height = area->r_ytop - area->r_ybot;
|
||||
|
||||
ybot = area->r_ybot;
|
||||
xbot = area->r_xbot;
|
||||
*/
|
||||
|
||||
width = r.r_xtop - r.r_xbot;
|
||||
height = r.r_ytop - r.r_ybot;
|
||||
ybot = r.r_ybot;
|
||||
xbot = r.r_xbot;
|
||||
|
||||
if (xbot < 0) {
|
||||
width -= xbot;
|
||||
xbot = 0;
|
||||
}
|
||||
|
||||
if (ybot < 0) {
|
||||
height -= ybot;
|
||||
ybot = 0;
|
||||
}
|
||||
|
||||
glReadBuffer(GL_FRONT);
|
||||
glDrawBuffer(GL_BACK);
|
||||
glRasterPos2i((GLint)xbot, (GLint)ybot);
|
||||
|
||||
/* Check for valid raster position */
|
||||
// glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, (GLboolean *)(&result));
|
||||
// glGetIntegerv(GL_CURRENT_RASTER_POSITION, (GLint *)(&rasterpos[0]));
|
||||
|
||||
// TxPrintf("Raster valid = %d, position = %d %d %d %d\n",
|
||||
// (int)result, (int)rasterpos[0], (int)rasterpos[1],
|
||||
// (int)rasterpos[2], (int)rasterpos[3]);
|
||||
// if (result == 0)
|
||||
// TxPrintf("Intended position = %d %d\n", xbot, ybot);
|
||||
|
||||
/* This area may need to be expanded by a pixel and/or */
|
||||
/* expanded by GrPixelCorrect to compensate for the OpenGL */
|
||||
/* coordinate system. */
|
||||
|
||||
width--;
|
||||
height--;
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glCopyPixels(xbot, ybot, width, height, GL_COLOR);
|
||||
|
||||
glDrawBuffer(GL_FRONT); /* Return to normal front rendering */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* GrTOGLReadPixel --
|
||||
*
|
||||
* Read one pixel from the screen.
|
||||
*
|
||||
* Results:
|
||||
* An integer containing the pixel's color.
|
||||
*
|
||||
* Side effects:
|
||||
* none.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
GrTOGLReadPixel (w, x, y)
|
||||
MagWindow *w;
|
||||
int x,y; /* the location of a pixel in screen coords */
|
||||
{
|
||||
return 0; /* OpenGL has no such function, so return 0 */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* GrTOGLBitBlt --
|
||||
*
|
||||
* Copy information in bit block transfers.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* changes the screen.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
GrTOGLBitBlt(r, p)
|
||||
Rect *r;
|
||||
Point *p;
|
||||
{
|
||||
glCopyPixels(r->r_xbot, r->r_ybot, r->r_xtop - r->r_xbot + 1,
|
||||
r->r_ytop - r->r_ybot + 1, GL_COLOR);
|
||||
}
|
||||
|
||||
#ifdef VECTOR_FONTS
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Technically, there should be no self-intersecting polygons in outline
|
||||
* fonts. However, decomposition of bezier curves into line segments
|
||||
* may occasionally produce one, so it needs to be handled.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
myCombine(GLdouble coords[3], GLdouble *vertex_data[4],
|
||||
GLfloat weight[4], GLdouble **outData, void *dataptr)
|
||||
{
|
||||
/* This needs to be free'd at the end of gluTessEndPolygon()! */
|
||||
GLdouble *new = (GLdouble *)mallocMagic(2 * sizeof(GLdouble));
|
||||
new[0] = coords[0];
|
||||
new[1] = coords[1];
|
||||
*outData = new;
|
||||
/* Diagnostic */
|
||||
TxError("Intersecting polygon in char \"%c\" at %g %g!\n",
|
||||
*((char *)dataptr), coords[0], coords[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
* Draw a text character
|
||||
* This routine differs from grtoglFillPolygon() in that it uses the
|
||||
* glu library to handle non-convex polygons as may appear in font
|
||||
* outlines.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglDrawCharacter(clist, tc, pixsize)
|
||||
FontChar *clist;
|
||||
unsigned char tc;
|
||||
int pixsize;
|
||||
{
|
||||
Point *tp;
|
||||
int np, nptotal;
|
||||
int i, j;
|
||||
static GLUtesselator *tess = NULL;
|
||||
static GLdouble *v = NULL;
|
||||
static int maxnp = 0;
|
||||
FontChar *ccur;
|
||||
|
||||
if (pixsize < 5) return; /* Label too small to be useful */
|
||||
|
||||
if (tess == NULL)
|
||||
{
|
||||
tess = gluNewTess();
|
||||
gluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)glBegin);
|
||||
gluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)glVertex3dv);
|
||||
gluTessCallback(tess, GLU_TESS_END, (_GLUfuncptr)glEnd);
|
||||
gluTessCallback(tess, GLU_TESS_COMBINE_DATA, (_GLUfuncptr)myCombine);
|
||||
}
|
||||
// Boundary-only does not look particularly good. . .
|
||||
gluTessProperty(tess, GLU_TESS_BOUNDARY_ONLY, GL_FALSE);
|
||||
|
||||
nptotal = 0;
|
||||
for (ccur = clist; ccur != NULL; ccur = ccur->fc_next)
|
||||
nptotal += ccur->fc_numpoints;
|
||||
|
||||
if (nptotal > maxnp)
|
||||
{
|
||||
if (v != NULL) freeMagic((char *)v);
|
||||
maxnp = nptotal;
|
||||
v = (GLdouble *)mallocMagic(nptotal * 3 * sizeof(GLdouble));
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (ccur = clist; ccur != NULL; ccur = ccur->fc_next)
|
||||
{
|
||||
tp = ccur->fc_points;
|
||||
np = ccur->fc_numpoints;
|
||||
|
||||
for (i = 0; i < np; i++, j += 3) {
|
||||
v[j] = tp[i].p_x;
|
||||
v[j + 1] = tp[i].p_y;
|
||||
v[j + 2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gluTessBeginPolygon(tess, (GLvoid *)(&tc));
|
||||
j = 0;
|
||||
for (ccur = clist; ccur != NULL; ccur = ccur->fc_next)
|
||||
{
|
||||
np = ccur->fc_numpoints;
|
||||
gluTessBeginContour(tess);
|
||||
for (i = 0; i < np; i++, j += 3) {
|
||||
gluTessVertex(tess, &v[j], &v[j]);
|
||||
}
|
||||
gluTessEndContour(tess);
|
||||
}
|
||||
gluTessEndPolygon(tess);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglFontText:
|
||||
*
|
||||
* This routine draws text from font vectors using the
|
||||
* font vector routines in DBlabel.c. Text is clipped
|
||||
* to the clipping rectangle.
|
||||
*
|
||||
* For speed, we should be transferring the font
|
||||
* vectors into OpenGL display lists!
|
||||
*
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglFontText(text, font, size, rotate, pos, clip, obscure)
|
||||
char *text; /* The text to be drawn */
|
||||
int font; /* Font to use from fontList */
|
||||
int size; /* Pixel size of the font */
|
||||
int rotate; /* Text rotation */
|
||||
Point *pos; /* Text base position */
|
||||
Rect *clip; /* Clipping area */
|
||||
LinkedRect *obscure; /* List of obscuring areas */
|
||||
{
|
||||
char *tptr;
|
||||
Point *coffset; /* vector to next character */
|
||||
Rect *cbbox;
|
||||
GLfloat fsize, matvals[16];
|
||||
FontChar *clist;
|
||||
int cheight, baseline;
|
||||
float tmp;
|
||||
|
||||
/* Keep it simple for now---ignore clip and obscure */
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glPushMatrix();
|
||||
glTranslated(pos->p_x, pos->p_y, 0);
|
||||
glRotated(rotate, 0, 0, 1);
|
||||
|
||||
/* Get label size */
|
||||
cbbox = &DBFontList[font]->mf_extents;
|
||||
|
||||
fsize = (GLfloat)size / (GLfloat)cbbox->r_ytop;
|
||||
glScalef(fsize, fsize, 1.0);
|
||||
|
||||
/* Adjust to baseline */
|
||||
baseline = 0;
|
||||
for (tptr = text; *tptr != '\0'; tptr++)
|
||||
{
|
||||
DBFontChar(font, *tptr, NULL, NULL, &cbbox);
|
||||
if (cbbox->r_ybot < baseline)
|
||||
baseline = cbbox->r_ybot;
|
||||
}
|
||||
glTranslated(0, -baseline, 0);
|
||||
|
||||
for (tptr = text; *tptr != '\0'; tptr++)
|
||||
{
|
||||
DBFontChar(font, *tptr, &clist, &coffset, NULL);
|
||||
grtoglDrawCharacter(clist, *tptr, size);
|
||||
glTranslated(coffset->p_x, coffset->p_y, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
#endif /* VECTOR_FONTS */
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* grtoglPutText:
|
||||
* (modified on SunPutText)
|
||||
*
|
||||
* This routine puts a chunk of text on the screen in the current
|
||||
* color, size, etc. The caller must ensure that it fits on
|
||||
* the screen -- no clipping is done except to the obscuring rectangle
|
||||
* list and the clip rectangle.
|
||||
*
|
||||
* Results:
|
||||
* none.
|
||||
*
|
||||
* Side Effects:
|
||||
* The text is drawn on the screen.
|
||||
*
|
||||
*---------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
grtoglPutText (text, pos, clip, obscure)
|
||||
char *text; /* The text to be drawn. */
|
||||
Point *pos; /* A point located at the leftmost point of
|
||||
* the baseline for this string.
|
||||
*/
|
||||
Rect *clip; /* A rectangle to clip against */
|
||||
LinkedRect *obscure; /* A list of obscuring rectangles */
|
||||
|
||||
{
|
||||
Rect location;
|
||||
Rect overlap;
|
||||
Rect textrect;
|
||||
LinkedRect *ob;
|
||||
void grTOGLGeoSub();
|
||||
int i;
|
||||
float tscale;
|
||||
|
||||
GrTOGLTextSize(text, toglCurrent.fontSize, &textrect);
|
||||
|
||||
location.r_xbot = pos->p_x + textrect.r_xbot;
|
||||
location.r_xtop = pos->p_x + textrect.r_xtop;
|
||||
location.r_ybot = pos->p_y + textrect.r_ybot;
|
||||
location.r_ytop = pos->p_y + textrect.r_ytop;
|
||||
|
||||
/* erase parts of the bitmap that are obscured */
|
||||
for (ob = obscure; ob != NULL; ob = ob->r_next)
|
||||
{
|
||||
if (GEO_TOUCH(&ob->r_r, &location))
|
||||
{
|
||||
overlap = location;
|
||||
GeoClip(&overlap, &ob->r_r);
|
||||
grTOGLGeoSub(&location, &overlap);
|
||||
}
|
||||
}
|
||||
|
||||
overlap = location;
|
||||
GeoClip(&overlap, clip);
|
||||
|
||||
/* copy the text to the color screen */
|
||||
if ((overlap.r_xbot < overlap.r_xtop)&&(overlap.r_ybot <= overlap.r_ytop))
|
||||
{
|
||||
glScissor(overlap.r_xbot, overlap.r_ybot, overlap.r_xtop - overlap.r_xbot,
|
||||
overlap.r_ytop - overlap.r_ybot);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
glRasterPos2i(pos->p_x, pos->p_y);
|
||||
glListBase(grXBases[(toglCurrent.fontSize == GR_TEXT_DEFAULT) ?
|
||||
GR_TEXT_SMALL : toglCurrent.fontSize]);
|
||||
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (unsigned char *)text);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* grTOGLGeoSub:
|
||||
* return the tallest sub-rectangle of r not obscured by area
|
||||
* area must be within r.
|
||||
*/
|
||||
|
||||
void
|
||||
grTOGLGeoSub(r, area)
|
||||
Rect *r; /* Rectangle to be subtracted from. */
|
||||
Rect *area; /* Area to be subtracted. */
|
||||
|
||||
{
|
||||
if (r->r_xbot == area->r_xbot) r->r_xbot = area->r_xtop;
|
||||
else
|
||||
if (r->r_xtop == area->r_xtop) r->r_xtop = area->r_xbot;
|
||||
else
|
||||
if (r->r_ybot <= area->r_ybot) r->r_ybot = area->r_ytop;
|
||||
else
|
||||
if (r->r_ytop == area->r_ytop) r->r_ytop = area->r_ybot;
|
||||
else
|
||||
r->r_xtop = area->r_xbot;
|
||||
}
|
||||
|
|
@ -1114,7 +1114,9 @@ keys_and_buttons:
|
|||
if (mw->w_backingStore != (ClientData)NULL)
|
||||
{
|
||||
Rect surface;
|
||||
(*GrLockPtr)(mw, FALSE);
|
||||
(*GrGetBackingStorePtr)(mw, &screenRect);
|
||||
(*GrUnlockPtr)(mw);
|
||||
WindScreenToSurface(mw, &screenRect, &surface);
|
||||
DBWHLRedrawPrepWindow(mw, &surface);
|
||||
WindDrawBorder(mw, &screenRect);
|
||||
|
|
|
|||
|
|
@ -841,7 +841,9 @@ grX11Stdin()
|
|||
if (w->w_backingStore != (ClientData)NULL)
|
||||
{
|
||||
Rect surface;
|
||||
(*GrLockPtr)(w, FALSE);
|
||||
(*GrGetBackingStorePtr)(w, &screenRect);
|
||||
(*GrUnlockPtr)(w);
|
||||
WindScreenToSurface(w, &screenRect, &surface);
|
||||
DBWHLRedrawPrepWindow(w, &surface);
|
||||
WindDrawBorder(w, &screenRect);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ running configure, to aid debugging if configure makes a mistake.
|
|||
It was created by configure, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ ./configure --enable-cairo-offscreen
|
||||
$ ./configure
|
||||
|
||||
## --------- ##
|
||||
## Platform. ##
|
||||
|
|
@ -125,7 +125,7 @@ configure: failed program was:
|
|||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define PACKAGE_URL ""
|
||||
| #define MAGIC_VERSION "8.2"
|
||||
| #define MAGIC_REVISION "27"
|
||||
| #define MAGIC_REVISION "29"
|
||||
| /* end confdefs.h. */
|
||||
| #include <ac_nonexistent.h>
|
||||
configure:3474: result: gcc -E
|
||||
|
|
@ -146,7 +146,7 @@ configure: failed program was:
|
|||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define PACKAGE_URL ""
|
||||
| #define MAGIC_VERSION "8.2"
|
||||
| #define MAGIC_REVISION "27"
|
||||
| #define MAGIC_REVISION "29"
|
||||
| /* end confdefs.h. */
|
||||
| #include <ac_nonexistent.h>
|
||||
configure:3594: checking for g++
|
||||
|
|
@ -302,7 +302,7 @@ configure: failed program was:
|
|||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define PACKAGE_URL ""
|
||||
| #define MAGIC_VERSION "8.2"
|
||||
| #define MAGIC_REVISION "27"
|
||||
| #define MAGIC_REVISION "29"
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
|
|
@ -343,7 +343,7 @@ configure: failed program was:
|
|||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define PACKAGE_URL ""
|
||||
| #define MAGIC_VERSION "8.2"
|
||||
| #define MAGIC_REVISION "27"
|
||||
| #define MAGIC_REVISION "29"
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
|
|
@ -433,7 +433,7 @@ configure: failed program was:
|
|||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define PACKAGE_URL ""
|
||||
| #define MAGIC_VERSION "8.2"
|
||||
| #define MAGIC_REVISION "27"
|
||||
| #define MAGIC_REVISION "29"
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
|
|
@ -506,7 +506,7 @@ configure: failed program was:
|
|||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define PACKAGE_URL ""
|
||||
| #define MAGIC_VERSION "8.2"
|
||||
| #define MAGIC_REVISION "27"
|
||||
| #define MAGIC_REVISION "29"
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
|
|
@ -651,8 +651,8 @@ generated by GNU Autoconf 2.69. Invocation command line was
|
|||
|
||||
on stravinsky
|
||||
|
||||
config.status:800: creating defs.mak
|
||||
config.status:903: WARNING: 'defs.mak.in' seems to ignore the --datarootdir setting
|
||||
config.status:799: creating defs.mak
|
||||
config.status:902: WARNING: 'defs.mak.in' seems to ignore the --datarootdir setting
|
||||
|
||||
## ---------------- ##
|
||||
## Cache variables. ##
|
||||
|
|
@ -759,7 +759,7 @@ CPPFLAGS=''
|
|||
CSH='/bin/csh'
|
||||
CXX='g++'
|
||||
CXXFLAGS='-g -O2'
|
||||
DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"27\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DCAIRO_OFFSCREEN_RENDER=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1'
|
||||
DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"29\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1'
|
||||
DEPEND_FLAG='-MM'
|
||||
ECHO_C=''
|
||||
ECHO_N='printf'
|
||||
|
|
@ -783,7 +783,7 @@ LIBS='-lcairo -lGLU -lGL '
|
|||
LIB_SPECS=' -L/usr/lib64 -ltk8.6 -L/usr/lib64 -ltcl8.6'
|
||||
LTLIBOBJS=''
|
||||
M4='/bin/m4'
|
||||
MAGIC_REVISION='27'
|
||||
MAGIC_REVISION='29'
|
||||
MAGIC_VERSION='8.2'
|
||||
MCPP='${MAGICDIR}/scripts/preproc.py'
|
||||
OA=''
|
||||
|
|
@ -884,7 +884,7 @@ unused=' readline lisp'
|
|||
#define PACKAGE_BUGREPORT ""
|
||||
#define PACKAGE_URL ""
|
||||
#define MAGIC_VERSION "8.2"
|
||||
#define MAGIC_REVISION "27"
|
||||
#define MAGIC_REVISION "29"
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
|
@ -911,7 +911,6 @@ unused=' readline lisp'
|
|||
#define FILE_LOCKS 1
|
||||
#define CALMA_MODULE 1
|
||||
#define CIF_MODULE 1
|
||||
#define X11_BACKING_STORE 1
|
||||
#define PLOT_MODULE 1
|
||||
#define LEF_MODULE 1
|
||||
#define ROUTE_MODULE 1
|
||||
|
|
@ -920,7 +919,6 @@ unused=' readline lisp'
|
|||
#define HAVE_LIBGLU 1
|
||||
#define VECTOR_FONTS 1
|
||||
#define HAVE_LIBCAIRO 1
|
||||
#define CAIRO_OFFSCREEN_RENDER 1
|
||||
#define MAGIC_WRAPPER 1
|
||||
#define THREE_D 1
|
||||
#define linux 1
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ $config_files
|
|||
|
||||
Report bugs to the package provider."
|
||||
|
||||
ac_cs_config="'--enable-cairo-offscreen' 'CFLAGS=-g'"
|
||||
ac_cs_config="'CFLAGS=-g'"
|
||||
ac_cs_version="\
|
||||
config.status
|
||||
configured by ./configure, generated by GNU Autoconf 2.69,
|
||||
|
|
@ -496,7 +496,7 @@ if $ac_cs_silent; then
|
|||
fi
|
||||
|
||||
if $ac_cs_recheck; then
|
||||
set X /bin/sh './configure' '--enable-cairo-offscreen' 'CFLAGS=-g' $ac_configure_extra_args --no-create --no-recursion
|
||||
set X /bin/sh './configure' 'CFLAGS=-g' $ac_configure_extra_args --no-create --no-recursion
|
||||
shift
|
||||
$as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
|
||||
CONFIG_SHELL='/bin/sh'
|
||||
|
|
@ -588,7 +588,7 @@ S["INSTALL_TARGET"]="install-tcl"
|
|||
S["ALL_TARGET"]="tcl"
|
||||
S["OA_LIBS"]=""
|
||||
S["OA"]=""
|
||||
S["MAGIC_REVISION"]="27"
|
||||
S["MAGIC_REVISION"]="29"
|
||||
S["MAGIC_VERSION"]="8.2"
|
||||
S["SCPP"]="gcc -E -x c"
|
||||
S["MCPP"]="${MAGICDIR}/scripts/preproc.py"
|
||||
|
|
@ -674,12 +674,11 @@ S["ECHO_T"]=""
|
|||
S["ECHO_N"]="-n"
|
||||
S["ECHO_C"]=""
|
||||
S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DMAGIC_VERSION="\
|
||||
"\\\"8.2\\\" -DMAGIC_REVISION=\\\"27\\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHA"\
|
||||
"\\\"8.2\\\" -DMAGIC_REVISION=\\\"29\\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHA"\
|
||||
"VE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_U"\
|
||||
"NSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE"\
|
||||
"_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -"\
|
||||
"DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DCAIRO_OFFSCREEN_RENDER=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux"\
|
||||
"=1 -DSYSV=1 -DISC=1"
|
||||
"_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHA"\
|
||||
"VE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1"
|
||||
S["mandir"]="${datarootdir}/man"
|
||||
S["localedir"]="${datarootdir}/locale"
|
||||
S["libdir"]="${exec_prefix}/lib"
|
||||
|
|
|
|||
|
|
@ -1408,7 +1408,7 @@ Optional Features:
|
|||
--disable-cif disable cif package
|
||||
--disable-client-render disable OpenGL client-side rendering
|
||||
--enable-invert-y invert screen top to bottom in OpenGL
|
||||
--enable-framebuffer-backing-store enable OpenGL framebuffer backing store
|
||||
--disable-framebuffer-backing-store disable OpenGL framebuffer backing store
|
||||
--disable-plot disable plot package
|
||||
--disable-lef disable LEF package
|
||||
--disable-readline disable readline package
|
||||
|
|
@ -6942,7 +6942,7 @@ fi
|
|||
if test "${enable_framebuffer_backing_store+set}" = set; then :
|
||||
enableval=$enable_framebuffer_backing_store;
|
||||
else
|
||||
enable_framebuffer_backing_store=no
|
||||
enable_framebuffer_backing_store=yes
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -975,9 +975,9 @@ if test "x$enable_invert_y" = "xyes" ; then
|
|||
fi
|
||||
|
||||
AC_ARG_ENABLE(framebuffer-backing-store,
|
||||
[ --enable-framebuffer-backing-store enable OpenGL framebuffer backing store],
|
||||
[ --disable-framebuffer-backing-store disable OpenGL framebuffer backing store],
|
||||
[],
|
||||
[enable_framebuffer_backing_store=no])
|
||||
[enable_framebuffer_backing_store=yes])
|
||||
|
||||
if test "x$enable_framebuffer_backing_store" != "xyes" ; then
|
||||
AC_DEFINE(X11_BACKING_STORE)
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ LIB_SPECS = -L/usr/lib64 -ltk8.6 -L/usr/lib64 -ltcl8.6
|
|||
WISH_EXE = /usr/bin/wish
|
||||
TCL_LIB_DIR = /usr/lib
|
||||
MAGIC_VERSION = 8.2
|
||||
MAGIC_REVISION = 27
|
||||
MAGIC_REVISION = 29
|
||||
|
||||
CC = gcc
|
||||
CPP = gcc -E
|
||||
CXX = g++
|
||||
|
||||
CPPFLAGS = -I. -I${MAGICDIR}
|
||||
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"27\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DCAIRO_OFFSCREEN_RENDER=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
|
||||
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"29\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
|
||||
DFLAGS += -DSHDLIB_EXT=\".so\"
|
||||
CFLAGS = -g -m64 -fPIC -Wimplicit-int -fPIC
|
||||
|
||||
|
|
|
|||
|
|
@ -492,8 +492,10 @@ WindScroll(w, surfaceOffset, screenOffset)
|
|||
norefresh.r_ytop += moveorigin.p_y;
|
||||
}
|
||||
|
||||
GrLock(w, FALSE);
|
||||
(*GrScrollBackingStorePtr)(w, &moveorigin);
|
||||
(*GrGetBackingStorePtr)(w, &norefresh);
|
||||
GrUnlock(w);
|
||||
WindAreaChanged(w, &refresh);
|
||||
/* Update highlights over entire screen area */
|
||||
DBWHLRedrawPrepWindow(w, &(w->w_surfaceArea));
|
||||
|
|
|
|||
Loading…
Reference in New Issue