TiJoin[XY]1 API introduction at all call sites
This commit is contained in:
parent
489f4fe057
commit
fd50bc1f4d
|
|
@ -271,6 +271,7 @@ DBPaintPlane0(plane, area, resultTbl, undo, method)
|
|||
* search.
|
||||
*/
|
||||
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
start.p_x = area->r_xbot;
|
||||
start.p_y = area->r_ytop - 1;
|
||||
tile = PlaneGetHint(plane);
|
||||
|
|
@ -439,11 +440,11 @@ enumerate:
|
|||
|
||||
/* Merge the outside tile to its top */
|
||||
tp = RT(newtile);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
||||
|
||||
/* Merge the outside tile to its bottom */
|
||||
tp = LB(newtile);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
mergeFlags &= ~MRG_RIGHT;
|
||||
}
|
||||
|
|
@ -483,11 +484,11 @@ enumerate:
|
|||
|
||||
/* Merge the outside tile to its top */
|
||||
tp = RT(newtile);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
||||
|
||||
/* Merge the outside tile to its bottom */
|
||||
tp = LB(newtile);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY(newtile, tp, plane);
|
||||
if (CANMERGE_Y(newtile, tp)) TiJoinY1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
mergeFlags &= ~MRG_LEFT;
|
||||
}
|
||||
|
|
@ -579,7 +580,7 @@ clipdone:
|
|||
if (mergeFlags & MRG_TOP)
|
||||
{
|
||||
tp = RT(tile);
|
||||
if (CANMERGE_Y(tile, tp)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tile, tp)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "merged up (CHEAP)");
|
||||
|
|
@ -588,7 +589,7 @@ clipdone:
|
|||
if (mergeFlags & MRG_BOTTOM)
|
||||
{
|
||||
tp = LB(tile);
|
||||
if (CANMERGE_Y(tile, tp)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tile, tp)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "merged down (CHEAP)");
|
||||
|
|
@ -697,6 +698,7 @@ enum2:
|
|||
|
||||
done2:
|
||||
PlaneSetHint(plane, tile);
|
||||
TiFreeIf(delayed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1032,6 +1034,7 @@ DBMergeNMTiles0(plane, area, undo, mergeOnce)
|
|||
int clipTop;
|
||||
Tile *tile, *tp, *tp2, *newtile, *tpnew;
|
||||
int aspecta, aspectb;
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
TileType ttype, ltype, rtype;
|
||||
|
||||
start.p_x = area->r_xbot;
|
||||
|
|
@ -1121,23 +1124,23 @@ nmenum:
|
|||
newtile = TiSplitY(tp2, TOP(tile));
|
||||
TiSetBody(newtile, ltype);
|
||||
if (CANMERGE_X(newtile, BL(newtile)))
|
||||
TiJoinX(newtile, BL(newtile), plane);
|
||||
TiJoinX1(&delayed, newtile, BL(newtile), plane);
|
||||
if (CANMERGE_X(newtile, TR(newtile)))
|
||||
TiJoinX(newtile, TR(newtile), plane);
|
||||
TiJoinX1(&delayed, newtile, TR(newtile), plane);
|
||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||
TiJoinY(newtile, RT(newtile), plane);
|
||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
||||
}
|
||||
if (LEFT(tp2) < LEFT(tp))
|
||||
{
|
||||
newtile = TiSplitX(tp2, LEFT(tp));
|
||||
TiSetBody(newtile, ltype);
|
||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||
TiJoinY(tp2, LB(tp2), plane);
|
||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
||||
if (CANMERGE_Y(tp2, RT(tp2)))
|
||||
TiJoinY(tp2, RT(tp2), plane);
|
||||
TiJoinY1(&delayed, tp2, RT(tp2), plane);
|
||||
tp2 = newtile;
|
||||
}
|
||||
TiJoinY(tp2, tp, plane);
|
||||
TiJoinY1(&delayed, tp2, tp, plane);
|
||||
tp = tp2;
|
||||
tp2 = RT(tp2);
|
||||
}
|
||||
|
|
@ -1151,11 +1154,11 @@ nmenum:
|
|||
newtile = TiSplitY(tp2, BOTTOM(tp));
|
||||
TiSetBody(newtile, rtype);
|
||||
if (CANMERGE_X(tp2, BL(tp2)))
|
||||
TiJoinX(tp2, BL(tp2), plane);
|
||||
TiJoinX1(&delayed, tp2, BL(tp2), plane);
|
||||
if (CANMERGE_X(tp2, TR(tp2)))
|
||||
TiJoinX(tp2, TR(tp2), plane);
|
||||
TiJoinX1(&delayed, tp2, TR(tp2), plane);
|
||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||
TiJoinY(tp2, LB(tp2), plane);
|
||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
||||
tp2 = newtile;
|
||||
}
|
||||
if (RIGHT(tp2) > RIGHT(tile))
|
||||
|
|
@ -1163,16 +1166,16 @@ nmenum:
|
|||
newtile = TiSplitX(tp2, RIGHT(tile));
|
||||
TiSetBody(newtile, rtype);
|
||||
if (CANMERGE_Y(newtile, LB(newtile)))
|
||||
TiJoinY(newtile, LB(newtile), plane);
|
||||
TiJoinY1(&delayed, newtile, LB(newtile), plane);
|
||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||
TiJoinY(newtile, RT(newtile), plane);
|
||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
||||
}
|
||||
TiJoinY(tp2, tile, plane);
|
||||
TiJoinY1(&delayed, tp2, tile, plane);
|
||||
tile = tp2;
|
||||
tp2 = LB(tp2);
|
||||
}
|
||||
/* Merge tp and tile */
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
TiSetBody(tile, ttype);
|
||||
}
|
||||
else /* split direction 1 */
|
||||
|
|
@ -1213,11 +1216,11 @@ nmenum:
|
|||
newtile = TiSplitY(tp2, BOTTOM(tp));
|
||||
TiSetBody(newtile, ltype);
|
||||
if (CANMERGE_X(tp2, BL(tp2)))
|
||||
TiJoinX(tp2, BL(tp2), plane);
|
||||
TiJoinX1(&delayed, tp2, BL(tp2), plane);
|
||||
if (CANMERGE_X(tp2, TR(tp2)))
|
||||
TiJoinX(tp2, TR(tp2), plane);
|
||||
TiJoinX1(&delayed, tp2, TR(tp2), plane);
|
||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||
TiJoinY(tp2, LB(tp2), plane);
|
||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
||||
tp2 = newtile;
|
||||
}
|
||||
if (LEFT(tp2) < LEFT(tile))
|
||||
|
|
@ -1225,12 +1228,12 @@ nmenum:
|
|||
newtile = TiSplitX(tp2, LEFT(tile));
|
||||
TiSetBody(newtile, ltype);
|
||||
if (CANMERGE_Y(tp2, LB(tp2)))
|
||||
TiJoinY(tp2, LB(tp2), plane);
|
||||
TiJoinY1(&delayed, tp2, LB(tp2), plane);
|
||||
if (CANMERGE_Y(tp2, RT(tp2)))
|
||||
TiJoinY(tp2, RT(tp2), plane);
|
||||
TiJoinY1(&delayed, tp2, RT(tp2), plane);
|
||||
tp2 = newtile;
|
||||
}
|
||||
TiJoinY(tp2, tile, plane);
|
||||
TiJoinY1(&delayed, tp2, tile, plane);
|
||||
tile = tp2;
|
||||
tp2 = LB(tp2);
|
||||
}
|
||||
|
|
@ -1245,27 +1248,27 @@ nmenum:
|
|||
newtile = TiSplitY(tp2, TOP(tile));
|
||||
TiSetBody(newtile, rtype);
|
||||
if (CANMERGE_X(newtile, BL(newtile)))
|
||||
TiJoinX(newtile, BL(newtile), plane);
|
||||
TiJoinX1(&delayed, newtile, BL(newtile), plane);
|
||||
if (CANMERGE_X(newtile, TR(newtile)))
|
||||
TiJoinX(newtile, TR(newtile), plane);
|
||||
TiJoinX1(&delayed, newtile, TR(newtile), plane);
|
||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||
TiJoinY(newtile, RT(newtile), plane);
|
||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
||||
}
|
||||
if (RIGHT(tp2) > RIGHT(tp))
|
||||
{
|
||||
newtile = TiSplitX(tp2, RIGHT(tp));
|
||||
TiSetBody(newtile, rtype);
|
||||
if (CANMERGE_Y(newtile, LB(newtile)))
|
||||
TiJoinY(newtile, LB(newtile), plane);
|
||||
TiJoinY1(&delayed, newtile, LB(newtile), plane);
|
||||
if (CANMERGE_Y(newtile, RT(newtile)))
|
||||
TiJoinY(newtile, RT(newtile), plane);
|
||||
TiJoinY1(&delayed, newtile, RT(newtile), plane);
|
||||
}
|
||||
TiJoinY(tp2, tp, plane);
|
||||
TiJoinY1(&delayed, tp2, tp, plane);
|
||||
tp = tp2;
|
||||
tp2 = RT(tp2);
|
||||
}
|
||||
/* Merge tp and tile */
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
TiSetBody(tile, ttype);
|
||||
}
|
||||
/* Now repeat until no more merging is possible */
|
||||
|
|
@ -1307,6 +1310,7 @@ nmenum:
|
|||
|
||||
nmdone:
|
||||
PlaneSetHint(plane, tile);
|
||||
TiFreeIf(delayed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1885,6 +1889,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
|||
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
||||
bool mark; /* Mark tiles that were processed */
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
Tile *tp, *tpLast;
|
||||
int ysplit;
|
||||
|
||||
|
|
@ -1991,7 +1996,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
|||
if (mark) dbMarkClient(tile, area);
|
||||
}
|
||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
||||
|
|
@ -2007,7 +2012,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
|||
if (mark) dbMarkClient(tile, area);
|
||||
}
|
||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
||||
|
|
@ -2016,7 +2021,7 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
|||
if (mergeFlags&MRG_TOP)
|
||||
{
|
||||
tp = RT(tile);
|
||||
if (CANMERGE_Y(tp, tile)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tp, tile)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
||||
|
|
@ -2025,13 +2030,14 @@ dbPaintMerge(tile, newType, area, plane, mergeFlags, undo, mark)
|
|||
if (mergeFlags&MRG_BOTTOM)
|
||||
{
|
||||
tp = LB(tile);
|
||||
if (CANMERGE_Y(tp, tile)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tp, tile)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
||||
#endif /* PAINTDEBUG */
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return (tile);
|
||||
}
|
||||
|
||||
|
|
@ -2094,6 +2100,7 @@ DBPaintType(plane, area, resultTbl, client, undo, tileMask)
|
|||
* search.
|
||||
*/
|
||||
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
start.p_x = area->r_xbot;
|
||||
start.p_y = area->r_ytop - 1;
|
||||
tile = PlaneGetHint(plane);
|
||||
|
|
@ -2186,14 +2193,14 @@ enumerate:
|
|||
if (CANMERGE_Y(newtile, tp) &&
|
||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||
TiJoinY(newtile, tp, plane);
|
||||
TiJoinY1(&delayed, newtile, tp, plane);
|
||||
|
||||
/* Merge the outside tile to its bottom */
|
||||
tp = LB(newtile);
|
||||
if (CANMERGE_Y(newtile, tp) &&
|
||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||
TiJoinY(newtile, tp, plane);
|
||||
TiJoinY1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
|
||||
/* Clip left */
|
||||
|
|
@ -2210,14 +2217,14 @@ enumerate:
|
|||
if (CANMERGE_Y(newtile, tp) &&
|
||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||
TiJoinY(newtile, tp, plane);
|
||||
TiJoinY1(&delayed, newtile, tp, plane);
|
||||
|
||||
/* Merge the outside tile to its bottom */
|
||||
tp = LB(newtile);
|
||||
if (CANMERGE_Y(newtile, tp) &&
|
||||
( (TiGetClient(tp) == TiGetClient(newtile)) ||
|
||||
( ! TTMaskHasType(tileMask, TiGetTypeExact(tp)) ) ) )
|
||||
TiJoinY(newtile, tp, plane);
|
||||
TiJoinY1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
|
||||
#ifdef PAINTDEBUG
|
||||
|
|
@ -2276,7 +2283,7 @@ enumerate:
|
|||
{
|
||||
tp = RT(tile);
|
||||
if (CANMERGE_Y(tile, tp) && (tp->ti_client == client))
|
||||
TiJoinY(tile, tp, plane);
|
||||
TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "merged up (CHEAP)");
|
||||
|
|
@ -2286,7 +2293,7 @@ enumerate:
|
|||
{
|
||||
tp = LB(tile);
|
||||
if (CANMERGE_Y(tile, tp) && (tp->ti_client == client))
|
||||
TiJoinY(tile, tp, plane);
|
||||
TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "merged down (CHEAP)");
|
||||
|
|
@ -2334,6 +2341,7 @@ paintdone:
|
|||
|
||||
done:
|
||||
PlaneSetHint(plane, tile);
|
||||
TiFreeIf(delayed);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2380,6 +2388,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
|||
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
||||
ClientData client;
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
Tile *tp, *tpLast;
|
||||
int ysplit;
|
||||
|
||||
|
|
@ -2481,7 +2490,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
|||
TiSetClient(tpLast, client);
|
||||
}
|
||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
||||
|
|
@ -2497,7 +2506,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
|||
TiSetClient(tpLast, client);
|
||||
}
|
||||
if (BOTTOM(tp) < BOTTOM(tile)) tp = TiSplitY(tp, BOTTOM(tile));
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
||||
|
|
@ -2506,7 +2515,7 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
|||
if (mergeFlags&MRG_TOP)
|
||||
{
|
||||
tp = RT(tile);
|
||||
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
||||
|
|
@ -2515,13 +2524,14 @@ dbMergeType(tile, newType, plane, mergeFlags, undo, client)
|
|||
if (mergeFlags&MRG_BOTTOM)
|
||||
{
|
||||
tp = LB(tile);
|
||||
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tp, tile) && (tp->ti_client == client)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
||||
#endif /* PAINTDEBUG */
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return (tile);
|
||||
}
|
||||
|
||||
|
|
@ -2581,6 +2591,7 @@ DBPaintPlaneVert(plane, area, resultTbl, undo)
|
|||
* search.
|
||||
*/
|
||||
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
start.p_x = area->r_xbot;
|
||||
start.p_y = area->r_ytop - 1;
|
||||
tile = PlaneGetHint(plane);
|
||||
|
|
@ -2662,11 +2673,11 @@ enumerate:
|
|||
|
||||
/* Merge the outside tile to its left */
|
||||
tp = BL(newtile);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
||||
|
||||
/* Merge the outside tile to its right */
|
||||
tp = TR(newtile);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
|
||||
/* Clip down */
|
||||
|
|
@ -2678,11 +2689,11 @@ enumerate:
|
|||
|
||||
/* Merge the outside tile to its left */
|
||||
tp = BL(newtile);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
||||
|
||||
/* Merge the outside tile to its right */
|
||||
tp = TR(newtile);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX(newtile, tp, plane);
|
||||
if (CANMERGE_X(newtile, tp)) TiJoinX1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
|
||||
#ifdef PAINTDEBUG
|
||||
|
|
@ -2740,7 +2751,7 @@ enumerate:
|
|||
if (mergeFlags & MRG_LEFT)
|
||||
{
|
||||
tp = BL(tile);
|
||||
if (CANMERGE_X(tile, tp)) TiJoinX(tile, tp, plane);
|
||||
if (CANMERGE_X(tile, tp)) TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "merged left (CHEAP)");
|
||||
|
|
@ -2749,7 +2760,7 @@ enumerate:
|
|||
if (mergeFlags & MRG_RIGHT)
|
||||
{
|
||||
tp = TR(tile);
|
||||
if (CANMERGE_X(tile, tp)) TiJoinX(tile, tp, plane);
|
||||
if (CANMERGE_X(tile, tp)) TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "merged right (CHEAP)");
|
||||
|
|
@ -2797,6 +2808,7 @@ paintdone:
|
|||
|
||||
done:
|
||||
PlaneSetHint(plane, tile);
|
||||
TiFreeIf(delayed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2849,6 +2861,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
|||
int mergeFlags; /* Specify which directions to merge */
|
||||
PaintUndoInfo *undo; /* See DBPaintPlane() above */
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
Tile *tp, *tpLast;
|
||||
int xsplit;
|
||||
|
||||
|
|
@ -2943,7 +2956,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
|||
if (LEFT(tp) < LEFT(tile)) tp = TiSplitX(tp, LEFT(tile));
|
||||
if (RIGHT(tp) > RIGHT(tile))
|
||||
tpLast = TiSplitX(tp, RIGHT(tile)), TiSetBody(tpLast, newType);
|
||||
TiJoinY(tile, tp, plane);
|
||||
TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged up");
|
||||
|
|
@ -2956,7 +2969,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
|||
if (LEFT(tp) < LEFT(tile)) tp = TiSplitX(tp, LEFT(tile));
|
||||
if (RIGHT(tp) > RIGHT(tile))
|
||||
tpLast = TiSplitX(tp, RIGHT(tile)), TiSetBody(tpLast, newType);
|
||||
TiJoinY(tile, tp, plane);
|
||||
TiJoinY1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged down");
|
||||
|
|
@ -2966,7 +2979,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
|||
if (mergeFlags&MRG_LEFT)
|
||||
{
|
||||
tp = BL(tile);
|
||||
if (CANMERGE_X(tp, tile)) TiJoinX(tile, tp, plane);
|
||||
if (CANMERGE_X(tp, tile)) TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged left");
|
||||
|
|
@ -2975,13 +2988,14 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
|||
if (mergeFlags&MRG_RIGHT)
|
||||
{
|
||||
tp = TR(tile);
|
||||
if (CANMERGE_X(tp, tile)) TiJoinX(tile, tp, plane);
|
||||
if (CANMERGE_X(tp, tile)) TiJoinX1(&delayed, tile, tp, plane);
|
||||
#ifdef PAINTDEBUG
|
||||
if (dbPaintDebug)
|
||||
dbPaintShowTile(tile, undo, "(DBMERGE) merged right");
|
||||
#endif /* PAINTDEBUG */
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return (tile);
|
||||
}
|
||||
|
||||
|
|
@ -3316,6 +3330,7 @@ TiNMMergeRight(tile, plane)
|
|||
Tile *tile;
|
||||
Plane *plane;
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
TileType ttype = TiGetTypeExact(tile);
|
||||
Tile *tp, *tp2, *newtile;
|
||||
|
||||
|
|
@ -3347,7 +3362,7 @@ TiNMMergeRight(tile, plane)
|
|||
else
|
||||
newtile = tile;
|
||||
// Join tp to newtile
|
||||
TiJoinX(newtile, tp, plane);
|
||||
TiJoinX1(&delayed, newtile, tp, plane);
|
||||
}
|
||||
tp = tp2;
|
||||
}
|
||||
|
|
@ -3364,11 +3379,13 @@ TiNMMergeRight(tile, plane)
|
|||
newtile = TiSplitY(tp, BOTTOM(tile));
|
||||
TiSetBody(newtile, ttype);
|
||||
// join newtile to tile
|
||||
TiJoinX(tile, newtile, plane);
|
||||
TiJoinX1(&delayed, tile, newtile, plane);
|
||||
// merge up if possible
|
||||
if (CANMERGE_Y(tile, RT(tile))) TiJoinY(tile, RT(tile), plane);
|
||||
if (CANMERGE_Y(tile, RT(tile))) TiJoinY1(&delayed, tile, RT(tile), plane);
|
||||
}
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return tile;
|
||||
}
|
||||
|
||||
|
|
@ -3396,6 +3413,7 @@ TiNMMergeLeft(tile, plane)
|
|||
Tile *tile;
|
||||
Plane *plane;
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
TileType ttype = TiGetTypeExact(tile);
|
||||
Tile *tp, *tp2, *newtile;
|
||||
|
||||
|
|
@ -3428,7 +3446,7 @@ TiNMMergeLeft(tile, plane)
|
|||
else
|
||||
newtile = tile;
|
||||
// Join tp to tile
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
tile = newtile;
|
||||
}
|
||||
tp = tp2;
|
||||
|
|
@ -3446,14 +3464,16 @@ TiNMMergeLeft(tile, plane)
|
|||
newtile = TiSplitY(tp, TOP(tile));
|
||||
TiSetBody(newtile, ttype);
|
||||
// join tp to tile
|
||||
TiJoinX(tile, tp, plane);
|
||||
TiJoinX1(&delayed, tile, tp, plane);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Merge up if possible
|
||||
if (CANMERGE_Y(tile, tp)) TiJoinY(tile, tp, plane);
|
||||
if (CANMERGE_Y(tile, tp)) TiJoinY1(&delayed, tile, tp, plane);
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return tile;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -571,6 +571,7 @@ glChanMergeFunc(tile)
|
|||
Tile *tile;
|
||||
{
|
||||
GCRChannel *ch = (GCRChannel *) tile->ti_client;
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
Tile *tp;
|
||||
int ret;
|
||||
|
||||
|
|
@ -582,7 +583,7 @@ glChanMergeFunc(tile)
|
|||
&& LEFT(tp) == LEFT(tile)
|
||||
&& RIGHT(tp) == RIGHT(tile))
|
||||
{
|
||||
TiJoinY(tile, tp, glChanPlane);
|
||||
TiJoinY1(&delayed, tile, tp, glChanPlane);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -593,7 +594,7 @@ glChanMergeFunc(tile)
|
|||
&& TOP(tp) == TOP(tile)
|
||||
&& BOTTOM(tp) == BOTTOM(tile))
|
||||
{
|
||||
TiJoinX(tile, tp, glChanPlane);
|
||||
TiJoinX1(&delayed, tile, tp, glChanPlane);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -604,7 +605,7 @@ glChanMergeFunc(tile)
|
|||
&& LEFT(tp) == LEFT(tile)
|
||||
&& RIGHT(tp) == RIGHT(tile))
|
||||
{
|
||||
TiJoinY(tile, tp, glChanPlane);
|
||||
TiJoinY1(&delayed, tile, tp, glChanPlane);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -615,11 +616,12 @@ glChanMergeFunc(tile)
|
|||
&& TOP(tp) == TOP(tile)
|
||||
&& BOTTOM(tp) == BOTTOM(tile))
|
||||
{
|
||||
TiJoinX(tile, tp, glChanPlane);
|
||||
TiJoinX1(&delayed, tile, tp, glChanPlane);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ bool plowPropagateSel();
|
|||
bool plowPropagateRect(CellDef *def, Rect *userRect, const TileTypeBitMask *lcp, Rect *changedArea);
|
||||
PlowRule *plowBuildWidthRules();
|
||||
|
||||
void plowMergeBottom(Tile *, Plane *);
|
||||
void plowMergeBottom(Tile **delay1, Tile *tp, Plane *plane);
|
||||
void plowInitRule(RuleTableEntry *rtePtr, RuleTableEntry *rteEnd, int whichRules, int (*proc)(), const char *name,
|
||||
const TileTypeBitMask *ltypesp, const TileTypeBitMask *rtypesp);
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ extern void plowUpdate();
|
|||
extern void plowSetTrans();
|
||||
extern void plowProcessEdge();
|
||||
extern void plowMoveEdge();
|
||||
extern void plowMergeTop();
|
||||
extern void plowMergeTop(Tile **delay1, Tile *tp, Plane *plane);
|
||||
extern void plowYankCreate();
|
||||
|
||||
|
||||
|
|
@ -1829,6 +1829,7 @@ plowMoveEdge(edge)
|
|||
Edge *edge; /* Edge to be moved */
|
||||
{
|
||||
Plane *plane = plowYankDef->cd_planes[edge->e_pNum];
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
Tile *tp, *tpL;
|
||||
Point p;
|
||||
|
||||
|
|
@ -1863,7 +1864,7 @@ plowMoveEdge(edge)
|
|||
{
|
||||
if (TRAILING(tp) < edge->e_newx)
|
||||
plowSetTrailing(tp, edge->e_newx);
|
||||
plowMergeTop(tp, plane);
|
||||
plowMergeTop(&delayed, tp, plane);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1886,18 +1887,18 @@ plowMoveEdge(edge)
|
|||
/* Merge (no clipping was necessary) */
|
||||
tpL = BL(tp);
|
||||
plowSetTrailing(tp, edge->e_newx);
|
||||
plowMergeBottom(tp, plane);
|
||||
plowMergeBottom(&delayed, tp, plane);
|
||||
}
|
||||
|
||||
/* Split the bottom-left tile if necessary; otherwise, merge down */
|
||||
if (BOTTOM(tpL) < edge->e_ybot)
|
||||
tpL = plowSplitY(tpL, edge->e_ybot); /* TpL is upper tile */
|
||||
else
|
||||
plowMergeBottom(tpL, plane);
|
||||
plowMergeBottom(&delayed, tpL, plane);
|
||||
}
|
||||
else for (tpL = BL(tp); TOP(tpL) <= edge->e_ybot; tpL = RT(tpL))
|
||||
/* Nothing */;
|
||||
plowMergeTop(tp, plane);
|
||||
plowMergeTop(&delayed, tp, plane);
|
||||
|
||||
/*
|
||||
* Now 'tpL' is the bottom-left tile, which has already been merged
|
||||
|
|
@ -1905,7 +1906,7 @@ plowMoveEdge(edge)
|
|||
* each tile with its lower neighbor.
|
||||
*/
|
||||
for (tp = RT(tpL); BOTTOM(tp) < edge->e_ytop; tp = RT(tp))
|
||||
plowMergeBottom(tp, plane);
|
||||
plowMergeBottom(&delayed, tp, plane);
|
||||
|
||||
/*
|
||||
* If tp now extends above edge->e_ytop, then it must not have been split
|
||||
|
|
@ -1914,10 +1915,12 @@ plowMoveEdge(edge)
|
|||
* not changed. Hence, we needn't try to merge to its bottom.
|
||||
*/
|
||||
if (BOTTOM(tp) == edge->e_ytop)
|
||||
plowMergeBottom(tp, plane);
|
||||
plowMergeBottom(&delayed, tp, plane);
|
||||
|
||||
if (DebugIsSet(plowDebugID, plowDebMove))
|
||||
plowDebugEdge(edge, (RuleTableEntry *) NULL, "move");
|
||||
|
||||
TiFreeIf(delayed);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1979,9 +1982,7 @@ plowSplitY(tp, y)
|
|||
*/
|
||||
|
||||
void
|
||||
plowMergeTop(tp, plane)
|
||||
Tile *tp;
|
||||
Plane *plane;
|
||||
plowMergeTop(Tile **delay1, Tile *tp, Plane *plane)
|
||||
{
|
||||
Tile *tpRT = RT(tp);
|
||||
|
||||
|
|
@ -1989,14 +1990,12 @@ plowMergeTop(tp, plane)
|
|||
&& LEFT(tp) == LEFT(tpRT) && RIGHT(tp) == RIGHT(tpRT)
|
||||
&& LEADING(tp) == LEADING(tpRT) && TRAILING(tp) == TRAILING(tpRT))
|
||||
{
|
||||
TiJoinY(tp, tpRT, plane);
|
||||
TiJoinY1(delay1, tp, tpRT, plane);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
plowMergeBottom(tp, plane)
|
||||
Tile *tp;
|
||||
Plane *plane;
|
||||
plowMergeBottom(Tile **delay1, Tile *tp, Plane *plane)
|
||||
{
|
||||
Tile *tpLB = LB(tp);
|
||||
|
||||
|
|
@ -2004,7 +2003,7 @@ plowMergeBottom(tp, plane)
|
|||
&& LEFT(tp) == LEFT(tpLB) && RIGHT(tp) == RIGHT(tpLB)
|
||||
&& LEADING(tp) == LEADING(tpLB) && TRAILING(tp) == TRAILING(tpLB))
|
||||
{
|
||||
TiJoinY(tp, tpLB, plane);
|
||||
TiJoinY1(delay1, tp, tpLB, plane);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -438,6 +438,7 @@ ResSplitX(tile, x)
|
|||
int x;
|
||||
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
TileType tt = TiGetType(tile);
|
||||
Tile *tp = TiSplitX(tile, x);
|
||||
Tile *tp2;
|
||||
|
|
@ -450,13 +451,13 @@ ResSplitX(tile, x)
|
|||
if (tp2 == resSrTile)
|
||||
{
|
||||
if (resTopTile == tile) resTopTile = NULL;
|
||||
TiJoinY(tp2, tile, resFracPlane);
|
||||
TiJoinY1(&delayed, tp2, tile, resFracPlane);
|
||||
tile = tp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resTopTile == tp2) resTopTile = NULL;
|
||||
TiJoinY(tile, tp2, resFracPlane);
|
||||
TiJoinY1(&delayed, tile, tp2, resFracPlane);
|
||||
}
|
||||
}
|
||||
tp2 = LB(tile);
|
||||
|
|
@ -465,26 +466,28 @@ ResSplitX(tile, x)
|
|||
if (tp2 == resSrTile)
|
||||
{
|
||||
if (resTopTile == tile) resTopTile = NULL;
|
||||
TiJoinY(tp2, tile, resFracPlane);
|
||||
TiJoinY1(&delayed, tp2, tile, resFracPlane);
|
||||
tile = tp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resTopTile == tp2) resTopTile = NULL;
|
||||
TiJoinY(tile, tp2, resFracPlane);
|
||||
TiJoinY1(&delayed, tile, tp2, resFracPlane);
|
||||
}
|
||||
}
|
||||
/* do the same checks with the newly created tile */
|
||||
tp2 = RT(tp);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tp) && RIGHT(tp2) == RIGHT(tp))
|
||||
{
|
||||
TiJoinY(tp2, tp, resFracPlane);
|
||||
TiJoinY1(&delayed, tp2, tp, resFracPlane);
|
||||
tp = tp2;
|
||||
}
|
||||
tp2 = LB(tp);
|
||||
if (TiGetType(tp2) == tt && LEFT(tp2) == LEFT(tp) && RIGHT(tp2) == RIGHT(tp))
|
||||
{
|
||||
TiJoinY(tp2, tp, resFracPlane);
|
||||
TiJoinY1(&delayed, tp2, tp, resFracPlane);
|
||||
}
|
||||
|
||||
TiFreeIf(delayed);
|
||||
return tile;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ extern void rtrRoundRect();
|
|||
extern void rtrHashKill();
|
||||
extern void rtrSplitToArea();
|
||||
extern void rtrMarkChannel();
|
||||
extern void rtrMerge();
|
||||
extern void rtrMerge(Tile **delay1, Tile *tup, Tile *tdn, Plane *plane);
|
||||
|
||||
bool rtrUseCorner();
|
||||
|
||||
|
|
@ -775,6 +775,7 @@ rtrMarkChannel(plane, tiles, point, corner)
|
|||
}
|
||||
else /* Choose the vertical boundary */
|
||||
{
|
||||
Tile *delayed = NULL; /* delayed free to extend lifetime */
|
||||
/*
|
||||
* Split a sequence of space tiles starting with tiles[0]
|
||||
* (the bottom tile), for yDist at the point->p_y.
|
||||
|
|
@ -810,8 +811,8 @@ rtrMarkChannel(plane, tiles, point, corner)
|
|||
rtrCLEAR(tile, rtrSE);
|
||||
|
||||
/* Merge tile and new with lower neighbors if possible */
|
||||
rtrMerge(new, LB(new), plane);
|
||||
rtrMerge(tile, LB(tile), plane);
|
||||
rtrMerge(&delayed, new, LB(new), plane);
|
||||
rtrMerge(&delayed, tile, LB(tile), plane);
|
||||
|
||||
/* Find next (higher) tile to split */
|
||||
if (TOP(tile) >= lastY) break;
|
||||
|
|
@ -820,8 +821,9 @@ rtrMarkChannel(plane, tiles, point, corner)
|
|||
}
|
||||
|
||||
/* Merge new and tile with upper neighbors if possible */
|
||||
rtrMerge(RT(new), new, plane);
|
||||
rtrMerge(RT(tile), tile, plane);
|
||||
rtrMerge(&delayed, RT(new), new, plane);
|
||||
rtrMerge(&delayed, RT(tile), tile, plane);
|
||||
TiFreeIf(delayed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -983,9 +985,7 @@ rtrXDist(tiles, x, isRight)
|
|||
*/
|
||||
|
||||
void
|
||||
rtrMerge(tup, tdn, plane)
|
||||
Tile *tup, *tdn;
|
||||
Plane *plane;
|
||||
rtrMerge(Tile **delay1, Tile *tup, Tile *tdn, Plane *plane)
|
||||
{
|
||||
Tile *side;
|
||||
|
||||
|
|
@ -1006,7 +1006,7 @@ rtrMerge(tup, tdn, plane)
|
|||
|
||||
if (rtrMARKED(tdn, rtrSW)) rtrMARK(tup, rtrSW); else rtrCLEAR(tup, rtrSW);
|
||||
if (rtrMARKED(tdn, rtrSE)) rtrMARK(tup, rtrSE); else rtrCLEAR(tup, rtrSE);
|
||||
TiJoinY(tup, tdn, plane);
|
||||
TiJoinY1(delay1, tup, tdn, plane);
|
||||
|
||||
/*
|
||||
* Merge sideways if the result of the join matches a tile on either side,
|
||||
|
|
@ -1017,12 +1017,12 @@ rtrMerge(tup, tdn, plane)
|
|||
&& LEFT(side) >= RouteArea.r_xbot
|
||||
&& TOP(side) == TOP(tup)
|
||||
&& BOTTOM(side) == BOTTOM(tup))
|
||||
TiJoinX(tup, side, plane);
|
||||
TiJoinX1(delay1, tup, side, plane);
|
||||
|
||||
side = TR(tup);
|
||||
if (TiGetBody(side) == (ClientData) NULL
|
||||
&& RIGHT(side) <= RouteArea.r_xtop
|
||||
&& TOP(side) == TOP(tup)
|
||||
&& BOTTOM(side) == BOTTOM(tup))
|
||||
TiJoinX(tup, side, plane);
|
||||
TiJoinX1(delay1, tup, side, plane);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue