On Thu, 9 Oct 2025 09:04:44 GMT, Francesco Andreuzzi <[email protected]> 
wrote:

>> This fix does a couple of things
>> 
>> 1) AffineTransformOp.createCompatibleDestImage() and 
>> AffineTransformOp.createCompatibleDestRaster() now specify that they will 
>> throw RasterFormatException if the transformed size is too large. They were 
>> already getting an exception.
>> Note that inside the JDK only the imaging API implementation itself uses 
>> these APIs and I suspect they are rarely used by applications.
>> 
>> 2) AffineTransformOp.filter(src, null) will not throw an exception if it 
>> cannot create a destination image or raster of the required size and instead 
>> will use the source image size. This means applications which simply 
>> filter() will not need to carefully examine the transform. Sophisticated 
>> applications which want to do this can use the above "create*" methods to 
>> explicitly create the destination to find this out. 
>> 
>> So some inconsistency but I think it is a user-friendly trade-off.
>> 
>> A CSR will be needed but I want to get past initial review first.
>
> src/java.desktop/share/classes/java/awt/image/AffineTransformOp.java line 455:
> 
>> 453:             return createCompatibleDestImage(src, destCM, r);
>> 454:         } catch (Exception e) {
>> 455:              if (e instanceof RasterFormatException) {
> 
> How about two `catch` blocks? One catching `RasterFormatException` and a 
> fallback to `Exception`.

That would be another way to code it, but the outcome is the same and I suspect 
this is marginally more efficient. And an exception should be extremely rare.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27707#discussion_r2417683585

Reply via email to