Corrected some basic paint code related to drawing over top non-
Manhattan tiles. After splitting a non-Manhattan tile crossing a search area to paint, the routine was automatically merging tiles to the right. This is incorrect for tiles inside the search area, as it can cause the search algorithm to miss unvisited tiles whose origins are to the left of the split tile, resulting in part of the area not getting painted.
This commit is contained in:
parent
1ec8b6ee1a
commit
8ed7394431
|
|
@ -59,6 +59,8 @@ Tile *TiNMMergeRight();
|
||||||
Tile *TiNMMergeLeft();
|
Tile *TiNMMergeLeft();
|
||||||
|
|
||||||
#ifdef PAINTDEBUG
|
#ifdef PAINTDEBUG
|
||||||
|
void dbPaintShowTile(Tile *tile, PaintUndoInfo *undo, char *str);
|
||||||
|
|
||||||
int dbPaintDebug = 0;
|
int dbPaintDebug = 0;
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
|
|
||||||
|
|
@ -311,6 +313,11 @@ enumerate:
|
||||||
* Set up the directions in which we will have to
|
* Set up the directions in which we will have to
|
||||||
* merge initially. Clipping can cause some of these
|
* merge initially. Clipping can cause some of these
|
||||||
* to be turned off.
|
* to be turned off.
|
||||||
|
*
|
||||||
|
* The search runs from left to right, top to bottom.
|
||||||
|
* Therefore always merge left and up, but never right
|
||||||
|
* and down, unless at or beyond the each of the search
|
||||||
|
* area.
|
||||||
*/
|
*/
|
||||||
mergeFlags = MRG_TOP | MRG_LEFT;
|
mergeFlags = MRG_TOP | MRG_LEFT;
|
||||||
if (RIGHT(tile) >= area->r_xtop) mergeFlags |= MRG_RIGHT;
|
if (RIGHT(tile) >= area->r_xtop) mergeFlags |= MRG_RIGHT;
|
||||||
|
|
@ -340,6 +347,7 @@ enumerate:
|
||||||
* Merging is only necessary if we clip to the left or to
|
* Merging is only necessary if we clip to the left or to
|
||||||
* the right, and then only to the top or the bottom.
|
* the right, and then only to the top or the bottom.
|
||||||
* We do the merge in-line for efficiency.
|
* We do the merge in-line for efficiency.
|
||||||
|
* Clipping of split tiles is more complicated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Clip up */
|
/* Clip up */
|
||||||
|
|
@ -354,13 +362,17 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
tile = TiNMMergeLeft(tile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
TiNMMergeRight(TR(newtile), plane);
|
tile = TiNMMergeLeft(tile, plane);
|
||||||
|
if ((mergeFlags & MRG_RIGHT) || SplitDirection(newtile) == 1)
|
||||||
|
TiNMMergeRight(TR(newtile), plane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TiNMMergeLeft(newtile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
TiNMMergeRight(TR(tile), plane);
|
TiNMMergeLeft(newtile, plane);
|
||||||
|
if ((mergeFlags & MRG_RIGHT) || SplitDirection(tile) == 1)
|
||||||
|
TiNMMergeRight(TR(tile), plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -389,13 +401,17 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
tile = TiNMMergeLeft(tile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
TiNMMergeRight(TR(newtile), plane);
|
tile = TiNMMergeLeft(tile, plane);
|
||||||
|
if ((mergeFlags & MRG_RIGHT) || SplitDirection(newtile) == 0)
|
||||||
|
TiNMMergeRight(TR(newtile), plane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TiNMMergeLeft(newtile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
TiNMMergeRight(TR(tile), plane);
|
TiNMMergeLeft(newtile, plane);
|
||||||
|
if ((mergeFlags & MRG_RIGHT) || SplitDirection(tile) == 0)
|
||||||
|
TiNMMergeRight(TR(tile), plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -424,13 +440,17 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
tile = TiNMMergeLeft(tile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
TiNMMergeRight(LB(newtile), plane);
|
tile = TiNMMergeLeft(tile, plane);
|
||||||
|
if (mergeFlags & MRG_RIGHT)
|
||||||
|
TiNMMergeRight(LB(newtile), plane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TiNMMergeRight(newtile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
TiNMMergeLeft(LB(tile), plane);
|
TiNMMergeRight(newtile, plane);
|
||||||
|
if (mergeFlags & MRG_RIGHT)
|
||||||
|
TiNMMergeLeft(LB(tile), plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -467,13 +487,17 @@ enumerate:
|
||||||
newType = (method == (unsigned char)PAINT_XOR) ?
|
newType = (method == (unsigned char)PAINT_XOR) ?
|
||||||
*resultTbl : resultTbl[oldType];
|
*resultTbl : resultTbl[oldType];
|
||||||
|
|
||||||
// tile = TiNMMergeRight(tile, plane);
|
if (mergeFlags & MRG_RIGHT)
|
||||||
TiNMMergeLeft(LB(newtile), plane);
|
tile = TiNMMergeRight(tile, plane); // was commented out?
|
||||||
|
if (mergeFlags & MRG_LEFT)
|
||||||
|
TiNMMergeLeft(LB(newtile), plane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TiNMMergeLeft(newtile, plane);
|
if (mergeFlags & MRG_LEFT)
|
||||||
// TiNMMergeRight(LB(tile), plane);
|
TiNMMergeLeft(newtile, plane);
|
||||||
|
if (mergeFlags & MRG_RIGHT)
|
||||||
|
TiNMMergeRight(LB(tile), plane); // was commented out?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3018,7 +3042,7 @@ dbPaintMergeVert(tile, newType, plane, mergeFlags, undo)
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "styles.h"
|
#include "utils/styles.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
dbPaintShowTile(tile, undo, str)
|
dbPaintShowTile(tile, undo, str)
|
||||||
|
|
@ -3041,6 +3065,16 @@ dbPaintShowTile(tile, undo, str)
|
||||||
TxPrintf("%s --more--", str); fflush(stdout);
|
TxPrintf("%s --more--", str); fflush(stdout);
|
||||||
(void) TxGetLine(answer, sizeof answer);
|
(void) TxGetLine(answer, sizeof answer);
|
||||||
DBWFeedbackClear(NULL);
|
DBWFeedbackClear(NULL);
|
||||||
|
|
||||||
|
/* To debug tile operations that happen away from the active layout
|
||||||
|
* window, it may be advantageous to replace the display code above
|
||||||
|
* with the print statement below.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
TxPrintf("Debug %s: Tile (%d %d) to (%d %d) type %d\n",
|
||||||
|
str, LEFT(tile), BOTTOM(tile), RIGHT(tile), TOP(tile),
|
||||||
|
TiGetBody(tile));
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#endif /* PAINTDEBUG */
|
#endif /* PAINTDEBUG */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue