Fixed the handling of printed units when "units grid" is used. The

original implementation (which was added recently) used an inverted
output scale and multiplied by it instead of dividing by it,
resulting in incorrect units.  However, it was not even getting to
that point due to the use of uninitialized variable "crec", which
should have been set from the window pointer but was missing.
This commit is contained in:
R. Timothy Edwards 2026-07-10 19:59:05 -04:00
parent 23a1c501ff
commit 17ac06a24a
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
8.3.673
8.3.674

View File

@ -863,6 +863,7 @@ dbwPrintValue0(int value, /* value to print, in internal units */
break;
case DBW_UNITS_USER:
crec = (DBWclientRec *)w->w_clientData;
if (is_square)
{
oscale = (float)((crec->dbw_gridRect.r_xtop -
@ -880,7 +881,7 @@ dbwPrintValue0(int value, /* value to print, in internal units */
oscale = (float)(crec->dbw_gridRect.r_ytop -
crec->dbw_gridRect.r_ybot);
}
fvalue = (float)value * oscale * dscale;
fvalue = (float)value * dscale / oscale;
if (is_square)
{
fvalue *= dscale;