-
Notifications
You must be signed in to change notification settings - Fork 189
Add Rectangle.of(Point,Point) supporting OfFloat #2907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java
Outdated
Show resolved
Hide resolved
eebe042 to
8ae684b
Compare
8ae684b to
696288e
Compare
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java
Show resolved
Hide resolved
696288e to
8d533eb
Compare
When the size point is Point.OfFloat, return Rectangle.OfFloat to retain sub-pixel precision; otherwise return the classic Rectangle.
8d533eb to
b701ab0
Compare
| * dimensions | ||
| * @since 3.133 | ||
| */ | ||
| public static Rectangle of(Point topLeft, Point dimension) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already of(Point, int, int). Since that and this new method are basically equal (just that the new one can carry additional context information in the dimension point), I would expect them to behave the same whenever possible. This particularly means:
- The existing method should also properly handle the passed topleft point being OfFloat
- This new method should also deal with topLeft being WithMonitor
| * If the provided {@code Point} instance carries additional OfFloat | ||
| * information, an extended {@code Rectangle} type may be returned to preserve | ||
| * that context. Otherwise, a standard {@code Rectangle} is returned. | ||
| * </p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"OfFloat" is nothing known at public API. The contract of the method should be accordingly abstract. I would propose to adopt the formulation of the existing of(Point, int, int) method.
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