Bug in Graphics.drawImage ?!

R

Rene

Can someone please confirm the following bug.

Compile and run the code below. Iconify the frame and
deiconify, or make it repaint some other way.
On my system, I get garbadge, while it was
correct the first time.

System is: Windows XP, Java 1.4.2_05

Thanks a lot!

----------------------------------

import java.awt.*;
import java.awt.event.*;
class BroadPanel extends Panel
{ Image I;
public void paint (Graphics g)
{ int h=getSize().height;
if (I==null)
{ I=createImage(10*h,h);
Graphics ig=I.getGraphics();
ig.clearRect(0,0,10*h,h);
ig.setColor(Color.black);
ig.drawLine(0,0,10*h-1,h-1);
ig.dispose();
}
g.drawImage(I,0,0,this);
}
}
public class Bug
extends Frame
{ public Bug ()
{ setLayout(new BorderLayout());
add("Center",new BroadPanel());
setSize(500,500);
setVisible(true);
addWindowListener(new WindowAdapter()
{ public void windowClosing (WindowEvent e)
{ setVisible(false); dispose();
}
}
);
}
public static void main(String[] args)
{ new Bug();
}
}
 
A

Andrew Thompson

Can someone please confirm the following bug.

Compile and run the code below. Iconify the frame and
deiconify, or make it repaint some other way.
On my system, I get garbadge, while it was
correct the first time.

System is: Windows XP, Java 1.4.2_05

The sloping line rendered reliably for me*
using WinXP/Sun 1.5 beta.

* After both resizing and minimize/restore.
 
R

Rene

The sloping line rendered reliably for me*
using WinXP/Sun 1.5 beta.

Thanks for testing. Either it is a graphic card problem, or it has been
removed in 1.5.

Rene
 
L

Larry Barowski

Rene said:
Thanks for testing. Either it is a graphic card problem, or it has been
removed in 1.5.

Try running with -Dsun.java2d.noddraw . If it
works with DirectDraw off, you probably have
a bugged video driver.
 
R

Rene

Thanks Larry, that was it. This is a mobile Radeon 9600. However, there are
no new drivers, AFAIK.

Hmmmmm

Rene
 
L

Larry Barowski

Rene said:
Thanks Larry, that was it. This is a mobile Radeon 9600. However, there are
no new drivers, AFAIK.

They may not be aware of the problem. Java tends to turn
up bugs in video drivers that other applications don't. As
those bugs get fixed, new cards and new drivers with new
bugs are released. Some of those bugs crash the whole
system, others just make your graphics look crappy. Either
way, users tend to blame the application. After years of
this we finally learned our lesson and just recently began
releasing our product with DirectDraw disabled by default.

In fairness, I should add that occasionally such problems
are caused by Java itself. But video card vendors really
need to start testing their drivers with graphics-intensive
Java applications.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top