JDK-8147016 : [hidpi] invalid repaint for multiresolution image when switching display resolution (Windows)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_8
  • Submitted: 2016-01-13
  • Updated: 2017-01-17
  • Resolved: 2017-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
OS: Windows 8 + JDK9 b100 + HiDPI display

Please try to run the following test code and then switch display resolution:


import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

public class MultiRes extends Frame {

    private static final int W = 200, H = 200;
    
    private static final BaseMultiResolutionImage IMG =
        new BaseMultiResolutionImage(new BufferedImage[]{
        generateImage(1, Color.BLACK), generateImage(2, Color.BLUE)});

    public MultiRes() { EventQueue.invokeLater(this::CreateUI); }

    private void CreateUI() {
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) { dispose(); }
        });
        setSize(W, H);
        setResizable(false);
        setVisible(true);
    }
    
    private static BufferedImage generateImage(int scale, Color c) {

        BufferedImage image = new BufferedImage(
            scale * W, scale * H, BufferedImage.TYPE_INT_RGB);
        Graphics g = image.getGraphics();
        g.setColor(c);
        g.fillRect(0, 0, scale * W, scale * H);

        g.setColor(Color.WHITE);
        Font f = g.getFont();
        g.setFont(new Font(f.getName(), Font.BOLD, scale * 48));
        g.drawChars(
            (scale + "X").toCharArray(), 0, 2, scale * W / 2, scale * H / 2);

        return image;
    }
    
    @Override
    public void paint(Graphics gr) {
        Graphics2D g = (Graphics2D) gr;
        if (g != null) { g.drawImage(IMG, 0, 0, this); }
    }

    public static void main(String[] args) { new MultiRes(); }
}


Can see some mixture of images instead of the single image (please see the screenshots).
Comments
The issue has the same root as the JDK-8147440
17-01-2017

Approved by component triage team to defer
12-09-2016

SQE: OK to defer
12-09-2016

This requires additional changes for undecorated frames. This only happens on Windows 8.1 and higher when display resolution is manually changed. The impact is that an application should be restarted after display resolution changing but it should not happen often.
12-09-2016

Alexandr, could you describe what is reason to defer it and what is an impact if this is not fixed in 9 GA?
09-09-2016

should be covered by a new test http://cr.openjdk.java.net/~avstepan/8142861/webrev.03/
14-01-2016

the frame must be non-resizeable to reproduce the issue. please note also that image size does not coincide with the frame size (for OS X it does coincide).
13-01-2016