JDK-8361095 : Clarify the purpose of Region.clipRound and clipScale
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 11,17,25,26
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2025-06-30
  • Updated: 2025-06-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
There are two methods in sun.java2d.pipe.Region: clipRound and clipScale. Each method has a slightly different rounding logic, yet there's no clear indication in which situations one method should be used over the other.

This came up in code review for JDK-8349188 [1]

“Please double-check whether you need to use Region.clipScale() instead.

“I actually do not remember when to use one over the other. Maybe if you find a review request for the patch where these methods were added, you can confirm which one should be used. I checked the current source, and it seems that we randomly use one or the other, which seems incorrect."

“Probably these discussions may help:
https://mail.openjdk.org/pipermail/2d-dev/2016-July/007152.html
https://mail.openjdk.org/pipermail/2d-dev/2016-October/007764.html
https://mail.openjdk.org/pipermail/2d-dev/2016-October/007772.html (it has a long discussion thread).”


[1] https://github.com/openjdk/jdk/pull/26025#discussion_r2173117608