Commit f627f8a
[Win32] Partially revert rectangle size rounding
With a recent change, 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 behavioral change of Rectangle
and the point/pixel conversion logic to the previous state.
Fixes #27461 parent 2df129f commit f627f8a
File tree
2 files changed
+16
-10
lines changed- bundles/org.eclipse.swt/Eclipse SWT
- common/org/eclipse/swt/graphics
- win32/org/eclipse/swt/internal
2 files changed
+16
-10
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
| 467 | + | |
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| |||
Lines changed: 14 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
| |||
280 | 283 | | |
281 | 284 | | |
282 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
290 | 296 | | |
291 | 297 | | |
292 | 298 | | |
| |||
0 commit comments