[Win32] Partially revert rectangle size rounding #2747
Merged
+16
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With a recent change (#2720), the rounding of rectangles width/height was adapted to be based on the precise (float) coordinates of the top left and bottom right corner of the rectangle instead of rounding top left location and width/height individually in the rectangle. The reason was that otherwise two rectangles placed next to each other and scaled from pixel to point or vice versa could overlap or have a gap between them when the resulting values were rounded. So the change was beneficial (i.e., improved precision) when scaling values from pixel to point or vice versa if they are all defined in the same coordinate system (with the same origin), as then equal coordinates are rounded equally.
However, the coordinates used in SWT are usually in different coordinate systems with the origin often being the position of the parent control. So one consequence of the change was that a parent with a child, both of the same size, may not fit into each other anymore if the parent has an offset (with respect to its parent) that is taken into account when rounding the Rectangle values.
For that reason, this change reverts the behavior change of Rectangle and the point/pixel conversion logic to the previous state.
Fixes #2746