RFR: 8282526: Default icon is not painted properly

Alexey Ivanov aivanov at openjdk.java.net
Wed Mar 16 17:54:50 UTC 2022


On Sun, 13 Mar 2022 21:06:24 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

> Detect the situation where we do need to perform interpolation during ImageIcon
> painting and set a hint to the rendering to perform bicubic approximation so
> image details are preserved during transition.

src/java.desktop/share/classes/javax/swing/ImageIcon.java line 463:

> 461:         if (hintChanged) {
> 462:             ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_INTERPOLATION,
> 463:                     oldHint == null ? RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR : oldHint);

Isn't the state of the Graphics object modified? Previously, the `KEY_INTERPOLATION` hint was set to `null` but it is set to `VALUE_INTERPOLATION_NEAREST_NEIGHBOR` on exit. Why can't it be set to `null`? Always to `oldHint`?

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

PR: https://git.openjdk.java.net/jdk/pull/7805



More information about the client-libs-dev mailing list