RFR: 8322140: javax/swing/JTable/JTableScrollPrintTest.java does not print the rows and columns of the table in NimbusLookAndFeel
Tejesh R
tr at openjdk.org
Thu Apr 4 14:46:10 UTC 2024
On Thu, 4 Apr 2024 11:41:25 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> > > > > Can you please explain why you need to handle MultiResolutionImage for this printing issue for NimbusL&F and why was it not needed for other L&F Also, you need to add this bugid to the test
> > > >
> > > >
> > > > The fix is for L&F other than Nimbus. It is working in Nimbus since Image drawing is handled by SunGraphics2D class in [drawHIDPIImage()](https://github.com/openjdk/jdk/blob/b9da14012da5f1f72d4f6e690c18a43e87523173/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java#L3126) method. Whereas other L&F, pathGraphics handles ImageDrawing where MultiResolutionImage is not yet handled. The fix which I proposed for [8210807](https://github.com/openjdk/jdk/commit/38bbbe7588c94d3a0edd1c120ba49cbd0851a720) bug fixed for Non-Nimbus L&F but caused regression for Nimbus. Hence after further analysis and study the root cause was found out to be Non-handling of MultiResolutionImage in [getBufferedImage()](https://github.com/openjdk/jdk/blob/b9da14012da5f1f72d4f6e690c18a43e87523173/src/java.desktop/share/classes/sun/print/PathGraphics.java#L1122).
> > >
> > >
> > > I guess the PathGraphics path should be used for printing images and should be common for all so why Nimbus is going via SunGraphics2D? [and it seems you updated the summary to include Aqua so Aqua is also going via SunGraphics2D?]
> >
> >
> > Yes, the issue is found in Aqua also and that too uses SunGraphics2D. And regarding why SunGraphics2D is used for Nimbus and Aqua, its because in Nimbus PeekGraphics is used which in-turn useses SunGraphics2D and in other its PW/WPathGraphics. I'm not sure why this is different.
>
> Can you point to the code where it uses PeekGraphics in Nimbus/Aqua and the subsequent code from where is starts to bifurcate in other L&F meaning where it starts to uses PeekGraphics for Nimbus/Aqua and PathGraphics for others?
Yeah, it is from RasterPrinterJob class [here](https://github.com/openjdk/jdk/blob/21867c929a2f2c961148f2cd1e79d672ac278d27/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java#L2298). And that is because of nonSolidColors present in Nimbus and Aqua L&F.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18187#issuecomment-2037409936
More information about the client-libs-dev
mailing list