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

D3D/OGL: Incorrect drawing behavior w/ 1.6u10 for components with overridden getInsets()

    Details

    • Subcomponent:
      2d
    • Introduced In Version:
    • Resolved In Build:
      b24
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_10-beta"
      Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b14)
      Java HotSpot(TM) Client VM (build 11.0-b11, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP, SP2

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Tested with the following hardware configurations:

      HW Configuration 1
      -------------------------------
      -Dell Optiplex GX620
      -2 Gig Ram
      - Video Card: On-Board Intel 82945G Express Chipset

      HW Configuration 2
      ------------------------
      -Dell Optiplex GX620
      -2 Gig Ram
      - Video Card: NVIDIA 7300 GS



      A DESCRIPTION OF THE PROBLEM :
      When an sub-classed AWT component overrides the getInsets() method and does custom painting, the drawing insets for Graphics methods (fillRect(), drawRect(), etc.) are inconsistent with previous versions of the JDK (reguardless of hw configuration) and with other 1.6u10 machines that do not use the particular graphics hardware (NVIDIA 7300 GS) tested.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      (1) Install JDK 1.6u10 on a machine having an NVIDIA 7300GS Video Card.

      (3) Run the sample code (AWTTestInsets.java and AWTTestNoInsets.java)

      (4) Observe that these two programs produce visual output (a blue rectangle) that is centered in a different portion of the screen even though they are using absolutes coordinates for the drawing and the only difference in the code is that the getInsets() method in the AWT panel is overriden in one but not in the other.

      Diabling the D3D pipeline by running -Dsun.java2d.d3d=false resolves the issue. And below is the J2D_TRACE_LEVEL=4 output:
       OS Version = OS_WINXP Pro
       CheckAdaptersInfo
       ------------------
       Adapter Ordinal : 0
       Adapter Handle : 0x10001
       Description : NVIDIA GeForce 6600
       GDI Name, Driver : \\.\DISPLAY1, nv4_disp.dll
       Vendor Id : 0x10de
       Device Id : 0x0141
       SubSys Id : 0x21931682
       Driver Version : 6.14.10.8185
       GUID : {D7B71E3E-4201-11CF-CB6A-990103C2CB35}
       D3DPPLM::CheckDeviceCaps: adapter 0: Passed
       ------------------
       D3DGD_getDeviceCapsNative
       D3DContext::InitContext device 0
       D3DContext::ConfigureContext device 0
      [V] dwBehaviorFlags=D3DCREATE_FPU_PRESERVE|D3DCREATE_HARDWARE_VERTEXPROCESSING
       D3DContext::ConfigureContext: successfully created device: 0
       D3DContext::InitDevice: device 0
       D3DContext::InitDefice: successfully initialized device 0
      [V] | CAPS_DEVICE_OK
      [V] | CAPS_RT_PLAIN_ALPHA
      [V] | CAPS_RT_TEXTURE_ALPHA
      [V] | CAPS_RT_TEXTURE_OPAQUE
      [V] | CAPS_LCD_SHADER | CAPS_BIOP_SHADER | CAPS_PS20
      [V] | CAPS_PS30
      [V] | CAPS_MULTITEXTURE
      [V] | CAPS_TEXNONPOW2
      [V] | CAPS_TEXNONSQUARE
      (this is the debug output on the 6600 (which had the same issues as the 7300GS)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The getInsets() method should have no impact whatsoever on the painting boundaries. Both test programs should have the exact same visual result since both are making the exact same painting calls.
      ACTUAL -
      On machines in HW Configuration 1 (see addition config info) that did not have the NVIDIA 7300 GS graphics card, and on the same machine with prior (<= 1.6.0_u6) versions of the JDK both blue rectangles appear in the same place on the screen. In HW Configuration 2, the AWTTestInsets

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      none..

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      //////////////////////////////////////////////////////////////////////////////////////////////////////
      // File 1 (AWTTestInsets.java)
      //////////////////////////////////////////////////////////////////////////////////////////////////////

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


      // Test Class to show insets problem
      public class AWTTestInsets {
          
          
           public static void main(String[] args) {
               
               final Frame f = new Frame("AWT Test - Insets");
               f.setSize(300,300);

               f.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                      f.setVisible(false);
                      System.exit(0);
                  }
               });

               f.setBackground(Color.gray);
               Panel p = new Panel(){

                   public final Insets INSETS = new Insets(40,40,40,40);
                           
                   // override the getInsets() method ...
                   public Insets getInsets() {
                       return INSETS;
                   }
                   
                   public void paint(Graphics g) {
                       g.setColor(Color.blue);
                       
                       // draw a 100x100 pixel blue rectangle starting at offset 100,100
                       g.fillRect(100,100,100,100);

                   }
               };
               f.add(p);
               f.setVisible(true);
              
          }

      }

      //////////////////////////////////////////////////////////////////////////////////////////////////////
      // File 2 (AWTTestNoInsets.java)
      //////////////////////////////////////////////////////////////////////////////////////////////////////

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

      // Test Class to show insets problem
      public class AWTTestNoInsets {
          
          
           public static void main(String[] args) {
               
               final Frame f = new Frame("AWT Test - No Insets");
               f.setSize(300,300);

               f.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                      f.setVisible(false);
                      System.exit(0);
                  }
               });

               f.setBackground(Color.gray);
               Panel p = new Panel(){

                   public void paint(Graphics g) {
                       g.setColor(Color.blue);

                       // draw a 100x100 pixel blue rectangle starting at offset 100,100
                       g.fillRect(100,100,100,100);
                    
                   }

               };

               f.add(p);
               f.setVisible(true);
              
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No suitable workaround has been found, other than avoiding running 1.6.0u10 on machines with the NVIDIA 7300GS chipset. Upgrading to the latest video drivers had no perceptible impact on the nature of the bug.

      Release Regression From : 6u5
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tdv Dmitri Trembovetski (Inactive)
                Reporter:
                ryeung Roger Yeung (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: