MyRectangle updates[4];
MyRectangle overlap;
Pnt pt;
- int count, i;
AnimState *anim = &anims[anr];
+ int count, i, x, y, w, h;
/* Save what we are about to draw into the new buffer */
CopyRectangle(anr, DISP, 0,
- frame->x, frame->y, squareSize, squareSize,
+ x = frame->x, y = frame->y, w = squareSize, h = squareSize,
0, 0);
/* Erase bits of the previous frame */
updates[i].y - anim->prevFrame.y,
updates[i].width, updates[i].height,
updates[i].x, updates[i].y);
+ /* [HGM] correct expose rectangle to encompass both overlapping squares */
+ if(x > anim->prevFrame.x) w += x - anim->prevFrame.x, x = anim->prevFrame.x;
+ else w += anim->prevFrame.x - x;
+ if(y > anim->prevFrame.y) h += y - anim->prevFrame.y, y = anim->prevFrame.y;
+ else h += anim->prevFrame.y - y;
} else {
/* Easy when no overlap */
CopyRectangle(anr, 2, DISP,
0, 0, squareSize, squareSize,
anim->prevFrame.x, anim->prevFrame.y);
+ GraphExpose(currBoard, anim->prevFrame.x, anim->prevFrame.y, squareSize, squareSize);
}
/* Save this frame for next time round */
CopyRectangle(anr, 0, DISP,
0, 0, squareSize, squareSize,
frame->x, frame->y);
+ GraphExpose(currBoard, x, y, w, h);
}
static void
cairo_rectangle (cr, destX, destY, width, height);
cairo_fill (cr);
cairo_destroy (cr);
- if(c_animBufs[anr+destBuf] == csBoardWindow)
- GraphExpose(currBoard, destX, destY, squareSize, squareSize);
+ if(c_animBufs[anr+destBuf] == csBoardWindow) // suspect that GTK needs this!
+ GraphExpose(currBoard, destX, destY, width, height);
}
void
void
GraphExpose (Option *opt, int x, int y, int w, int h)
{
+#if 0
+ GdkRectangle r;
+ r.x = x; r.y = y; r.width = w; r.height = h;
+ gdk_window_invalidate_rect(((GtkWidget *)(opt->handle))->window, &r, FALSE);
+#endif
GdkEventExpose e;
if(!opt->handle) return;
e.area.x = x; e.area.y = y; e.area.width = w; e.area.height = h; e.count = -1; e.type = GDK_EXPOSE; // count = -1: kludge to suppress sizing
- GraphEventProc(opt->handle, (GdkEvent// gtk_check_menu_item_set_active((GtkCheckMenuItem *) item->handle, state);
- *) &e, (gpointer) opt); // fake expose event
+ GraphEventProc(opt->handle, (GdkEvent *) &e, (gpointer) opt); // fake expose event
}
void GenericCallback(GtkWidget *widget, gpointer gdata)