mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-22 14:17:43 +02:00
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:
+2
-1
@@ -863,6 +863,7 @@ dbwPrintValue0(int value, /* value to print, in internal units */
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DBW_UNITS_USER:
|
case DBW_UNITS_USER:
|
||||||
|
crec = (DBWclientRec *)w->w_clientData;
|
||||||
if (is_square)
|
if (is_square)
|
||||||
{
|
{
|
||||||
oscale = (float)((crec->dbw_gridRect.r_xtop -
|
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 -
|
oscale = (float)(crec->dbw_gridRect.r_ytop -
|
||||||
crec->dbw_gridRect.r_ybot);
|
crec->dbw_gridRect.r_ybot);
|
||||||
}
|
}
|
||||||
fvalue = (float)value * oscale * dscale;
|
fvalue = (float)value * dscale / oscale;
|
||||||
if (is_square)
|
if (is_square)
|
||||||
{
|
{
|
||||||
fvalue *= dscale;
|
fvalue *= dscale;
|
||||||
|
|||||||
Reference in New Issue
Block a user