Diamond WDEF Correction
Volume Number: | | 8
|
Issue Number: | | 1
|
Column Tag: | | Code Correction
|
Diamond WDEF Source Code Correction
There was a minor error in the Diamond WDEF source code that was printed in the October, 1991 issue. Sometimes the zoom region is drawn incorrectly after a zoom. The code failed to properly ensure that the windows zoom rectangles height and width begin their lives as even numbers (to avoid round off error when calculating mid-points). Here is the corrected code (SetUpStdZoom routine):
/* 1 */
/* Make sure x and yDistance are even */
xDistance = (theRect.right - theRect.left) & MAKE_EVEN;
theRect.right = theRect.left + xDistance;
yDistance = (theRect.bottom - theRect.top) & MAKE_EVEN;
theRect.bottom = theRect.top + yDistance;
The difference being that xDistance and yDistance are applied to theRect regardless of whether or not they are equal in size.
According to the author, Marisano J. James, there is a more serious error that appears after zooming under System 7, but at this time, he is not certain what causes this problem. After much experimentation he feels that System 7 assumes that the portRect should be smaller than the structure regions bounding box.
[As information becomes available, well print it here. - Ed.]