Graphics.drawImage() problem

James kaffe@rufus.w3.org
Mon, 24 Jul 2000 12:19:18 -0500



I have Kaffe 1.0.5 built w/ `./configure --with-threads=unix-pthreads` and
am seeing problems with applet's that are using drawImage() a lot.

The call to drawImage() is intermitantly failing and nothing is being
drawn--however, drawImage() is returning successfully.  The result is that
animations are staggered and non-smooth.  Take the following pseudo code:


run()
{
    background = createImage(background.gif);
    offscreen = createImage(w,h)
    foreground = offscreen.getGraphics();

    while (true)
    {
        foreground.drawImage(background, 0, 0, null);
        updateFrameInfo();
        drawNewFrameOnGraphics(foreground);
        repaint();
        sleep(...);
    }
}

paint(Graphics g)
{
    if (offscreen != null)
        g.drawImage(offscreen, 0, 0, null);
}

The call to drawImage within the while() block will sometimes work,
sometimes fail (nothing gets drawn).  It doesn't throw any exceptions and
doesn't complain about anything.

All of the applet's that exhibit the problem (that I have the source to) are
spinning of a separate thread that is doing the drawImage() work.  Does
anyone know of any problems in the Kaffe AWT implementation with the
Graphics class and multi-threading?

Anyone know what I might look for?

Thanks,
James