On Thu, 9 Nov 2023 18:12:19 GMT, Sergey Bylokhov <[email protected]> wrote:

> But can we solve both issues, add optimization w/o creating the new objects?

Not with the current `Rectangle` API as far as I can see. If the goal is 
maximal performances, the current code is likely better. The use of 
`Rectangle.intersection(Rectangle)` was proposed for safety rather than 
performance, because `Rectangle` is robust to integer underflow and overflow. 
However, I think that the current `WritableRaster.setRect(Raster)` code can 
underflow/overflow only if the checks performed at `Raster` construction time 
were bypassed, for example by modifying the protected fields after construction.

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

PR Comment: https://git.openjdk.org/jdk/pull/13797#issuecomment-1804395307

Reply via email to