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

1.4 REGRESSION: Larger objects are flipped around X axis on Linux when scaling

    XMLWordPrintable

Details

    • 2d
    • mantis
    • x86
    • linux

    Description



      Name: jk109818 Date: 10/24/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :

      Distribution: SuSE 8.0
      glibc: 2.2.5
      kernel: 2.4.18-4GB

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Graphics Accelerator: NVIDIA Riva TNT
      Graphics Driver: NIVDIA 1.0-2960

      A DESCRIPTION OF THE PROBLEM :
      When larger objects like Rectangle or Line2D.Float (width or
      height around or above 1000) are drawn on a JPanel with a
      BasicStroke with a width of 0 or almost 0 and the drawing
      is scaled with factors above around 10, the objects are
      flipped around the X axis at some scale factors.

      This problem occurs on Linux with J2SE 1.4.0 and 1.4.1 RC,
      but not with 1.3.1.
      It does not occur on Windows NT 4.0 and 2000 with J2SE 1.4.0.

      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Please execute the code pasted below.
      2. Change the scale factor by moving the slider.
      3. At some scale factors, the rectangle will be flipped
      around the X axis.
      4. Comment the line where the BasicStroke is set or decrease
      the height of the rectangle to for example 100. Like this
      the problem does not occur.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The rectange should just be scaled, what it actually does
      with J2SE 1.3.1. But at some scale factors it's flipped
      around the X axis.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      There are no error messages or stack traces.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.geom.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;

      public class TestFrame extends JFrame {
        double zoom = 10;
        JPanel contentPane;
        JScrollPane jScrollPane = new JScrollPane();
        JPanel jPanel = new JPanel() {
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;

            // Comment the line below and the
            // problem will no longer occur.
            g2.setStroke(new BasicStroke(0.0f));

            g2.scale(zoom, zoom);
            g2.drawRect(1, 1, 1, 1000);
            // g2.draw(new Line2D.Float(1, 1, 1, 1000));
            // g2.drawOval(1, 1, 3, 1000);
          }
        };
        JSlider jSlider = new JSlider();

        public TestFrame() {
          contentPane = (JPanel) this.getContentPane();
          setSize(new Dimension(400, 300));
          // setLocationRelativeTo(null);
          jSlider.setMinimum(1);
          jSlider.setValue(1);
          jSlider.addChangeListener(
            new ChangeListener() {
              public void stateChanged(ChangeEvent e) {
                zoom = jSlider.getValue() * 10;
                jPanel.repaint();
              }
            }
          );
          contentPane.add(jScrollPane, BorderLayout.CENTER);
          contentPane.add(jSlider, BorderLayout.SOUTH);
          jScrollPane.getViewport().add(jPanel, null);
        }

        public static void main(String[] args) {
          TestFrame frame = new TestFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      I have not found a workaround.

      Release Regression From : 1.3.1_06
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 164410)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              bae Andrew Brygin
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: