#include "backend.h"
#include "moves.h"
#include "board.h"
+#include "draw.h"
#ifdef __EMX__
if (do_flash && piece != EmptySquare && appData.flashCount > 0) {
for (i=0; i<appData.flashCount; ++i) {
DrawOneSquare(x, y, piece, square_color, 0, string, 0);
- DrawExpose(NULL, x, y, squareSize, squareSize);
+ GraphExpose(currBoard, x, y, squareSize, squareSize);
FlashDelay(flash_delay);
DrawOneSquare(x, y, EmptySquare, square_color, 0, string, 0);
- DrawExpose(NULL, x, y, squareSize, squareSize);
+ GraphExpose(currBoard, x, y, squareSize, squareSize);
FlashDelay(flash_delay);
}
}
DrawDragPiece();
if(exposeAll)
- DrawExpose(NULL, 0, 0, BOARD_WIDTH*(squareSize + lineGap) + lineGap, BOARD_HEIGHT*(squareSize + lineGap) + lineGap);
+ GraphExpose(currBoard, 0, 0, BOARD_WIDTH*(squareSize + lineGap) + lineGap, BOARD_HEIGHT*(squareSize + lineGap) + lineGap);
else {
for (i = 0; i < BOARD_HEIGHT; i++)
for (j = 0; j < BOARD_WIDTH; j++)
(squareSize + lineGap);
}
if(damage[nr][i][j] & 2) // damage by old or new arrow
- DrawExpose(NULL, x - lineGap, y - lineGap, squareSize + 2*lineGap, squareSize + 2*lineGap);
+ GraphExpose(currBoard, x - lineGap, y - lineGap, squareSize + 2*lineGap, squareSize + 2*lineGap);
else
- DrawExpose(NULL, x, y, squareSize, squareSize);
+ GraphExpose(currBoard, x, y, squareSize, squareSize);
damage[nr][i][j] &= ~2; // remember damage by newly drawn error in '2' bit, to schedule it for erasure next draw
}
}
void SwitchWindow P((void));
extern int damage[2][BOARD_RANKS][BOARD_FILES];
+extern Option *currBoard;
#define SOLID 0
#define OUTLINE 1
Boolean cairoAnimate;
-static cairo_surface_t *csBoardWindow, *csDualBoard;
+Option *currBoard;
+static cairo_surface_t *csBoardWindow;
static cairo_surface_t *pngPieceImages[2][(int)BlackPawn+4]; // png 256 x 256 images
static cairo_surface_t *pngPieceBitmaps[2][(int)BlackPawn]; // scaled pieces as used
static cairo_surface_t *pngPieceBitmaps2[2][(int)BlackPawn+4]; // scaled pieces in store
void
SwitchWindow ()
{
- cairo_surface_t *cstmp = csBoardWindow;
- csBoardWindow = csDualBoard;
dual = !dual;
- if(!csDualBoard) {
- csBoardWindow = DRAWABLE(dualOptions+3);
- dual = 1;
- }
- csDualBoard = cstmp;
+ currBoard = (dual ? &mainOptions[W_BOARD] : &dualOptions[3]);
+ csBoardWindow = DRAWABLE(currBoard);
}
#define BoardSize int
DrawSeekOpen ()
{
csBoardWindow = (cairo_surface_t *) mainOptions[W_BOARD].choice;
+ currBoard = &mainOptions[W_BOARD];
}
void
SetPen(cr, lineGap, col, 0);
cairo_stroke(cr);
cairo_destroy(cr);
- DrawExpose(NULL, x - lineGap/2, y - lineGap/2, squareSize+2*lineGap, squareSize+2*lineGap);
+ GraphExpose(currBoard, x - lineGap/2, y - lineGap/2, squareSize+2*lineGap, squareSize+2*lineGap);
}
static int
cairo_fill (cr);
cairo_destroy (cr);
if(c_animBufs[anr+destBuf] == csBoardWindow)
- DrawExpose(NULL, destX, destY, squareSize, squareSize);
+ GraphExpose(currBoard, destX, destY, squareSize, squareSize);
}
void
void DelayedDrag P((void));
void ReadBitmap P((Pixmap *pm, String name, unsigned char bits[],
u_int wreq, u_int hreq));
-cairo_surface_t *GetOutputSurface P((Option *opt, int w, int h));
extern XFontStruct *coordFontStruct, *countFontStruct;
extern Font coordFontID, countFontID;
void CreateGrid P((void));
// defined in xoptions.c
-void DrawExpose P((Option *opt, int x, int y, int w, int h));
-
+void GraphExpose P((Option *opt, int x, int y, int w, int h));
}
void
-DrawExpose (Option *opt, int x, int y, int w, int h)
+GraphExpose (Option *opt, int x, int y, int w, int h)
{
XExposeEvent e;
- opt = &mainOptions[W_BOARD];
if(!opt->handle) return;
e.x = x; e.y = y; e.width = w; e.height = h; e.count = -1; e.type = Expose; // count = -1: kludge to suppress sizing
GraphEventProc(opt->handle, (caddr_t) opt, (XEvent *) &e); // fake expose event