On Wed, 3 Apr 2024 09:01:22 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> Fix suggested in bug 
>> [8210807](https://github.com/openjdk/jdk/commit/38bbbe7588c94d3a0edd1c120ba49cbd0851a720)
>>  had a regression in Nimbus L&F yet it resolved the issue in other L&F. The 
>> better approach would be to handle `MultiResolutionImages `in `PathGraphics` 
>> class `getBufferedImage` method and is suggested here. The fix doesn't cause 
>> any regression and is verified in CI system. The test 
>> javax/swing/JTable/JTableScrollPrintTest.java is verified for all platforms 
>> and all L&F (Except in Windows it doesn't work due an issue introduced in 
>> 22, yet to investigate on it). And also fix 
>> [8210807](https://github.com/openjdk/jdk/commit/38bbbe7588c94d3a0edd1c120ba49cbd0851a720)
>>  has been reverted, retaining the test.
>
> src/java.desktop/share/classes/sun/print/PathGraphics.java line 1137:
> 
>> 1135:             return ((VolatileImage)img).getSnapshot();
>> 1136:         } else if (img instanceof MultiResolutionImage) {
>> 1137:             return convertToBufferedImage((MultiResolutionImage) img,
> 
> guess this casting is not needed..

It is required, without casting it throws `incompatible type error`.

> src/java.desktop/share/classes/sun/print/PathGraphics.java line 1138:
> 
>> 1136:         } else if (img instanceof MultiResolutionImage) {
>> 1137:             return convertToBufferedImage((MultiResolutionImage) img,
>> 1138:                                            img.getWidth(null), 
>> img.getHeight(null));
> 
> Any particular reason of using getWidth/getHeight(null) as seems like in 
> spec, this observer parameter is ignored so we can directly use 
> getWIdth/getHeight, I presume...

No, we have to pass null if the parameter is ignored. Without it we will get 
error.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18187#discussion_r1551047672
PR Review Comment: https://git.openjdk.org/jdk/pull/18187#discussion_r1551048929

Reply via email to