1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include "allincludes.h"
#ifdef BUFFERING
/* clears the buffer [BDyess] */
void
W_ClearBuffer(window)
W_Window window;
{
struct window * win = W_Void2Window(window);
if(!win->isbuffered) return;
XFillRectangle(W_Display, win->drawable, colortable[backColor].contexts[0],
0, 0, win->width, win->height);
}
int
W_IsBuffered(window)
W_Window window;
{
return W_Void2Window(window)->isbuffered;
}
/* turns on buffering, reduces flicker [BDyess] */
/* on is a flag: 1 turns on buffering, 0 turns it off */
void
W_Buffer(window, on)
W_Window window;
int on;
{
struct window * win = W_Void2Window(window);
if(on) { /* turn buffering on [BDyess] */
win->isbuffered = 1;
if(win->buffer == 0) { /* create a new pixmap for the buffer [BDyess] */
win->buffer = XCreatePixmap(W_Display, W_Root, win->width,
win->height,
(unsigned)DefaultDepth(W_Display, W_Screen));
}
win->drawable = win->buffer;
/* clear the buffer to start with (can contain garbage) [BDyess] */
W_ClearBuffer(window);
} else { /* turn it off [BDyess] */
win->drawable = win->window;
win->isbuffered = 0;
}
}
/* draws the buffer onto the screen [BDyess] */
void
W_DisplayBuffer(window)
W_Window window;
{
struct window * win = W_Void2Window(window);
if(!win->isbuffered) return;
XCopyArea(W_Display, win->buffer, win->window,
colortable[W_Black].contexts[0], 0, 0, win->width,
win->height, 0, 0);
}
#endif /*BUFFERING [BDyess]*/
|