harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chunrong Lai (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4791) [classlib][awt][image] Harmony has problem in drawing medium-or-large size of png file if not guarded by MediaTracker
Date Fri, 14 Sep 2007 01:58:32 GMT
[classlib][awt][image] Harmony has problem in drawing medium-or-large size of png file if not
guarded by MediaTracker
---------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4791
                 URL: https://issues.apache.org/jira/browse/HARMONY-4791
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Win32
            Reporter: Chunrong Lai



 Sometimes I even observed that Harmony crashes in multi-threading environment but I have
not reproducer yet.
 Anyway with below reproducer Harmony draw a glittering 10million.png and the 40million.png
breaks finally.

import java.io.*;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;

public class DrawImageTest extends JFrame {
   public Image image;
   public static void  main(String[] args){
      DrawImageTest aTest = new DrawImageTest();
      if(args.length <1) {
         System.out.println("Please input a valid image name");
         System.exit(0);
      }
      aTest.setSize(800, 600);
      aTest.readImage(args[0]);
      aTest.show();
   }
   public DrawImageTest(){}
   public void readImage(String imageName){
       if(image == null) {
         image = Toolkit.getDefaultToolkit().getImage(imageName);
         /*******
         MediaTracker imageTracker = new MediaTracker(new JPanel());
         imageTracker.addImage(image, 0);
         try{
          imageTracker.waitForID(0);
         }catch(InterruptedException e){}
         ********/
         if(image == null) System.out.println("we get an image of null");
         else              System.out.println("we get an image of width " + image.getWidth(this)
+ " height " + image.getHeight(this));
       }
   }   
   public void paint(Graphics g){
       super.paint(g);
       g.drawImage(image, 0, 0, null);
   }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message