Skip to content

Conversation

@ShahzaibIbrahim
Copy link
Contributor

When the size point is Point.OfFloat, return Rectangle.OfFloat to retain sub-pixel precision; otherwise return the classic Rectangle.

This is introduced as needed to be used in eclipse-platform/eclipse.platform.ui#3597

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

Test Results

  176 files  ±0    176 suites  ±0   26m 5s ⏱️ - 1m 12s
4 672 tests ±0  4 650 ✅ ±0  22 💤 ±0  0 ❌ ±0 
  482 runs  ±0    476 ✅ ±0   6 💤 ±0  0 ❌ ±0 

Results for commit c23111c. ± Comparison against base commit 47e2587.

♻️ This comment has been updated with latest results.

* @since 3.133
*/
public static Rectangle of(Point topLeft, Point dimension) {
if(dimension instanceof Point.OfFloat ofFloatDimension) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to extend this PR a bit:

  • spacing between if
  • we need to handle the case when top is a Point.OfFloat as well for consistency
  • And we should add some tests for the four different possible cases, so (Point, Point), (Point.OfFloat, Point), (Point, Point.OfFloat) and (Point.OfFloat, Point.OfFloat)

When the size point is Point.OfFloat, return Rectangle.OfFloat to retain
sub-pixel precision; otherwise return the classic Rectangle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SWT: Add Rectangle.of(Point, Point) preserving OfFloat dimensions

2 participants