diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2005-09-23 21:31:04 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-09-23 21:31:04 +0000 |
commit | 1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06 (patch) | |
tree | 3ca4b2e68dc14c3128b9c781d23f1d0b1f2bee49 /libjava/classpath/java/awt/image | |
parent | 9b044d19517541c95681d35a92dbc81e6e21d94f (diff) | |
download | gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.zip gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.tar.gz gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.tar.bz2 |
Imported Classpath 0.18.
* sources.am, Makefile.in: Updated.
* Makefile.am (nat_source_files): Removed natProxy.cc.
* java/lang/reflect/natProxy.cc: Removed.
* gnu/classpath/jdwp/VMFrame.java,
gnu/classpath/jdwp/VMIdManager.java,
gnu/classpath/jdwp/VMVirtualMachine.java,
java/lang/reflect/VMProxy.java: New files.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC
list.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/net/DefaultContentHandlerFactory.java (getContent):
Remove ClasspathToolkit references.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/awt/xlib/XCanvasPeer.java: Add new peer methods.
* gnu/awt/xlib/XFramePeer.java: Likewise.
* gnu/awt/xlib/XGraphicsConfiguration.java: Likewise.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add
classpath/native/jawt/jawt.c.
* Makefile.in: Regenerate.
* jawt.c: Remove file.
* include/Makefile.am (tool_include__HEADERS): Remove jawt.h and
jawt_md.h. Add ../classpath/include/jawt.h and
../classpath/include/jawt_md.h.
* include/Makefile.in: Regenerate.
* include/jawt.h: Regenerate.
* include/jawt_md.h: Regenerate.
From-SVN: r104586
Diffstat (limited to 'libjava/classpath/java/awt/image')
8 files changed, 85 insertions, 27 deletions
diff --git a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java index b9ca1b7..194d483 100644 --- a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java +++ b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java @@ -80,6 +80,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter */ public void setHints(int flags) { + if (consumer != null) consumer.setHints(flags); } @@ -100,6 +101,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } @@ -120,6 +122,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } diff --git a/libjava/classpath/java/awt/image/ConvolveOp.java b/libjava/classpath/java/awt/image/ConvolveOp.java index f841c13..49ca2a6 100644 --- a/libjava/classpath/java/awt/image/ConvolveOp.java +++ b/libjava/classpath/java/awt/image/ConvolveOp.java @@ -1,5 +1,5 @@ /* ConvolveOp.java -- - Copyright (C) 2004 Free Software Foundation -- ConvolveOp + Copyright (C) 2004, 2005 Free Software Foundation -- ConvolveOp This file is part of GNU Classpath. @@ -177,11 +177,13 @@ public class ConvolveOp implements BufferedImageOp, RasterOp } /** + * Returns (a clone of) the convolution kernel. + * * @return The convolution kernel. */ public Kernel getKernel() { - return kernel; + return (Kernel) kernel.clone(); } /* (non-Javadoc) @@ -189,8 +191,6 @@ public class ConvolveOp implements BufferedImageOp, RasterOp * java.awt.image.WritableRaster) */ public WritableRaster filter(Raster src, WritableRaster dest) { - if (src.numBands != dest.numBands) - throw new ImagingOpException(null); if (src == dest) throw new IllegalArgumentException(); if (src.getWidth() < kernel.getWidth() || @@ -199,6 +199,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp if (dest == null) dest = createCompatibleDestRaster(src); + else if (src.numBands != dest.numBands) + throw new ImagingOpException(null); // Deal with bottom edge if (edge == EDGE_ZERO_FILL) diff --git a/libjava/classpath/java/awt/image/CropImageFilter.java b/libjava/classpath/java/awt/image/CropImageFilter.java index 490f43c..4fcfdec 100644 --- a/libjava/classpath/java/awt/image/CropImageFilter.java +++ b/libjava/classpath/java/awt/image/CropImageFilter.java @@ -79,6 +79,7 @@ public class CropImageFilter extends ImageFilter */ public void setDimensions(int width, int height) { + if (consumer != null) consumer.setDimensions(this.width, this.height); } @@ -93,7 +94,8 @@ public class CropImageFilter extends ImageFilter public void setProperties(Hashtable props) { props.put("filters", "CropImageFilter"); - consumer.setProperties(props); + if (consumer != null) + consumer.setProperties(props); } /** @@ -130,9 +132,10 @@ public class CropImageFilter extends ImageFilter cropped[i * bounds.width + j] = pixels[start + bounds.x + j]; } - consumer.setPixels(bounds.x, bounds.y, - bounds.width, bounds.height, - model, cropped, 0, bounds.width); + if (consumer != null) + consumer.setPixels(0, 0, + bounds.width, bounds.height, + model, cropped, 0, bounds.width); } } @@ -170,9 +173,10 @@ public class CropImageFilter extends ImageFilter cropped[i * bounds.width + j] = pixels[start + bounds.x + j]; } - consumer.setPixels(bounds.x, bounds.y, - bounds.width, bounds.height, - model, cropped, 0, bounds.width); + if (consumer != null) + consumer.setPixels(0, 0, + bounds.width, bounds.height, + model, cropped, 0, bounds.width); } } diff --git a/libjava/classpath/java/awt/image/DirectColorModel.java b/libjava/classpath/java/awt/image/DirectColorModel.java index c98c3f8..4f37151 100644 --- a/libjava/classpath/java/awt/image/DirectColorModel.java +++ b/libjava/classpath/java/awt/image/DirectColorModel.java @@ -348,9 +348,24 @@ public class DirectColorModel extends PackedColorModel { return getComponents(getPixelFromArray(pixel), components, offset); } - + + /** + * Creates a <code>WriteableRaster</code> that has a <code>SampleModel</code> + * that is compatible with this <code>ColorModel</code>. + * + * @param w the width of the writeable raster to create + * @param h the height of the writeable raster to create + * + * @throws IllegalArgumentException if <code>w</code> or <code>h</code> + * is less than or equal to zero + */ public final WritableRaster createCompatibleWritableRaster(int w, int h) { + // Sun also makes this check here. + if(w <= 0 || h <= 0) + throw new IllegalArgumentException("width (=" + w + ") and height (=" + + h + ") must be > 0"); + SampleModel sm = createCompatibleSampleModel(w, h); Point origin = new Point(0, 0); return Raster.createWritableRaster(sm, origin); @@ -418,3 +433,4 @@ public class DirectColorModel extends PackedColorModel return super.toString(); } } + diff --git a/libjava/classpath/java/awt/image/ImageFilter.java b/libjava/classpath/java/awt/image/ImageFilter.java index 9940a2b..c39c4a4 100644 --- a/libjava/classpath/java/awt/image/ImageFilter.java +++ b/libjava/classpath/java/awt/image/ImageFilter.java @@ -125,6 +125,7 @@ public class ImageFilter implements ImageConsumer, Cloneable */ public void setDimensions(int width, int height) { + if (consumer != null) consumer.setDimensions(width, height); } @@ -137,7 +138,8 @@ public class ImageFilter implements ImageConsumer, Cloneable public void setProperties(Hashtable props) { props.put("filters", "ImageFilter"); - consumer.setProperties(props); + if (consumer != null) + consumer.setProperties(props); } /** @@ -149,6 +151,7 @@ public class ImageFilter implements ImageConsumer, Cloneable * @see ColorModel */ public void setColorModel(ColorModel model) { + if (consumer != null) consumer.setColorModel(model); } @@ -164,6 +167,7 @@ public class ImageFilter implements ImageConsumer, Cloneable */ public void setHints(int flags) { + if (consumer != null) consumer.setHints(flags); } @@ -184,6 +188,7 @@ public class ImageFilter implements ImageConsumer, Cloneable public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } @@ -204,6 +209,7 @@ public class ImageFilter implements ImageConsumer, Cloneable public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } @@ -215,6 +221,7 @@ public class ImageFilter implements ImageConsumer, Cloneable */ public void imageComplete(int status) { + if (consumer != null) consumer.imageComplete(status); } } diff --git a/libjava/classpath/java/awt/image/PixelGrabber.java b/libjava/classpath/java/awt/image/PixelGrabber.java index b576dbf..b8ca70c 100644 --- a/libjava/classpath/java/awt/image/PixelGrabber.java +++ b/libjava/classpath/java/awt/image/PixelGrabber.java @@ -131,6 +131,9 @@ public class PixelGrabber implements ImageConsumer public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, int pix[], int off, int scansize) { + if (ip == null) + throw new NullPointerException("The ImageProducer must not be null."); + this.ip = ip; this.x = x; this.y = y; @@ -179,6 +182,10 @@ public class PixelGrabber implements ImageConsumer boolean forceRGB) { this.ip = img.getSource(); + + if (this.ip == null) + throw new NullPointerException("The ImageProducer must not be null."); + this.x = x; this.y = y; width = w; @@ -209,7 +216,15 @@ public class PixelGrabber implements ImageConsumer { public void run () { - ip.startProduction (PixelGrabber.this); + try + { + ip.startProduction (PixelGrabber.this); + } + catch (Exception ex) + { + ex.printStackTrace(); + imageComplete(ImageConsumer.IMAGEABORTED); + } } }; grabberThread.start (); @@ -601,7 +616,8 @@ public class PixelGrabber implements ImageConsumer consumerStatus = status; setObserverStatus (); grabbing = false; - ip.removeConsumer (this); + if (ip != null) + ip.removeConsumer (this); notifyAll (); } diff --git a/libjava/classpath/java/awt/image/RGBImageFilter.java b/libjava/classpath/java/awt/image/RGBImageFilter.java index f7b39b9..ecfed06 100644 --- a/libjava/classpath/java/awt/image/RGBImageFilter.java +++ b/libjava/classpath/java/awt/image/RGBImageFilter.java @@ -79,10 +79,12 @@ public abstract class RGBImageFilter extends ImageFilter if( ( model instanceof IndexColorModel) && canFilterIndexColorModel ) { newmodel = filterIndexColorModel( (IndexColorModel) model ); - consumer.setColorModel(newmodel); + if (consumer != null) + consumer.setColorModel(newmodel); } else { - consumer.setColorModel(ColorModel.getRGBdefault()); + if (consumer != null) + consumer.setColorModel(ColorModel.getRGBdefault()); } } @@ -178,6 +180,7 @@ public abstract class RGBImageFilter extends ImageFilter { if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel) { + if (consumer != null) consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize); } else @@ -185,7 +188,8 @@ public abstract class RGBImageFilter extends ImageFilter int intPixels[] = convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize ); filterRGBPixels( x, y, w, h, intPixels, offset, scansize ); - consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize); + if (consumer != null) + consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize); } } @@ -209,6 +213,7 @@ public abstract class RGBImageFilter extends ImageFilter { if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel) { + if (consumer != null) consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize); } else @@ -216,7 +221,8 @@ public abstract class RGBImageFilter extends ImageFilter //FIXME: Store the filtered pixels in a separate temporary buffer? convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize ); filterRGBPixels( x, y, w, h, pixels, offset, scansize ); - consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize); + if (consumer != null) + consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize); } } diff --git a/libjava/classpath/java/awt/image/ReplicateScaleFilter.java b/libjava/classpath/java/awt/image/ReplicateScaleFilter.java index 3841e49..d76f9db 100644 --- a/libjava/classpath/java/awt/image/ReplicateScaleFilter.java +++ b/libjava/classpath/java/awt/image/ReplicateScaleFilter.java @@ -124,7 +124,8 @@ public class ReplicateScaleFilter extends ImageFilter destHeight = (int) (height * ((double) destWidth / srcWidth)); } - consumer.setDimensions(destWidth, destHeight); + if (consumer != null) + consumer.setDimensions(destWidth, destHeight); } /** @@ -136,7 +137,8 @@ public class ReplicateScaleFilter extends ImageFilter public void setProperties(Hashtable props) { props.put("filters", "ReplicateScaleFilter"); - consumer.setProperties(props); + if (consumer != null) + consumer.setProperties(props); } /** @@ -165,9 +167,10 @@ public class ReplicateScaleFilter extends ImageFilter model, pixels, offset, scansize, rx, ry, destScansize); - consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), - (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), - model, destPixels, 0, destScansize); + if (consumer != null) + consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), + (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), + model, destPixels, 0, destScansize); } /** @@ -196,9 +199,10 @@ public class ReplicateScaleFilter extends ImageFilter model, pixels, offset, scansize, rx, ry, destScansize); - consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), - (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), - model, destPixels, 0, destScansize); + if (consumer != null) + consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), + (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), + model, destPixels, 0, destScansize); } private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch, |