Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
This commit is contained in:
parent
eaec4980e1
commit
4f9533c772
1640 changed files with 126485 additions and 104808 deletions
|
@ -1,5 +1,5 @@
|
|||
/* RenderableImageProducer.java --
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,42 +38,129 @@ exception statement from your version. */
|
|||
|
||||
package java.awt.image.renderable;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.ImageConsumer;
|
||||
import java.awt.image.ImageProducer;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.awt.image.SampleModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class RenderableImageProducer implements ImageProducer, Runnable
|
||||
{
|
||||
private RenderableImage image;
|
||||
private RenderContext context;
|
||||
private ArrayList consumers = new ArrayList();
|
||||
|
||||
public RenderableImageProducer(RenderableImage image, RenderContext context)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
this.image = image;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setRenderContext(RenderContext context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void addConsumer(ImageConsumer consumer)
|
||||
{
|
||||
synchronized (consumers)
|
||||
{
|
||||
if (! consumers.contains(consumer))
|
||||
consumers.add(consumer);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConsumer(ImageConsumer consumer)
|
||||
{
|
||||
return false;
|
||||
synchronized (consumers)
|
||||
{
|
||||
return consumers.contains(consumer);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeConsumer(ImageConsumer consumer)
|
||||
{
|
||||
synchronized (consumers)
|
||||
{
|
||||
consumers.remove(consumer);
|
||||
}
|
||||
}
|
||||
|
||||
public void startProduction(ImageConsumer consumer)
|
||||
{
|
||||
addConsumer(consumer);
|
||||
Thread t = new Thread(this, "RenderableImageProducerWorker");
|
||||
t.start();
|
||||
}
|
||||
|
||||
public void requestTopDownLeftRightResend(ImageConsumer consumer)
|
||||
{
|
||||
// Do nothing. The contract says we can ignore this call, so we do.
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
// This isn't ideal but it avoids fail-fast problems.
|
||||
// Alternatively, we could clone 'consumers' here.
|
||||
synchronized (consumers)
|
||||
{
|
||||
RenderedImage newImage;
|
||||
if (context == null)
|
||||
newImage = image.createDefaultRendering();
|
||||
else
|
||||
newImage = image.createRendering(context);
|
||||
Raster newData = newImage.getData();
|
||||
ColorModel colorModel = newImage.getColorModel();
|
||||
if (colorModel == null)
|
||||
colorModel = ColorModel.getRGBdefault();
|
||||
SampleModel sampleModel = newData.getSampleModel();
|
||||
DataBuffer dataBuffer = newData.getDataBuffer();
|
||||
int width = newData.getWidth();
|
||||
int height = newData.getHeight();
|
||||
|
||||
// Initialize the consumers.
|
||||
Iterator it = consumers.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
ImageConsumer target = (ImageConsumer) it.next();
|
||||
target.setHints(ImageConsumer.COMPLETESCANLINES
|
||||
| ImageConsumer.SINGLEFRAME
|
||||
| ImageConsumer.SINGLEPASS
|
||||
| ImageConsumer.TOPDOWNLEFTRIGHT);
|
||||
target.setDimensions(width, height);
|
||||
}
|
||||
|
||||
// Work in scan-line order.
|
||||
int[] newLine = new int[width];
|
||||
int[] bands = new int[sampleModel.getNumBands()];
|
||||
for (int y = 0; y < height; ++y)
|
||||
{
|
||||
for (int x = 0; x < width; ++x)
|
||||
{
|
||||
sampleModel.getPixel(x, y, bands, dataBuffer);
|
||||
newLine[x] = colorModel.getDataElement(bands, 0);
|
||||
}
|
||||
|
||||
// Tell the consumers about the new scan line.
|
||||
it = consumers.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
ImageConsumer target = (ImageConsumer) it.next();
|
||||
target.setPixels(0, y, width, 1, colorModel, newLine, 0, width);
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the consumers that we're done.
|
||||
it = consumers.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
ImageConsumer target = (ImageConsumer) it.next();
|
||||
target.imageComplete(ImageConsumer.STATICIMAGEDONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // class RenderableImageProducer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue