RFR: 8311527: Region.snapInnerSpace*()

Andy Goryachev angorya at openjdk.org
Thu Aug 17 19:17:56 UTC 2023


On Sat, 29 Jul 2023 00:12:45 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> Introduces Region.snapInnerSpaceX/Y() methods for dealing with inner space (using Math.floor), see for instance [JDK-8299753](https://bugs.openjdk.org/browse/JDK-8299753), using existing methods Region.snapPortionX/Y().

re: clamping.
On one hand, this method deals with the amount of space, so negative values make no sense.
On the other hand, there are indeed snapPortion*() which floors the positive values and ceils the negative.

One may argue that this is done to allow the developer to additionally encode an extra bit (sign) for a let's say direction or some other property while preserving the mathematical semantics of this method -- then we can certainly accept that and remove the clamping.  My initial thought was to fail early and clearly show that one can't have negative lengths by clamping to 0.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1190#issuecomment-1658636686


More information about the openjfx-dev mailing list