if (++cnt >= 10) {
if (++cnt >= BO_MAX) {
void blackout_tiles(void) {	int tx, ty;	if (! blackouts) {		return;	}	/* 	 * to simplify things drop down to single copy mode, no vcr, etc...	 */	single_copytile = 1;	if (show_mouse) {		rfbLog("disabling remote mouse drawing due to blackouts\n");		show_mouse = 0;	}	/* loop over all tiles. */	for (ty=0; ty < ntiles_y; ty++) {		for (tx=0; tx < ntiles_x; tx++) {			sraRegionPtr tile_reg, black_reg;			sraRect rect;			sraRectangleIterator *iter;			int n, b, x1, y1, x2, y2, cnt;			/* tile number and coordinates: */			n = tx + ty * ntiles_x;			x1 = tx * tile_x;			y1 = ty * tile_y;			x2 = x1 + tile_x;			y2 = y1 + tile_y;			if (x2 > dpy_x) {				x2 = dpy_x;			}			if (y2 > dpy_y) {				y2 = dpy_y;			}			/* make regions for the tile and the blackouts: */			black_reg = (sraRegionPtr) sraRgnCreate();			tile_reg  = (sraRegionPtr) sraRgnCreateRect(x1, y1,			    x2, y2);			tile_blackout[n].cover = 0;			tile_blackout[n].count = 0;			/* union of blackouts */			for (b=0; b < blackouts; b++) {				sraRegionPtr tmp_reg = (sraRegionPtr)				    sraRgnCreateRect(blackr[b].x1, blackr[b].y1,				    blackr[b].x2, blackr[b].y2);				sraRgnOr(black_reg, tmp_reg);				sraRgnDestroy(tmp_reg);			}			if (! sraRgnAnd(black_reg, tile_reg)) {				/*				 * no intersection for this tile, so we				 * are done.				 */				sraRgnDestroy(black_reg);				sraRgnDestroy(tile_reg);				continue;			}			/*			 * loop over rectangles that make up the blackout			 * region:			 */			cnt = 0;			iter = sraRgnGetIterator(black_reg);			while (sraRgnIteratorNext(iter, &rect)) {				/* make sure x1 < x2 and y1 < y2 */				if (rect.x1 > rect.x2) {					int tmp = rect.x2;					rect.x2 = rect.x1;					rect.x1 = tmp;				}				if (rect.y1 > rect.y2) {					int tmp = rect.y2;					rect.y2 = rect.y1;					rect.y1 = tmp;				}				/* store coordinates */				tile_blackout[n].bo[cnt].x1 = rect.x1;				tile_blackout[n].bo[cnt].y1 = rect.y1;				tile_blackout[n].bo[cnt].x2 = rect.x2;				tile_blackout[n].bo[cnt].y2 = rect.y2;				/* note if the tile is completely obscured */				if (rect.x1 == x1 && rect.y1 == y1 &&				    rect.x2 == x2 && rect.y2 == y2) {					tile_blackout[n].cover = 2;				} else {					tile_blackout[n].cover = 1;				}				if (++cnt >= 10) {					rfbLog("too many blackout rectangles "					    "for tile %d=%d,%d.\n", n, tx, ty);					break;				}			}			sraRgnReleaseIterator(iter);			sraRgnDestroy(black_reg);			sraRgnDestroy(tile_reg);			tile_blackout[n].count = cnt;		}	}}