United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4768686 1.4 REGRESSION: Larger objects are flipped around X axis on Linux when scaling
JDK-4768686 : 1.4 REGRESSION: Larger objects are flipped around X axis on Linux when scaling

Details
Type:
Bug
Submit Date:
2002-10-25
Status:
Resolved
Updated Date:
2013-07-04
Project Name:
JDK
Resolved Date:
2002-11-12
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.1
Fixed Versions:
1.4.2 (mantis)

Related Reports
Duplicate:
Relates:

Sub Tasks

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) 
======================================================================

                                    

Comments
EVALUATION

Commit to tiger.
###@###.### 2002-10-25

Name: abR10136			Date: 10/31/2002


  This bug exists on both Linux and Solaris platforms.
  The problem is sideeffect of overflow in coordinates
  (stored in XPoint structure) during translation of
  the shape in transformPoints() function.
   (file src/solaris/native/sun/awt/X11Renderer.c)

  Solution is to prevent sign change (caused by overflow) during translation
  (reusing existing macros CLAMP_TO_SHORT()).



======================================================================
                                     
2004-08-21
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis
mantis-b07


                                     
2004-08-21



Hardware and Software, Engineered to Work Together