Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8229907

Height of Frame/Window is 44px lesser for Metal Pipeline

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      os_x

      Description

      Run the following program with OpenGL & Metal rendering pipelines separately.
      1) -Dsun.java2d.metal=false -Dsun.java2d.uiScale=2.0
      2) -Dsun.java2d.metal=true -Dsun.java2d.uiScale=2.0

      It can be observed that the height of the frame/window is 44pixel lesser for (2) as compared to the height of the frame/window for (1)

      Refer attached screenshots.

      // Test Code start -----------------------------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.geom.Line2D;
      import java.awt.geom.Rectangle2D;

      class CustomPanel extends JPanel {
          @Override
          public void paint(Graphics g) {
              Graphics2D g2 = (Graphics2D) g;

              g2.setColor(Color.green);
              g2.fill(new Rectangle2D.Double(60, 60, 200, 200));

              g2.setStroke(new BasicStroke(5));
              g2.setColor(Color.BLUE);
              g2.draw(new Line2D.Double(180, 100, 300, 300));

              g2.setStroke(new BasicStroke(1));
              g2.setColor(Color.RED);
              g2.draw(new Line2D.Double(0, 0, 50, 50));
              g2.draw(new Rectangle2D.Double(100, 100, 150, 50));
          }


          @Override
          public Dimension getPreferredSize() {
              return new Dimension(300, 300);
          }
      }

      public class Metal_JFrame {

          public static void main(String[] args) {

              JFrame myFrame = new JFrame("Metal Frame");
              myFrame.setSize(300, 300);
              myFrame.add(new CustomPanel());

              myFrame.pack();
              myFrame.setVisible(true);
          }
      }
      // Test Code end ----------------------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aghaisas Ajit Ghaisas
              Reporter:
              aghaisas Ajit Ghaisas
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: