harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject [OT] cool photos (was: Re: [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 Mon, 24 Sep 2007 14:50:28 GMT
Now *that's* a creative way to get a decent testing budget -- "the code
only breaks when we use photos like this" :-)

(Open the JIRA page to see them)

Tim

Chunrong Lai (JIRA) wrote:
> [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);
>    }
> }
> 

Mime
View raw message