Corrected an error in the CIF read routine, caused when adding

handling for grid subdivision.  Scaled the value of "center"
for a CIF box and then attempted to use "center" as an unscaled
value.  Same correction as made to magic-8.1.
This commit is contained in:
Tim Edwards 2017-12-18 20:24:06 -05:00
parent 6b41c3fa3e
commit 5be0653afe
1 changed files with 10 additions and 10 deletions

View File

@ -1106,7 +1106,7 @@ bool
cifParseUser95() cifParseUser95()
{ {
Rect rectangle; Rect rectangle;
Point size, center; Point size, center, cscaled;
char *name = NULL; char *name = NULL;
TileType type; TileType type;
int layer, i; int layer, i;
@ -1131,30 +1131,30 @@ cifParseUser95()
/* so that half-lambda centers are resolved before remapping to */ /* so that half-lambda centers are resolved before remapping to */
/* magic coordinates. */ /* magic coordinates. */
center.p_x = CIFScaleCoord(center.p_x - size.p_x/2, COORD_ANY); cscaled.p_x = CIFScaleCoord(center.p_x - size.p_x/2, COORD_ANY);
savescale = cifCurReadStyle->crs_scaleFactor; savescale = cifCurReadStyle->crs_scaleFactor;
center.p_y = CIFScaleCoord(center.p_y - size.p_y/2, COORD_ANY); cscaled.p_y = CIFScaleCoord(center.p_y - size.p_y/2, COORD_ANY);
if (savescale != cifCurReadStyle->crs_scaleFactor) if (savescale != cifCurReadStyle->crs_scaleFactor)
{ {
center.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor); cscaled.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor);
savescale = cifCurReadStyle->crs_scaleFactor; savescale = cifCurReadStyle->crs_scaleFactor;
} }
size.p_x = CIFScaleCoord(center.p_x + (size.p_x - size.p_x/2), COORD_ANY); size.p_x = CIFScaleCoord(center.p_x + (size.p_x - size.p_x/2), COORD_ANY);
if (savescale != cifCurReadStyle->crs_scaleFactor) if (savescale != cifCurReadStyle->crs_scaleFactor)
{ {
center.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor); cscaled.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor);
center.p_y *= (savescale / cifCurReadStyle->crs_scaleFactor); cscaled.p_y *= (savescale / cifCurReadStyle->crs_scaleFactor);
savescale = cifCurReadStyle->crs_scaleFactor; savescale = cifCurReadStyle->crs_scaleFactor;
} }
size.p_y = CIFScaleCoord(center.p_y + (size.p_y - size.p_y/2), COORD_ANY); size.p_y = CIFScaleCoord(center.p_y + (size.p_y - size.p_y/2), COORD_ANY);
if (savescale != cifCurReadStyle->crs_scaleFactor) if (savescale != cifCurReadStyle->crs_scaleFactor)
{ {
center.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor); cscaled.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor);
center.p_y *= (savescale / cifCurReadStyle->crs_scaleFactor); cscaled.p_y *= (savescale / cifCurReadStyle->crs_scaleFactor);
size.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor); size.p_x *= (savescale / cifCurReadStyle->crs_scaleFactor);
} }
rectangle.r_xbot = center.p_x; rectangle.r_xbot = cscaled.p_x;
rectangle.r_ybot = center.p_y; rectangle.r_ybot = cscaled.p_y;
rectangle.r_xtop = size.p_x; rectangle.r_xtop = size.p_x;
rectangle.r_ytop = size.p_y; rectangle.r_ytop = size.p_y;