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

Infinite loop on drawing a polygon into an offscreen image graphics

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      windows_nt

      Description



      Name: mc57594 Date: 12/05/99


      java version "1.2"
      Classic VM (build JDK-1.2-V, native threads)

      Hi.
      I submited last Friday a bug report(ID 98315) about java.awt.Polygon class.
        Today, i've received the answer about the bug, relating it with other bugs like
      4221516 and/or 4269933 or even 4221954 or 4194956. But these bugs are about
      problems with empty polygons.
      My test polygon is not empty and even have 11 points. The problem appears when
       i draw this polygon over a java.awt.Graphics class wich source is an offscreen
      image. In this last case, seem the processor enters in an infinite loop.
      This only take place with strange polygons as the one i submit after.

      I think you don't understood me( sorry, but my special english is not as good i
      i would desire). I think is a unreported bug. Try with the source code i
      submit. You can see that the same polygon not offers any problem with the
      Graphics object obtained from a Frame class, but with an offscreen Image taked
      as double buffer the polygon is not drawed.

      Here i copy the answer message you send me this morning. Includes the original
      message too.



      /*********************************************

      Please review the bugs below. It's not clear whether you have a new bug to
      report, or whether you're seeing a symptom of one of these still-open bugs.

      If you believe you have a new bug, after reporting these, please submit another
      report clarifying what new information is contained in your report.

      Best Regards,
      KR


      The bug you have reported is probably related to bugs including:

       4221516 and/or 4269933 or even 4221954 or 4194956

      Thank you for providing us with additional information
      that can be used in the resolution of this bug.

      This bug can be monitored via the the Java Developer
      Connection Bug Parade at:
        http://developer.java.sun.com/developer/bugParade/index.html
        
      The Java Developer Connection is a free channel that is
      maintained by staff here at Sun. Access this web page to join:
        http://developer.java.sun.com/servlet/RegisterServlet
        
      The home page for the JDC is:
        http://java.sun.com/jdc




      ----------------- Original Bug Report-------------------

      category : java
      subcategory : classes_awt
      type : bug
      synopsis : Infinite loop on drawing a polygon into an offscreen image graphics
      description : (is this a symptom of 4221516 and/or 4269933? or even 4221954? or
      4194956?)

      java version "1.2"
      Classic VM (build JDK-1.2-V, native threads)


      1. The problem appears when draw an strange polygon into an offscreen image
      Seems the processor begin an infinite loop when executes the method of Graphics
      class drawPolygon(Polygon p)
         
      2.

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

      /**
      * Just a simple class that shows the paint problem
      *
      * An offscreen image is used as double-buffer of screen.
      * When it tries to draw an special polygon into the offscreen image, unlike the
      * painting on screen, the processor begin an infinite loop, and runs, runs, and
      runs...
      */

      public class Bug extends Frame
      {
        int npoints = 11;
        int xpoints[] =
      {14447,14449,14461,-1596,14452,14449,14449,14448,14447,14446,14447};
        int ypoints[] =
      {-87474,-87486,-87484,10940,-87474,-87475,-87478,-87475,-87473,-87472,-87475};
        Polygon P = new Polygon(xpoints,ypoints,npoints);

        public Bug()
        {
          Button bug_button = new Button("execute bug");
          bug_button.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e){
               paintOnBuffer();
             }
          });
          add(bug_button,BorderLayout.SOUTH);

          setSize(640,480);
          setVisible(true);
        }

        /**
        * Good paint.
        * All works.
        */
        public void paint(Graphics g)
        {
          g.setColor(Color.white);
          g.fillRect(0,0,getWidth(),getHeight());

          g.setColor(Color.blue);
          g.drawPolygon(P);
        }

        /**
        * Bad painting
        * Processor works, and works and works...
        */
        public void paintOnBuffer()
        {
          Image img = createImage(getWidth(),getHeight());
          Graphics img_graphics = img.getGraphics();

          img_graphics.setColor(Color.white);
          img_graphics.fillRect(0,0,getWidth(),getHeight());

          img_graphics.setColor(Color.blue);

            //the conflic draw
          img_graphics.drawPolygon(P);
        }

        public static void main(String argv[]){
          Bug bug = new Bug();
        }
      }

      3. No error appears. I have waiting about 3-4 minutes.
      4.
      5. I have suffer it under windows nt on a 450Mhz 128Mb Intel Pentium 3 Machine
        My graphics card is also normal
      4.
      workaround : i have no one
      suggested_val :
      cust_name : Pedro Fernandez Bel
      cust_email : ###@###.###
      jdcid : PedroFernandezBel
      keyword : webbug
      company : Universidad de Zaragoza
      release : 1.2
      hardware : x86
      OSversion : win_nt_4.0
      priority : 4
      bugtraqID : 0
      dateCreated : 1999-11-26 08:04:55.0
      dateEvaluated : 1999-11-27 15:6:11
      (Review ID: 98365)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                flar Jim Graham
                Reporter:
                mchamnessunw Mark Chamness (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: