From 1cc4d8342573a5a077a2ed0156a6245f85d1d023 Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Mon, 28 Jul 2025 11:53:44 -0400 Subject: [PATCH] Corrected an issue with "bloat-all ... [dist]" in which an attempt not to re-process processed tiles made an incorrect assumption, causing tiles not to be re-processed when the clip area changed, such that areas would be missed. It is not clear that in its corrected version, "bloat-all ... [dist]" is any more efficient than the original implementation of an incremental series of bloat + AND. At least the syntax in the tech file is much simplified. --- VERSION | 2 +- cif/CIFgen.c | 71 +++++++++++++++------------------------------------- 2 files changed, 21 insertions(+), 52 deletions(-) diff --git a/VERSION b/VERSION index 499be463..26ec6e1c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.532 +8.3.533 diff --git a/cif/CIFgen.c b/cif/CIFgen.c index cfc8b9d3..9d05d554 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -1282,8 +1282,13 @@ cifProcessSelectiveResetFunc(tile, clipArea) * Find the first tile in the given area. * * Results: - * Return 1 to stop the search and process. - * Set clientData to the tile found. + * Return 1 to stop the search and process if an + * unprocessed tile was found. Otherwise, return + * 0 to keep the search going. + * + * Side effects: + * Push tile pointer to the stack that is passed + * as client data. * *------------------------------------------------------- */ @@ -1293,8 +1298,13 @@ cifFoundFunc( Tile *tile, Stack **BloatStackPtr) { - PUSHTILE(tile, *BloatStackPtr); - return 0; + if (TiGetClient(tile) == CIF_UNPROCESSED) + { + PUSHTILE(tile, *BloatStackPtr); + return 1; + } + else + return 0; } /* Data structure for bloat-all function */ @@ -1425,33 +1435,11 @@ cifBloatAllFunc( if (bloats->bl_distance[ttype] > 0) (void) DBSrPaintArea((Tile *)NULL, *temps, &area, &CIFSolidBits, cifFoundFunc, (ClientData)(&BloatStack)); - - /* Get clip area from intersection of found tile and t */ - if (op->co_distance > 0) - { - if (!StackEmpty(BloatStack)) - { - firstTile = (Tile *)StackLook(BloatStack); - TiToRect(firstTile, &foundArea); - GeoClip(&clipArea, &foundArea); - } - } } else { DBSrPaintArea((Tile *)NULL, def->cd_planes[bloats->bl_plane], &area, connect, cifFoundFunc, (ClientData)(&BloatStack)); - - /* Get clip area from intersection of found tile and t */ - if (op->co_distance > 0) - { - if (!StackEmpty(BloatStack)) - { - firstTile = (Tile *)StackLook(BloatStack); - TiToRect(firstTile, &foundArea); - GeoClip(&clipArea, &foundArea); - } - } } } else @@ -1490,10 +1478,12 @@ cifBloatAllFunc( if (op->co_distance > 0) { - if (!GEO_SURROUND(&clipArea, &area)) - { - STACKPUSH(t, ResetStack); - } + /* Note: This is non-optimal, as it causes all tiles + * in the "bloat" group to be re-processed for each + * tile processed in the search group. However, it + * is difficult to find an optimal method. + */ + STACKPUSH(t, ResetStack); GeoClip(&area, &clipArea); if (GEO_RECTNULL(&area)) continue; @@ -1557,27 +1547,6 @@ cifBloatAllFunc( TiSetClient(t, CIF_UNPROCESSED); } -#if 0 - if ((firstTile != NULL) && (op->co_distance > 0)) - { - if (bloats->bl_plane < 0) - { - /* This would be a lot more efficient if the plane number of - * firstTile were pushed to the stack along with firstTile - */ - temps = bls->temps; - for (ttype = 0; ttype < TT_MAXTYPES; ttype++, temps++) - if (bloats->bl_distance[ttype] > 0) - (void) DBSrPaintArea((Tile *)NULL, *temps, &clipArea, - &CIFSolidBits, cifProcessSelectiveResetFunc, - &clipArea); - } - else - DBSrPaintArea((Tile *)firstTile, def->cd_planes[bloats->bl_plane], - &clipArea, connect, cifProcessSelectiveResetFunc, &clipArea); - } -#endif - return 0; /* Keep the search alive. . . */ }