diff options
Diffstat (limited to 'libjava/classpath/gnu/java/awt')
173 files changed, 3119 insertions, 3176 deletions
diff --git a/libjava/classpath/gnu/java/awt/AWTUtilities.java b/libjava/classpath/gnu/java/awt/AWTUtilities.java index dcebc67..1b308ce 100644 --- a/libjava/classpath/gnu/java/awt/AWTUtilities.java +++ b/libjava/classpath/gnu/java/awt/AWTUtilities.java @@ -57,7 +57,7 @@ import java.util.WeakHashMap; import java.lang.reflect.InvocationTargetException; /** - * This class mirrors the javax.swing.SwingUtilities class. It + * This class mirrors the javax.swing.SwingUtilities class. It * provides commonly needed functionalities for AWT classes without * the need to reference classes in the javax.swing package. */ @@ -91,13 +91,13 @@ public class AWTUtilities */ VisibleComponentIterator(int listIndex) { - this.listIndex = listIndex; - int visibleComponentsFound = 0; - for (index = 0; visibleComponentsFound != listIndex; index++) - { - if (components[index].isVisible()) - visibleComponentsFound++; - } + this.listIndex = listIndex; + int visibleComponentsFound = 0; + for (index = 0; visibleComponentsFound != listIndex; index++) + { + if (components[index].isVisible()) + visibleComponentsFound++; + } } /** @@ -109,16 +109,16 @@ public class AWTUtilities */ public boolean hasNext() { - boolean hasNext = false; - for (int i = index; i < components.length; i++) - { - if (components[i].isVisible()) - { - hasNext = true; - break; - } - } - return hasNext; + boolean hasNext = false; + for (int i = index; i < components.length; i++) + { + if (components[i].isVisible()) + { + hasNext = true; + break; + } + } + return hasNext; } /** @@ -130,23 +130,23 @@ public class AWTUtilities */ public Object next() { - Object o = null; - for (; index < components.length; index++) - { - if (components[index].isVisible()) - { - o = components[index]; - break; - } - } - if (o != null) - { - index++; - listIndex++; - return o; - } - else - throw new NoSuchElementException(); + Object o = null; + for (; index < components.length; index++) + { + if (components[index].isVisible()) + { + o = components[index]; + break; + } + } + if (o != null) + { + index++; + listIndex++; + return o; + } + else + throw new NoSuchElementException(); } /** @@ -158,16 +158,16 @@ public class AWTUtilities */ public boolean hasPrevious() { - boolean hasPrevious = false; - for (int i = index - 1; i >= 0; i--) - { - if (components[i].isVisible()) - { - hasPrevious = true; - break; - } - } - return hasPrevious; + boolean hasPrevious = false; + for (int i = index - 1; i >= 0; i--) + { + if (components[i].isVisible()) + { + hasPrevious = true; + break; + } + } + return hasPrevious; } /** @@ -179,22 +179,22 @@ public class AWTUtilities */ public Object previous() { - Object o = null; - for (index--; index >= 0; index--) - { - if (components[index].isVisible()) - { - o = components[index]; - break; - } - } - if (o != null) - { - listIndex--; - return o; - } - else - throw new NoSuchElementException(); + Object o = null; + for (index--; index >= 0; index--) + { + if (components[index].isVisible()) + { + o = components[index]; + break; + } + } + if (o != null) + { + listIndex--; + return o; + } + else + throw new NoSuchElementException(); } /** @@ -204,7 +204,7 @@ public class AWTUtilities */ public int nextIndex() { - return listIndex + 1; + return listIndex + 1; } /** @@ -214,7 +214,7 @@ public class AWTUtilities */ public int previousIndex() { - return listIndex - 1; + return listIndex - 1; } /** @@ -224,8 +224,8 @@ public class AWTUtilities */ public void remove() { - throw new UnsupportedOperationException - ("VisibleComponentList is immutable"); + throw new UnsupportedOperationException + ("VisibleComponentList is immutable"); } /** @@ -237,8 +237,8 @@ public class AWTUtilities */ public void set(Object o) { - throw new UnsupportedOperationException - ("VisibleComponentList is immutable"); + throw new UnsupportedOperationException + ("VisibleComponentList is immutable"); } /** @@ -250,8 +250,8 @@ public class AWTUtilities */ public void add(Object o) { - throw new UnsupportedOperationException - ("VisibleComponentList is immutable"); + throw new UnsupportedOperationException + ("VisibleComponentList is immutable"); } } @@ -291,8 +291,8 @@ public class AWTUtilities { int visibleComponents = 0; for (int i = 0; i < components.length; i++) - if (components[i].isVisible()) - visibleComponents++; + if (components[i].isVisible()) + visibleComponents++; return visibleComponents; } } @@ -322,8 +322,8 @@ public class AWTUtilities VisibleComponentList visibleChildren = null; if (o == null) { - visibleChildren = new VisibleComponentList(children); - visibleChildrenCache.put(children, visibleChildren); + visibleChildren = new VisibleComponentList(children); + visibleChildrenCache.put(children, visibleChildren); } else visibleChildren = (VisibleComponentList) o; @@ -419,8 +419,8 @@ public class AWTUtilities * * @see #getAncestorOfClass * @see #windowForComponent - * @see - * + * @see + * */ public static Container getAncestorOfClass(Class c, Component comp) { @@ -432,7 +432,7 @@ public class AWTUtilities /** * Equivalent to calling <code>getAncestorOfClass(Window, comp)</code>. * - * @param comp The component to search for an ancestor window + * @param comp The component to search for an ancestor window * * @return An ancestral window, or <code>null</code> if none exists */ @@ -500,7 +500,7 @@ public class AWTUtilities * <code>(x,y)</code>. Returns <code>null</code> when either * <code>(x,y)</code> is outside the bounds of parent, or parent is * <code>null</code>. - * + * * @param parent The component to search the descendents of * @param x Horizontal coordinate to search for * @param y Vertical coordinate to search for @@ -593,7 +593,7 @@ public class AWTUtilities if (destination == null) destination = getRoot(source); - + if (source.isShowing() && destination.isShowing()) { convertPointToScreen(pt, source); @@ -603,7 +603,7 @@ public class AWTUtilities return pt; } - + /** * Converts a rectangle from the coordinate space of one component to * another. This is equivalent to converting the rectangle from @@ -668,18 +668,18 @@ public class AWTUtilities } - /** + /** * Calls {@link java.awt.EventQueue.invokeLater} with the - * specified {@link Runnable}. + * specified {@link Runnable}. */ public static void invokeLater(Runnable doRun) { java.awt.EventQueue.invokeLater(doRun); } - /** + /** * Calls {@link java.awt.EventQueue.invokeAndWait} with the - * specified {@link Runnable}. + * specified {@link Runnable}. */ public static void invokeAndWait(Runnable doRun) throws InterruptedException, @@ -688,7 +688,7 @@ public class AWTUtilities java.awt.EventQueue.invokeAndWait(doRun); } - /** + /** * Calls {@link java.awt.EventQueue.isEventDispatchThread}. */ public static boolean isEventDispatchThread() diff --git a/libjava/classpath/gnu/java/awt/BitMaskExtent.java b/libjava/classpath/gnu/java/awt/BitMaskExtent.java index 2813499..be66fcc 100644 --- a/libjava/classpath/gnu/java/awt/BitMaskExtent.java +++ b/libjava/classpath/gnu/java/awt/BitMaskExtent.java @@ -36,7 +36,7 @@ exception statement from your version. */ package gnu.java.awt; -/** +/** * Simple transparent utility class that can be used to perform bit * mask extent calculations. */ @@ -47,7 +47,7 @@ public final class BitMaskExtent /** The number of bits in the bit mask extent. */ public byte bitWidth; - + /** * Set the bit mask. This will calculate and set the leastSignificantBit * and bitWidth fields. @@ -63,17 +63,17 @@ public final class BitMaskExtent long shiftMask = mask; for (; (shiftMask&1) == 0; shiftMask >>>=1) leastSignificantBit++; for (; (shiftMask&1) != 0; shiftMask >>>=1) bitWidth++; - + if (shiftMask != 0) throw new IllegalArgumentException("mask must be continuous"); } - - /** + + /** * Calculate the bit mask based on the values of the * leastSignificantBit and bitWidth fields. */ public long toMask() { return ((1<<bitWidth)-1) << leastSignificantBit; - } + } } diff --git a/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java b/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java index 9205df1..e19b27f 100644 --- a/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java +++ b/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java @@ -63,7 +63,7 @@ import java.awt.image.WritableRaster; * white, blue, black, orange, green, and brown, respectively. Each * composite was used to paint a fully white rectangle on top of the * blue bar in the background. - * + * * <p>The purpose of this composite is to support the {@link * Graphics#setXORMode(Color)} method in composite-aware graphics * implementations. Applications typically would use @@ -96,7 +96,7 @@ public class BitwiseXORComposite */ protected Color xorColor; - + /** * Constructs a new composite for xor-ing the pixel value. * @@ -128,7 +128,7 @@ public class BitwiseXORComposite return new GeneralContext(srcColorModel, dstColorModel, xorColor); } - + /** * A fallback CompositeContext that performs bitwise XOR of pixel * values with the pixel value of the specified <code>xorColor</code>. @@ -164,7 +164,7 @@ public class BitwiseXORComposite Rectangle srcRect = src.getBounds(); Rectangle dstInRect = dstIn.getBounds(); Rectangle dstOutRect = dstOut.getBounds(); - + int xp = xorColor.getRGB(); int w = Math.min(Math.min(srcRect.width, dstOutRect.width), dstInRect.width); @@ -186,7 +186,7 @@ public class BitwiseXORComposite int sp = srcColorModel.getRGB(srcPix); int dp = dstColorModel.getRGB(dstPix); int rp = sp ^ xp ^ dp; - dstOut.setDataElements(x + dstOutRect.x, y + dstOutRect.y, + dstOut.setDataElements(x + dstOutRect.x, y + dstOutRect.y, dstColorModel.getDataElements(rp, rpPix)); } } @@ -249,7 +249,7 @@ public class BitwiseXORComposite srcLine = new int[width]; dstLine = new int[width]; - + /* We need an int[] array with at least one element here; * srcLine is as good as any other. */ @@ -268,7 +268,7 @@ public class BitwiseXORComposite } } - + /** * Determines whether an instance of this CompositeContext would * be able to process the specified color models. diff --git a/libjava/classpath/gnu/java/awt/Buffers.java b/libjava/classpath/gnu/java/awt/Buffers.java index 2015634..0c8d438 100644 --- a/libjava/classpath/gnu/java/awt/Buffers.java +++ b/libjava/classpath/gnu/java/awt/Buffers.java @@ -46,7 +46,7 @@ import java.awt.image.DataBufferInt; import java.awt.image.DataBufferShort; import java.awt.image.DataBufferUShort; -/** +/** * Utility class for creating and accessing data buffers of arbitrary * data types. */ @@ -60,7 +60,7 @@ public final class Buffers * @param size the size of the data buffer bank */ public static DataBuffer createBuffer(int dataType, Object data, - int size) + int size) { if (data == null) return createBuffer(dataType, size, 1); @@ -90,22 +90,22 @@ public final class Buffers switch (dataType) { case DataBuffer.TYPE_BYTE: - return new DataBufferByte(size, numBanks); + return new DataBufferByte(size, numBanks); case DataBuffer.TYPE_SHORT: - return new DataBufferShort(size, numBanks); + return new DataBufferShort(size, numBanks); case DataBuffer.TYPE_USHORT: - return new DataBufferUShort(size, numBanks); + return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: - return new DataBufferInt(size, numBanks); + return new DataBufferInt(size, numBanks); case DataBuffer.TYPE_FLOAT: - return new DataBufferFloat(size, numBanks); + return new DataBufferFloat(size, numBanks); case DataBuffer.TYPE_DOUBLE: - return new DataBufferDouble(size, numBanks); + return new DataBufferDouble(size, numBanks); default: - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } } - + /** * Create a data buffer of a particular type. * @@ -114,28 +114,28 @@ public final class Buffers * @param size the size of the data buffer bank */ public static DataBuffer createBufferFromData(int dataType, Object data, - int size) + int size) { switch (dataType) { case DataBuffer.TYPE_BYTE: - return new DataBufferByte((byte[]) data, size); + return new DataBufferByte((byte[]) data, size); case DataBuffer.TYPE_SHORT: - return new DataBufferShort((short[]) data, size); + return new DataBufferShort((short[]) data, size); case DataBuffer.TYPE_USHORT: - return new DataBufferUShort((short[]) data, size); + return new DataBufferUShort((short[]) data, size); case DataBuffer.TYPE_INT: - return new DataBufferInt((int[]) data, size); + return new DataBufferInt((int[]) data, size); case DataBuffer.TYPE_FLOAT: - return new DataBufferFloat((float[]) data, size); + return new DataBufferFloat((float[]) data, size); case DataBuffer.TYPE_DOUBLE: - return new DataBufferDouble((double[]) data, size); + return new DataBufferDouble((double[]) data, size); default: - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } } - /** + /** * Return the data array of a data buffer, regardless of the data * type. * @@ -147,56 +147,56 @@ public final class Buffers return getData(buffer, 0, null, 0, buffer.getSize()); } - + /** * Copy data from array contained in data buffer, much like * System.arraycopy. Create a suitable destination array if the * given destination array is null. */ public static Object getData(DataBuffer src, int srcOffset, - Object dest, int dstOffset, - int length) + Object dest, int dstOffset, + int length) { Object from; switch(src.getDataType()) { case DataBuffer.TYPE_BYTE: - if (dest == null) dest = new byte[length+dstOffset]; - for(int i = 0; i < length; i++) - ((byte[])dest)[i + dstOffset] = (byte)src.getElem(i + srcOffset); - break; + if (dest == null) dest = new byte[length+dstOffset]; + for(int i = 0; i < length; i++) + ((byte[])dest)[i + dstOffset] = (byte)src.getElem(i + srcOffset); + break; case DataBuffer.TYPE_DOUBLE: - if (dest == null) dest = new double[length+dstOffset]; - for(int i = 0; i < length; i++) - ((double[])dest)[i + dstOffset] = src.getElemDouble(i + srcOffset); - break; + if (dest == null) dest = new double[length+dstOffset]; + for(int i = 0; i < length; i++) + ((double[])dest)[i + dstOffset] = src.getElemDouble(i + srcOffset); + break; case DataBuffer.TYPE_FLOAT: - if (dest == null) dest = new float[length+dstOffset]; - for(int i = 0; i < length; i++) - ((float[])dest)[i + dstOffset] = src.getElemFloat(i + srcOffset); - break; + if (dest == null) dest = new float[length+dstOffset]; + for(int i = 0; i < length; i++) + ((float[])dest)[i + dstOffset] = src.getElemFloat(i + srcOffset); + break; case DataBuffer.TYPE_INT: - if (dest == null) dest = new int[length+dstOffset]; - for(int i = 0; i < length; i++) - ((int[])dest)[i + dstOffset] = src.getElem(i + srcOffset); - break; + if (dest == null) dest = new int[length+dstOffset]; + for(int i = 0; i < length; i++) + ((int[])dest)[i + dstOffset] = src.getElem(i + srcOffset); + break; case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_USHORT: - if (dest == null) dest = new short[length+dstOffset]; - for(int i = 0; i < length; i++) - ((short[])dest)[i + dstOffset] = (short)src.getElem(i + srcOffset); - break; + if (dest == null) dest = new short[length+dstOffset]; + for(int i = 0; i < length; i++) + ((short[])dest)[i + dstOffset] = (short)src.getElem(i + srcOffset); + break; case DataBuffer.TYPE_UNDEFINED: - throw new ClassCastException("Unknown data buffer type"); + throw new ClassCastException("Unknown data buffer type"); } return dest; } - + /** * @param bits the width of a data element measured in bits * @@ -207,19 +207,19 @@ public final class Buffers { if (bits <= 8) { - return DataBuffer.TYPE_BYTE; + return DataBuffer.TYPE_BYTE; } else if (bits <= 16) { - return DataBuffer.TYPE_USHORT; - } + return DataBuffer.TYPE_USHORT; + } else if (bits <= 32) { - return DataBuffer.TYPE_INT; + return DataBuffer.TYPE_INT; } else { - return DataBuffer.TYPE_UNDEFINED; + return DataBuffer.TYPE_UNDEFINED; } } } diff --git a/libjava/classpath/gnu/java/awt/ClasspathGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/ClasspathGraphicsEnvironment.java index 865da1d..fecefa0 100644 --- a/libjava/classpath/gnu/java/awt/ClasspathGraphicsEnvironment.java +++ b/libjava/classpath/gnu/java/awt/ClasspathGraphicsEnvironment.java @@ -45,7 +45,7 @@ import java.awt.image.WritableRaster; /** * This class extends the GraphicsEnvironment API with some Classpath-specific * methods, in order to provide optimized graphics handling. - * + * * @author Francis Kung <fkung@redhat.com> */ public abstract class ClasspathGraphicsEnvironment @@ -54,7 +54,7 @@ public abstract class ClasspathGraphicsEnvironment /** * Returns an appropriate Raster that can efficiently back a * BufferedImage with the given ColorModel and SampleModel. - * + * * @param cm The color model. * @param sm The samepl model. * @return An appropriate WritableRaster, or null if acceleration/optimization diff --git a/libjava/classpath/gnu/java/awt/ClasspathToolkit.java b/libjava/classpath/gnu/java/awt/ClasspathToolkit.java index 7bbc70c..99c186a 100644 --- a/libjava/classpath/gnu/java/awt/ClasspathToolkit.java +++ b/libjava/classpath/gnu/java/awt/ClasspathToolkit.java @@ -102,7 +102,7 @@ public abstract class ClasspathToolkit * * @param name The logical name of the font. This may be either a face * name or a logical font name, or may even be null. A default - * implementation of name decoding is provided in + * implementation of name decoding is provided in * {@link ClasspathFontPeer}, but may be overridden in other toolkits. * * @param attrs Any extra {@link java.awt.font.TextAttribute} attributes @@ -110,17 +110,17 @@ public abstract class ClasspathToolkit * transformation. */ public abstract ClasspathFontPeer getClasspathFontPeer (String name, - Map<?,?> attrs); + Map<?,?> attrs); - /** + /** * Creates a {@link Font}, in a platform-specific manner. - * + * * The default implementation simply constructs a {@link Font}, but some - * toolkits may wish to override this, to return {@link Font} subclasses + * toolkits may wish to override this, to return {@link Font} subclasses * which implement {@link java.awt.font.OpenType} or * {@link java.awt.font.MultipleMaster}. */ - public Font getFont (String name, Map attrs) + public Font getFont (String name, Map attrs) { Font f = null; @@ -170,7 +170,7 @@ public abstract class ClasspathToolkit * * @throws IllegalArgumentException if <code>format</code> is * not supported. - * + * * @throws FontFormatException if <code>stream</code> does not * contain data in the expected format, or if required tables are * missing from a font. @@ -211,11 +211,11 @@ public abstract class ClasspathToolkit * toolkit implementors should overload this method if possible. * @since 1.5 */ - public int getMouseNumberOfButtons() + public int getMouseNumberOfButtons() { return -1; } - + /* (non-Javadoc) * @see java.awt.Toolkit#createDesktopPeer(java.awt.Desktop) */ @@ -224,9 +224,8 @@ public abstract class ClasspathToolkit { if (GraphicsEnvironment.isHeadless()) throw new HeadlessException(); - + return ClasspathDesktopPeer.getDesktop(); } } - diff --git a/libjava/classpath/gnu/java/awt/ComponentDataBlitOp.java b/libjava/classpath/gnu/java/awt/ComponentDataBlitOp.java index 545427e..becf541 100644 --- a/libjava/classpath/gnu/java/awt/ComponentDataBlitOp.java +++ b/libjava/classpath/gnu/java/awt/ComponentDataBlitOp.java @@ -52,7 +52,7 @@ import java.awt.image.WritableRaster; * * @throws java.lang.ClassCastException if the sample models of the * rasters are not of type ComponentSampleModel. - * + * * @author Rolf W. Rasmussen (rolfwr@ii.uib.no) */ public class ComponentDataBlitOp implements RasterOp @@ -63,14 +63,14 @@ public class ComponentDataBlitOp implements RasterOp { if (dest == null) dest = createCompatibleDestRaster(src); - + DataBuffer srcDB = src.getDataBuffer(); DataBuffer destDB = dest.getDataBuffer(); - + ComponentSampleModel srcSM = (ComponentSampleModel) src.getSampleModel(); ComponentSampleModel destSM = (ComponentSampleModel) dest.getSampleModel(); - + // Calculate offset to data in the underlying arrays: int srcScanlineStride = srcSM.getScanlineStride(); @@ -84,8 +84,8 @@ public class ComponentDataBlitOp implements RasterOp /* We can't use getOffset(x, y) from the sample model since we don't want the band offset added in. */ - - int srcOffset = + + int srcOffset = numBands*srcX + srcScanlineStride*srcY + // from sample model srcDB.getOffset(); // from data buffer @@ -94,44 +94,44 @@ public class ComponentDataBlitOp implements RasterOp destDB.getOffset(); // from data buffer // Determine how much, and how many times to blit. - + int rowSize = src.getWidth()*numBands; int h = src.getHeight(); - + if ((rowSize == srcScanlineStride) && - (rowSize == destScanlineStride)) + (rowSize == destScanlineStride)) { - // collapse scan line blits to one large blit. - rowSize *= h; - h = 1; + // collapse scan line blits to one large blit. + rowSize *= h; + h = 1; } - + // Do blitting - + Object srcArray = Buffers.getData(srcDB); Object destArray = Buffers.getData(destDB); - + for (int yd = 0; yd<h; yd++) { - System.arraycopy(srcArray, srcOffset, - destArray, destOffset, - rowSize); - srcOffset += srcScanlineStride; - destOffset += destScanlineStride; + System.arraycopy(srcArray, srcOffset, + destArray, destOffset, + rowSize); + srcOffset += srcScanlineStride; + destOffset += destScanlineStride; } - + return dest; } - public Rectangle2D getBounds2D(Raster src) + public Rectangle2D getBounds2D(Raster src) { return src.getBounds(); } public WritableRaster createCompatibleDestRaster(Raster src) { - + /* FIXME: Maybe we should explicitly create a raster with a tightly pixel packed sample model, rather than assuming that the createCompatibleWritableRaster() method in Raster @@ -140,7 +140,7 @@ public class ComponentDataBlitOp implements RasterOp return src.createCompatibleWritableRaster(); } - public Point2D getPoint2D(Point2D srcPoint, Point2D destPoint) + public Point2D getPoint2D(Point2D srcPoint, Point2D destPoint) { if (destPoint == null) return (Point2D) srcPoint.clone(); @@ -149,7 +149,7 @@ public class ComponentDataBlitOp implements RasterOp return destPoint; } - public RenderingHints getRenderingHints() + public RenderingHints getRenderingHints() { throw new UnsupportedOperationException("not implemented"); } diff --git a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java index 7c04e7d..6734a7b 100644 --- a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java +++ b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java @@ -49,13 +49,13 @@ import java.security.AccessController; /** * Represents an AWT window that can be embedded into another * application. - * + * * @author Michael Koch (konqueror@gmx.de) */ public class EmbeddedWindow extends Frame { private long handle; - + /** * Creates a window to be embedded into another application. The * window will only be embedded after its setHandle method has been @@ -66,7 +66,7 @@ public class EmbeddedWindow extends Frame super(); this.handle = 0; } - + /** * Creates a window to be embedded into another application. * @@ -78,7 +78,7 @@ public class EmbeddedWindow extends Frame super(); this.handle = handle; } - + /** * Creates the native peer for this embedded window. */ @@ -91,9 +91,9 @@ public class EmbeddedWindow extends Frame // java.awt.Component.peer member variable. try { - Field peerField = Component.class.getDeclaredField("peer"); - AccessController.doPrivileged(new SetAccessibleAction(peerField)); - peerField.set(this, tk.createEmbeddedWindow (this)); + Field peerField = Component.class.getDeclaredField("peer"); + AccessController.doPrivileged(new SetAccessibleAction(peerField)); + peerField.set(this, tk.createEmbeddedWindow (this)); } catch (IllegalAccessException e) { diff --git a/libjava/classpath/gnu/java/awt/GradientPaintContext.java b/libjava/classpath/gnu/java/awt/GradientPaintContext.java index 5e1d62d..f33926c 100644 --- a/libjava/classpath/gnu/java/awt/GradientPaintContext.java +++ b/libjava/classpath/gnu/java/awt/GradientPaintContext.java @@ -1,4 +1,4 @@ -/* GradientPaintContext.java -- +/* GradientPaintContext.java -- Copyright (C) 2005, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,39 +47,39 @@ import java.awt.Color; /** * A {@link PaintContext} used by the {@link GradientPaint} class. */ -public class GradientPaintContext implements PaintContext +public class GradientPaintContext implements PaintContext { - // This implementation follows the technique described in + // This implementation follows the technique described in // "Java(tm) 2D Graphics" by Jonathan Knudsen (O'Reilly 1999). - + /** The x-coordinate of the anchor point for color 1. */ private final float x1; - + /** The y-coordinate of the anchor point for color 1. */ private final float y1; - + /** Color 1. */ private final Color c1; - + /** The x-coordinate of the anchor point for color 2. */ private final float x2; - + /** The y-coordinate of the anchor point for color 2. */ private final float y2; - + /** Color 2. */ private final Color c2; - + /** A flag indicating whether the gradient is cyclic or acyclic. */ private final boolean cyclic; - + /** The length of the gradient line - computed from the two anchor points. */ - private final double length; + private final double length; /** * Creates a new instance. - * + * * @param x1 the x-coordinate for the anchor point for color 1. * @param y1 the y-coordinate for the anchor point for color 1. * @param c1 color 1. @@ -89,9 +89,9 @@ public class GradientPaintContext implements PaintContext * @param cyclic a flag that determines whether the gradient is cyclic * or acyclic. */ - public GradientPaintContext(float x1, float y1, Color c1, - float x2, float y2, Color c2, boolean cyclic) - { + public GradientPaintContext(float x1, float y1, Color c1, + float x2, float y2, Color c2, boolean cyclic) + { this.x1 = x1; this.y1 = y1; this.c1 = c1; @@ -101,7 +101,7 @@ public class GradientPaintContext implements PaintContext this.cyclic = cyclic; length = Point2D.distance(x1, y1, x2, y2); } - + /** * Return the color model of this context. It may be different from the * hint specified during createContext, as not all contexts can generate @@ -109,9 +109,9 @@ public class GradientPaintContext implements PaintContext * * @return the context color model */ - public ColorModel getColorModel() + public ColorModel getColorModel() { - return ColorModel.getRGBdefault(); + return ColorModel.getRGBdefault(); } /** @@ -131,21 +131,21 @@ public class GradientPaintContext implements PaintContext for (int r = 0; r < h; r++) { for (int c = 0; c < w; c++) { double u = 0.0; - if (pd2 != 0) - u = (((x + c) - x1) * (x2 - x1) + ((y + r) - y1) * (y2 - y1)) + if (pd2 != 0) + u = (((x + c) - x1) * (x2 - x1) + ((y + r) - y1) * (y2 - y1)) / Math.sqrt(pd2); double ratio = u / length; if (cyclic) ratio = Math.abs(ratio - Math.floor((ratio + 1.0) / 2.0) * 2.0); - else + else ratio = Math.max(0.0, Math.min(1.0, ratio)); int base = (r * w + c) * 4; data[base] = (int) (c1.getRed() + ratio * (c2.getRed() - c1.getRed())); - data[base + 1] + data[base + 1] = (int) (c1.getGreen() + ratio * (c2.getGreen() - c1.getGreen())); - data[base + 2] + data[base + 2] = (int) (c1.getBlue() + ratio * (c2.getBlue() - c1.getBlue())); - data[base + 3] + data[base + 3] = (int) (c1.getAlpha() + ratio * (c2.getAlpha() - c1.getAlpha())); } } @@ -154,11 +154,11 @@ public class GradientPaintContext implements PaintContext } /** - * Release the resources allocated for the paint (none in this + * Release the resources allocated for the paint (none in this * implementation). */ public void dispose() { - // nothing to do + // nothing to do } - + } diff --git a/libjava/classpath/gnu/java/awt/color/CieXyzConverter.java b/libjava/classpath/gnu/java/awt/color/CieXyzConverter.java index 1742805..e1b548e 100644 --- a/libjava/classpath/gnu/java/awt/color/CieXyzConverter.java +++ b/libjava/classpath/gnu/java/awt/color/CieXyzConverter.java @@ -40,7 +40,7 @@ package gnu.java.awt.color; /** * CieXyzConverter - converts to/from a D50-relative CIE XYZ color space. - * + * * The sRGB<->CIE XYZ conversions in SrgbConverter are used. * * @author Sven de Marothy diff --git a/libjava/classpath/gnu/java/awt/color/ClutProfileConverter.java b/libjava/classpath/gnu/java/awt/color/ClutProfileConverter.java index bff97cc..5229ce8 100644 --- a/libjava/classpath/gnu/java/awt/color/ClutProfileConverter.java +++ b/libjava/classpath/gnu/java/awt/color/ClutProfileConverter.java @@ -56,24 +56,24 @@ public class ClutProfileConverter implements ColorSpaceConverter nChannels = profile.getNumComponents(); // Sun does not specifiy which rendering intent should be used, - // neither does the ICC v2 spec really. + // neither does the ICC v2 spec really. // Try intent 0 try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } if (toPCS != null || fromPCS != null) @@ -82,20 +82,20 @@ public class ClutProfileConverter implements ColorSpaceConverter // If no intent 0 clut is available, look for a intent 1 clut. try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB1Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB1Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA1Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA1Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } if (toPCS != null || fromPCS != null) @@ -104,20 +104,20 @@ public class ClutProfileConverter implements ColorSpaceConverter // Last shot.. intent 2 CLUT. try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB2Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB2Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA2Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA2Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } if (toPCS == null && fromPCS == null) diff --git a/libjava/classpath/gnu/java/awt/color/ColorLookUpTable.java b/libjava/classpath/gnu/java/awt/color/ColorLookUpTable.java index 6b6418b..581320c 100644 --- a/libjava/classpath/gnu/java/awt/color/ColorLookUpTable.java +++ b/libjava/classpath/gnu/java/awt/color/ColorLookUpTable.java @@ -77,7 +77,7 @@ public class ColorLookUpTable float[][] inMatrix; // input matrix (XYZ only) boolean useMatrix; // Whether to use the matrix or not. int[] multiplier; - int[] offsets; // Hypercube offsets + int[] offsets; // Hypercube offsets boolean inputLab; // Set if the CLUT input CS is Lab boolean outputLab; // Set if the CLUT output CS is Lab @@ -95,21 +95,21 @@ public class ColorLookUpTable case ICC_Profile.icSigAToB0Tag: case ICC_Profile.icSigAToB1Tag: case ICC_Profile.icSigAToB2Tag: - if (profile.getColorSpaceType() == ColorSpace.TYPE_XYZ) - useMatrix = true; - inputLab = false; - outputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); - break; + if (profile.getColorSpaceType() == ColorSpace.TYPE_XYZ) + useMatrix = true; + inputLab = false; + outputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); + break; case ICC_Profile.icSigBToA0Tag: case ICC_Profile.icSigBToA1Tag: case ICC_Profile.icSigBToA2Tag: - if (profile.getPCSType() == ColorSpace.TYPE_XYZ) - useMatrix = true; - inputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); - outputLab = false; - break; + if (profile.getPCSType() == ColorSpace.TYPE_XYZ) + useMatrix = true; + inputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab); + outputLab = false; + break; default: - throw new IllegalArgumentException("Not a clut-type tag."); + throw new IllegalArgumentException("Not a clut-type tag."); } byte[] data = profile.getData(tag); @@ -144,24 +144,24 @@ public class ColorLookUpTable inMatrix = new float[3][3]; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) - inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; + inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; inTable = new double[nIn][nInTableEntries]; for (int channel = 0; channel < nIn; channel++) for (int i = 0; i < nInTableEntries; i++) - inTable[channel][i] = (double) ((int) buf.getShort(52 - + (channel * nInTableEntries - + i) * 2) - & (0xFFFF)) / 65536.0; + inTable[channel][i] = (double) ((int) buf.getShort(52 + + (channel * nInTableEntries + + i) * 2) + & (0xFFFF)) / 65536.0; nClut = nOut; multiplier = new int[nIn]; multiplier[nIn - 1] = nOut; for (int i = 0; i < nIn; i++) { - nClut *= gridpoints; - if (i > 0) - multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; + nClut *= gridpoints; + if (i > 0) + multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; } int clutOffset = 52 + nIn * nInTableEntries * 2; @@ -172,18 +172,18 @@ public class ColorLookUpTable outTable = new short[nOut][nOutTableEntries]; for (int channel = 0; channel < nOut; channel++) for (int i = 0; i < nOutTableEntries; i++) - outTable[channel][i] = buf.getShort(clutOffset - + (nClut - + channel * nOutTableEntries + i) * 2); + outTable[channel][i] = buf.getShort(clutOffset + + (nClut + + channel * nOutTableEntries + i) * 2); // calculate the hypercube corner offsets offsets = new int[(1 << nIn)]; offsets[0] = 0; for (int j = 0; j < nIn; j++) { - int factor = 1 << j; - for (int i = 0; i < factor; i++) - offsets[factor + i] = offsets[i] + multiplier[j]; + int factor = 1 << j; + for (int i = 0; i < factor; i++) + offsets[factor + i] = offsets[i] + multiplier[j]; } } @@ -203,23 +203,23 @@ public class ColorLookUpTable inMatrix = new float[3][3]; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) - inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; + inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f; inTable = new double[nIn][nInTableEntries]; for (int channel = 0; channel < nIn; channel++) for (int i = 0; i < nInTableEntries; i++) - inTable[channel][i] = (double) ((int) buf.get(48 - + (channel * nInTableEntries - + i)) & (0xFF)) / 255.0; + inTable[channel][i] = (double) ((int) buf.get(48 + + (channel * nInTableEntries + + i)) & (0xFF)) / 255.0; nClut = nOut; multiplier = new int[nIn]; multiplier[nIn - 1] = nOut; for (int i = 0; i < nIn; i++) { - nClut *= gridpoints; - if (i > 0) - multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; + nClut *= gridpoints; + if (i > 0) + multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints; } int clutOffset = 48 + nIn * nInTableEntries; @@ -230,18 +230,18 @@ public class ColorLookUpTable outTable = new short[nOut][nOutTableEntries]; for (int channel = 0; channel < nOut; channel++) for (int i = 0; i < nOutTableEntries; i++) - outTable[channel][i] = (short) (buf.get(clutOffset + nClut - + channel * nOutTableEntries - + i) * 257); + outTable[channel][i] = (short) (buf.get(clutOffset + nClut + + channel * nOutTableEntries + + i) * 257); // calculate the hypercube corner offsets offsets = new int[(1 << nIn)]; offsets[0] = 0; for (int j = 0; j < nIn; j++) { - int factor = 1 << j; - for (int i = 0; i < factor; i++) - offsets[factor + i] = offsets[i] + multiplier[j]; + int factor = 1 << j; + for (int i = 0; i < factor; i++) + offsets[factor + i] = offsets[i] + multiplier[j]; } } @@ -260,32 +260,32 @@ public class ColorLookUpTable float[] in2 = new float[in.length]; if (useMatrix) { - for (int i = 0; i < 3; i++) - in2[i] = in[0] * inMatrix[i][0] + in[1] * inMatrix[i][1] - + in[2] * inMatrix[i][2]; + for (int i = 0; i < 3; i++) + in2[i] = in[0] * inMatrix[i][0] + in[1] * inMatrix[i][1] + + in[2] * inMatrix[i][2]; } else if (inputLab) in2 = XYZtoLab(in); else System.arraycopy(in, 0, in2, 0, in.length); - // input table + // input table for (int i = 0; i < nIn; i++) { - int index = (int) Math.floor(in2[i] * (double) (nInTableEntries - 1)); // floor in - - // clip values. - if (index >= nInTableEntries - 1) - in2[i] = (float) inTable[i][nInTableEntries - 1]; - else if (index < 0) - in2[i] = (float) inTable[i][0]; - else - { - // linear interpolation - double alpha = in2[i] * ((double) nInTableEntries - 1.0) - index; - in2[i] = (float) (inTable[i][index] * (1 - alpha) - + inTable[i][index + 1] * alpha); - } + int index = (int) Math.floor(in2[i] * (double) (nInTableEntries - 1)); // floor in + + // clip values. + if (index >= nInTableEntries - 1) + in2[i] = (float) inTable[i][nInTableEntries - 1]; + else if (index < 0) + in2[i] = (float) inTable[i][0]; + else + { + // linear interpolation + double alpha = in2[i] * ((double) nInTableEntries - 1.0) - index; + in2[i] = (float) (inTable[i][index] * (1 - alpha) + + inTable[i][index + 1] * alpha); + } } // CLUT lookup @@ -295,31 +295,31 @@ public class ColorLookUpTable int offset = 0; // = gp for (int i = 0; i < nIn; i++) { - int index = (int) Math.floor(in2[i] * ((double) gridpoints - 1.0)); - double alpha = in2[i] * ((double) gridpoints - 1.0) - (double) index; - - // clip values. - if (index >= gridpoints - 1) - { - index = gridpoints - 1; - alpha = 1.0; - } - else if (index < 0) - index = 0; - clutalpha[i] = alpha; - offset += index * multiplier[i]; + int index = (int) Math.floor(in2[i] * ((double) gridpoints - 1.0)); + double alpha = in2[i] * ((double) gridpoints - 1.0) - (double) index; + + // clip values. + if (index >= gridpoints - 1) + { + index = gridpoints - 1; + alpha = 1.0; + } + else if (index < 0) + index = 0; + clutalpha[i] = alpha; + offset += index * multiplier[i]; } // Calculate interpolation weights weights[0] = 1.0; for (int j = 0; j < nIn; j++) { - int factor = 1 << j; - for (int i = 0; i < factor; i++) - { - weights[factor + i] = weights[i] * clutalpha[j]; - weights[i] *= (1.0 - clutalpha[j]); - } + int factor = 1 << j; + for (int i = 0; i < factor; i++) + { + weights[factor + i] = weights[i] * clutalpha[j]; + weights[i] *= (1.0 - clutalpha[j]); + } } for (int i = 0; i < nOut; i++) @@ -327,32 +327,32 @@ public class ColorLookUpTable for (int i = 1; i < (1 << nIn); i++) { - int offset2 = offset + offsets[i]; - for (int f = 0; f < nOut; f++) - output2[f] += weights[i] * clut[offset2 + f]; + int offset2 = offset + offsets[i]; + for (int f = 0; f < nOut; f++) + output2[f] += weights[i] * clut[offset2 + f]; } - // output table + // output table float[] output = new float[nOut]; for (int i = 0; i < nOut; i++) { - int index = (int) Math.floor(output2[i] * ((double) nOutTableEntries - - 1.0)); - - // clip values. - if (index >= nOutTableEntries - 1) - output[i] = outTable[i][nOutTableEntries - 1]; - else if (index < 0) - output[i] = outTable[i][0]; - else - { - // linear interpolation - double a = output2[i] * ((double) nOutTableEntries - 1.0) - - (double) index; - output[i] = (float) ((double) ((int) outTable[i][index] & (0xFFFF)) * (1 - - a) - + (double) ((int) outTable[i][index + 1] & (0xFFFF)) * a) / 65536f; - } + int index = (int) Math.floor(output2[i] * ((double) nOutTableEntries + - 1.0)); + + // clip values. + if (index >= nOutTableEntries - 1) + output[i] = outTable[i][nOutTableEntries - 1]; + else if (index < 0) + output[i] = outTable[i][0]; + else + { + // linear interpolation + double a = output2[i] * ((double) nOutTableEntries - 1.0) + - (double) index; + output[i] = (float) ((double) ((int) outTable[i][index] & (0xFFFF)) * (1 + - a) + + (double) ((int) outTable[i][index + 1] & (0xFFFF)) * a) / 65536f; + } } if (outputLab) @@ -365,7 +365,7 @@ public class ColorLookUpTable */ private float[] LabtoXYZ(float[] in) { - // Convert from byte-packed format to a + // Convert from byte-packed format to a // more convenient one (actual Lab values) // (See ICC spec for details) // factor is 100 * 65536 / 65280 @@ -381,12 +381,12 @@ public class ColorLookUpTable for (int i = 0; i < 3; i++) { - double exp = out[i] * out[i] * out[i]; - if (exp <= 0.008856) - out[i] = (out[i] - 16.0f / 116.0f) / 7.787f; - else - out[i] = (float) exp; - out[i] = D50[i] * out[i]; + double exp = out[i] * out[i] * out[i]; + if (exp <= 0.008856) + out[i] = (out[i] - 16.0f / 116.0f) / 7.787f; + else + out[i] = (float) exp; + out[i] = D50[i] * out[i]; } return out; } @@ -400,12 +400,12 @@ public class ColorLookUpTable for (int i = 0; i < 3; i++) { - temp[i] = in[i] / D50[i]; + temp[i] = in[i] / D50[i]; - if (temp[i] <= 0.008856f) - temp[i] = (7.7870689f * temp[i]) + (16f / 116.0f); - else - temp[i] = (float) Math.exp((1.0 / 3.0) * Math.log(temp[i])); + if (temp[i] <= 0.008856f) + temp[i] = (7.7870689f * temp[i]) + (16f / 116.0f); + else + temp[i] = (float) Math.exp((1.0 / 3.0) * Math.log(temp[i])); } float[] out = new float[3]; @@ -419,10 +419,10 @@ public class ColorLookUpTable out[2] = (out[2] + 128f) / 256f; for (int i = 0; i < 3; i++) { - if (out[i] < 0f) - out[i] = 0f; - if (out[i] > 1f) - out[i] = 1f; + if (out[i] < 0f) + out[i] = 0f; + if (out[i] > 1f) + out[i] = 1f; } return out; } diff --git a/libjava/classpath/gnu/java/awt/color/GrayProfileConverter.java b/libjava/classpath/gnu/java/awt/color/GrayProfileConverter.java index 3c72513..3f95b07 100644 --- a/libjava/classpath/gnu/java/awt/color/GrayProfileConverter.java +++ b/libjava/classpath/gnu/java/awt/color/GrayProfileConverter.java @@ -67,11 +67,11 @@ public class GrayProfileConverter implements ColorSpaceConverter { try { - trc = new ToneReproductionCurve(profile.getGamma()); + trc = new ToneReproductionCurve(profile.getGamma()); } catch (ProfileDataException e) { - trc = new ToneReproductionCurve(profile.getTRC()); + trc = new ToneReproductionCurve(profile.getTRC()); } // linear grayscale converter @@ -84,20 +84,20 @@ public class GrayProfileConverter implements ColorSpaceConverter // unpredictable results. This is in line with the Java specification, try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } } diff --git a/libjava/classpath/gnu/java/awt/color/GrayScaleConverter.java b/libjava/classpath/gnu/java/awt/color/GrayScaleConverter.java index 7a27ddb..beea9d2 100644 --- a/libjava/classpath/gnu/java/awt/color/GrayScaleConverter.java +++ b/libjava/classpath/gnu/java/awt/color/GrayScaleConverter.java @@ -95,15 +95,15 @@ public class GrayScaleConverter implements ColorSpaceConverter out[0] = 0; for (int i = 0; i < 3; i++) { - float n = in[i]; - if (n < 0) - n = 0f; - if (n > 1) - n = 1f; - if (n <= 0.03928f) - out[0] += (float) (coeff[i] * n / 12.92); - else - out[0] += (float) (coeff[i] * Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); + float n = in[i]; + if (n < 0) + n = 0f; + if (n > 1) + n = 1f; + if (n <= 0.03928f) + out[0] += (float) (coeff[i] * n / 12.92); + else + out[0] += (float) (coeff[i] * Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); } return out; } diff --git a/libjava/classpath/gnu/java/awt/color/LinearRGBConverter.java b/libjava/classpath/gnu/java/awt/color/LinearRGBConverter.java index 13a4e2c..1eaf647 100644 --- a/libjava/classpath/gnu/java/awt/color/LinearRGBConverter.java +++ b/libjava/classpath/gnu/java/awt/color/LinearRGBConverter.java @@ -58,16 +58,16 @@ public class LinearRGBConverter implements ColorSpaceConverter float[] out = new float[3]; for (int i = 0; i < 3; i++) { - float n = in[i]; - if (n < 0) - n = 0f; - if (n > 1) - n = 1f; - if (n <= 0.00304f) - out[i] = in[0] * 12.92f; - else - out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(n))) - - 0.055f; + float n = in[i]; + if (n < 0) + n = 0f; + if (n > 1) + n = 1f; + if (n <= 0.00304f) + out[i] = in[0] * 12.92f; + else + out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(n))) + - 0.055f; } return out; } @@ -84,15 +84,15 @@ public class LinearRGBConverter implements ColorSpaceConverter // numbers from the w3 spec. for (int i = 0; i < 3; i++) { - float n = in[i]; - if (n < 0) - n = 0f; - if (n > 1) - n = 1f; - if (n <= 0.03928f) - out[i] = (float) (n / 12.92); - else - out[i] = (float) (Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); + float n = in[i]; + if (n < 0) + n = 0f; + if (n > 1) + n = 1f; + if (n <= 0.03928f) + out[i] = (float) (n / 12.92); + else + out[i] = (float) (Math.exp(2.4 * Math.log((n + 0.055) / 1.055))); } return out; } diff --git a/libjava/classpath/gnu/java/awt/color/ProfileHeader.java b/libjava/classpath/gnu/java/awt/color/ProfileHeader.java index 4fdef56..2a6402d 100644 --- a/libjava/classpath/gnu/java/awt/color/ProfileHeader.java +++ b/libjava/classpath/gnu/java/awt/color/ProfileHeader.java @@ -57,7 +57,7 @@ public class ProfileHeader /** * Mapping from ICC Profile signatures to ColorSpace types */ - private static final int[] csTypeMap = + private static final int[] csTypeMap = { ICC_Profile.icSigXYZData, ColorSpace.TYPE_XYZ, @@ -119,7 +119,7 @@ public class ProfileHeader /** * Mapping of ICC class signatures to profile class constants */ - private static final int[] classMap = + private static final int[] classMap = { ICC_Profile.icSigInputClass, ICC_Profile.CLASS_INPUT, @@ -194,7 +194,7 @@ public class ProfileHeader { ByteBuffer buf = ByteBuffer.wrap(data); - // Get size (the sign bit shouldn't matter. + // Get size (the sign bit shouldn't matter. // A valid profile can never be +2Gb) size = buf.getInt(ICC_Profile.icHdrSize); @@ -211,8 +211,8 @@ public class ProfileHeader for (int i = 0; i < classMap.length; i += 2) if (classMap[i] == classSig) { - profileClass = classMap[i + 1]; - break; + profileClass = classMap[i + 1]; + break; } // get the data color space @@ -221,8 +221,8 @@ public class ProfileHeader for (int i = 0; i < csTypeMap.length; i += 2) if (csTypeMap[i] == csSig) { - colorSpace = csTypeMap[i + 1]; - break; + colorSpace = csTypeMap[i + 1]; + break; } // get the profile color space (PCS), must be xyz or lab except @@ -231,19 +231,19 @@ public class ProfileHeader profileColorSpace = -1; if (profileClass != ICC_Profile.CLASS_DEVICELINK) { - if (pcsSig == ICC_Profile.icSigXYZData) - profileColorSpace = ColorSpace.TYPE_XYZ; - if (pcsSig == ICC_Profile.icSigLabData) - profileColorSpace = ColorSpace.TYPE_Lab; + if (pcsSig == ICC_Profile.icSigXYZData) + profileColorSpace = ColorSpace.TYPE_XYZ; + if (pcsSig == ICC_Profile.icSigLabData) + profileColorSpace = ColorSpace.TYPE_Lab; } else { - for (int i = 0; i < csTypeMap.length; i += 2) - if (csTypeMap[i] == pcsSig) - { - profileColorSpace = csTypeMap[i + 1]; - break; - } + for (int i = 0; i < csTypeMap.length; i += 2) + if (csTypeMap[i] == pcsSig) + { + profileColorSpace = csTypeMap[i + 1]; + break; + } } // creation timestamp @@ -266,7 +266,7 @@ public class ProfileHeader System.arraycopy(data, ICC_Profile.icHdrAttributes, attributes, 0, 8); // rendering intent intent = buf.getInt(ICC_Profile.icHdrRenderingIntent); - // illuminant info + // illuminant info illuminant = new byte[12]; System.arraycopy(data, ICC_Profile.icHdrIlluminant, illuminant, 0, 12); // Creator signature @@ -321,13 +321,13 @@ public class ProfileHeader (short) (majorVersion << 8 | minorVersion)); for (int i = 1; i < classMap.length; i += 2) if (profileClass == classMap[i]) - buf.putInt(ICC_Profile.icHdrDeviceClass, classMap[i - 1]); + buf.putInt(ICC_Profile.icHdrDeviceClass, classMap[i - 1]); for (int i = 1; i < csTypeMap.length; i += 2) if (csTypeMap[i] == colorSpace) - buf.putInt(ICC_Profile.icHdrColorSpace, csTypeMap[i - 1]); + buf.putInt(ICC_Profile.icHdrColorSpace, csTypeMap[i - 1]); for (int i = 1; i < csTypeMap.length; i += 2) if (csTypeMap[i] == profileColorSpace) - buf.putInt(ICC_Profile.icHdrPcs, csTypeMap[i - 1]); + buf.putInt(ICC_Profile.icHdrPcs, csTypeMap[i - 1]); System.arraycopy(timestamp, 0, data, ICC_Profile.icHdrDate, timestamp.length); diff --git a/libjava/classpath/gnu/java/awt/color/RgbProfileConverter.java b/libjava/classpath/gnu/java/awt/color/RgbProfileConverter.java index 0cbd28f..7623890 100644 --- a/libjava/classpath/gnu/java/awt/color/RgbProfileConverter.java +++ b/libjava/classpath/gnu/java/awt/color/RgbProfileConverter.java @@ -82,27 +82,27 @@ public class RgbProfileConverter implements ColorSpaceConverter // get TRCs try { - rTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.REDCOMPONENT)); + rTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.REDCOMPONENT)); } catch (ProfileDataException e) { - rTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.REDCOMPONENT)); + rTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.REDCOMPONENT)); } try { - gTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.GREENCOMPONENT)); + gTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.GREENCOMPONENT)); } catch (ProfileDataException e) { - gTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.GREENCOMPONENT)); + gTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.GREENCOMPONENT)); } try { - bTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.BLUECOMPONENT)); + bTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.BLUECOMPONENT)); } catch (ProfileDataException e) { - bTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.BLUECOMPONENT)); + bTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.BLUECOMPONENT)); } // If a CLUT is available, it should be used, and the TRCs ignored. @@ -112,30 +112,30 @@ public class RgbProfileConverter implements ColorSpaceConverter // unpredictable results. This is in line with the Java specification, try { - toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); + toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag); } catch (Exception e) { - toPCS = null; + toPCS = null; } try { - fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); + fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag); } catch (Exception e) { - fromPCS = null; + fromPCS = null; } // Calculate the inverse matrix if no reverse CLUT is available if(fromPCS == null) - inv_matrix = invertMatrix(matrix); - else + inv_matrix = invertMatrix(matrix); + else { // otherwise just set it to an identity matrix - inv_matrix = new float[3][3]; - inv_matrix[0][0] = inv_matrix[1][1] = inv_matrix[2][2] = 1.0f; + inv_matrix = new float[3][3]; + inv_matrix[0][0] = inv_matrix[1][1] = inv_matrix[2][2] = 1.0f; } } @@ -191,7 +191,7 @@ public class RgbProfileConverter implements ColorSpaceConverter out[2] = bTRC.reverseLookup(temp[2]); // FIXME: Sun appears to clip the return values to [0,1] - // I don't believe that is a Good Thing, + // I don't believe that is a Good Thing, // (some colorspaces may allow values outside that range.) // So we return the actual values here. return out; diff --git a/libjava/classpath/gnu/java/awt/color/SrgbConverter.java b/libjava/classpath/gnu/java/awt/color/SrgbConverter.java index a30a0db..76831c0 100644 --- a/libjava/classpath/gnu/java/awt/color/SrgbConverter.java +++ b/libjava/classpath/gnu/java/awt/color/SrgbConverter.java @@ -107,15 +107,15 @@ public class SrgbConverter implements ColorSpaceConverter float[] out = new float[3]; for (int i = 0; i < 3; i++) { - if (temp[i] < 0) - temp[i] = 0.0f; - if (temp[i] > 1) - temp[i] = 1.0f; - if (temp[i] <= 0.00304f) - out[i] = temp[i] * 12.92f; - else - out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(temp[i]))) - - 0.055f; + if (temp[i] < 0) + temp[i] = 0.0f; + if (temp[i] > 1) + temp[i] = 1.0f; + if (temp[i] <= 0.00304f) + out[i] = temp[i] * 12.92f; + else + out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(temp[i]))) + - 0.055f; } return out; } @@ -132,9 +132,9 @@ public class SrgbConverter implements ColorSpaceConverter float[] out = new float[3]; for (int i = 0; i < 3; i++) if (in[i] <= 0.03928f) - temp[i] = in[i] / 12.92f; + temp[i] = in[i] / 12.92f; else - temp[i] = (float) Math.exp(2.4 * Math.log((in[i] + 0.055) / 1.055)); + temp[i] = (float) Math.exp(2.4 * Math.log((in[i] + 0.055) / 1.055)); /* * Note: The numbers which were used to calculate this only had four diff --git a/libjava/classpath/gnu/java/awt/color/ToneReproductionCurve.java b/libjava/classpath/gnu/java/awt/color/ToneReproductionCurve.java index a1bccbd..208e168 100644 --- a/libjava/classpath/gnu/java/awt/color/ToneReproductionCurve.java +++ b/libjava/classpath/gnu/java/awt/color/ToneReproductionCurve.java @@ -103,20 +103,20 @@ public class ToneReproductionCurve if (trc == null) { - if (in == 0f) - return 0.0f; - return (float) Math.exp(gamma * Math.log(in)); + if (in == 0f) + return 0.0f; + return (float) Math.exp(gamma * Math.log(in)); } else { - double alpha = in * (trc.length - 1); - int index = (int) Math.floor(alpha); - alpha = alpha - (double) index; - if (index >= trc.length - 1) - return trc[trc.length - 1]; - if (index <= 0) - return trc[0]; - out = (float) (trc[index] * (1.0 - alpha) + trc[index + 1] * alpha); + double alpha = in * (trc.length - 1); + int index = (int) Math.floor(alpha); + alpha = alpha - (double) index; + if (index >= trc.length - 1) + return trc[trc.length - 1]; + if (index <= 0) + return trc[0]; + out = (float) (trc[index] * (1.0 - alpha) + trc[index + 1] * alpha); } return out; } @@ -130,21 +130,21 @@ public class ToneReproductionCurve if (trc == null) { - if (in == 0f) - return 0.0f; - return (float) Math.exp((1.0 / gamma) * Math.log(in)); + if (in == 0f) + return 0.0f; + return (float) Math.exp((1.0 / gamma) * Math.log(in)); } else { - double alpha = in * (reverseTrc.length - 1); - int index = (int) Math.floor(alpha); - alpha = alpha - (double) index; - if (index >= reverseTrc.length - 1) - return reverseTrc[reverseTrc.length - 1]; - if (index <= 0) - return reverseTrc[0]; - out = (float) (reverseTrc[index] * (1.0 - alpha) - + reverseTrc[index + 1] * alpha); + double alpha = in * (reverseTrc.length - 1); + int index = (int) Math.floor(alpha); + alpha = alpha - (double) index; + if (index >= reverseTrc.length - 1) + return reverseTrc[reverseTrc.length - 1]; + if (index <= 0) + return reverseTrc[0]; + out = (float) (reverseTrc[index] * (1.0 - alpha) + + reverseTrc[index + 1] * alpha); } return out; } @@ -164,14 +164,14 @@ public class ToneReproductionCurve int j = 0; for (int i = 0; i < 10000; i++) { - float n = ((float) i) / 10000f; - while (trc[j + 1] < n && j < trc.length - 2) - j++; - - if (j == trc.length - 2) - reverseTrc[i] = trc[trc.length - 1]; - else - reverseTrc[i] = (j + (n - trc[j]) / (trc[j + 1] - trc[j])) / ((float) trc.length); + float n = ((float) i) / 10000f; + while (trc[j + 1] < n && j < trc.length - 2) + j++; + + if (j == trc.length - 2) + reverseTrc[i] = trc[trc.length - 1]; + else + reverseTrc[i] = (j + (n - trc[j]) / (trc[j + 1] - trc[j])) / ((float) trc.length); } } } diff --git a/libjava/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java b/libjava/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java index 1f0c3ad..4ef8c29 100644 --- a/libjava/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java +++ b/libjava/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java @@ -59,28 +59,28 @@ public class GtkMouseDragGestureRecognizer { this (ds, c, 0, null); } - + public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act) { this(ds, c, act, null); } - + public GtkMouseDragGestureRecognizer (DragSource ds, Component c, int act, DragGestureListener dgl) { super(ds, c, act, dgl); } - + public void registerListeners () { super.registerListeners(); } - + public void unregisterListeners () { super.unregisterListeners(); } - + public void mouseClicked (MouseEvent e) { // Nothing to do here. @@ -115,7 +115,7 @@ public class GtkMouseDragGestureRecognizer if (!events.isEmpty()) { int act = getDropActionFromEvent(e); - + if (act == DnDConstants.ACTION_NONE) return; @@ -124,14 +124,14 @@ public class GtkMouseDragGestureRecognizer int dx = Math.abs(origin.x - current.x); int dy = Math.abs(origin.y - current.y); int threshold = DragSource.getDragThreshold(); - + if (dx > threshold || dy > threshold) fireDragGestureRecognized(act, origin); else appendEvent(e); } } - + public void mouseMoved (MouseEvent e) { // Nothing to do here. @@ -142,10 +142,10 @@ public class GtkMouseDragGestureRecognizer int modEx = e.getModifiersEx(); int buttons = modEx & (MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK); - if (!(buttons == MouseEvent.BUTTON1_DOWN_MASK || + if (!(buttons == MouseEvent.BUTTON1_DOWN_MASK || buttons == MouseEvent.BUTTON2_DOWN_MASK)) return DnDConstants.ACTION_NONE; - + // Convert modifier to a drop action int sourceActions = getSourceActions(); int mod = modEx diff --git a/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java b/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java index b68fa10..4d10976 100644 --- a/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java +++ b/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java @@ -62,54 +62,54 @@ public class GtkDragSourceContextPeer private Cursor cursor; private DragSourceContext context; public static Component target; - + native void nativeStartDrag(Image i, int x, int y, int action, String target); native void connectSignals(ComponentPeer comp); native void create(ComponentPeer comp); native void nativeSetCursor(int cursor); native void setTarget(GtkDropTargetContextPeer target); - + public GtkDragSourceContextPeer(DragGestureEvent e) { super(e.getComponent()); Component comp = e.getComponent(); peer = getComponentPeer(comp); - + create(peer); connectSignals(peer); cursor = comp.getCursor(); - + // FIXME: Where do we set the target? - + if ((target != null)) setTarget(new GtkDropTargetContextPeer(target)); } - + ComponentPeer getComponentPeer(Component c) { if (c == null) return null; - + Component curr = c; while (curr.getPeer() instanceof LightweightPeer) curr = curr.getParent(); - + if (curr != null) return curr.getPeer(); return null; } - + public void startDrag(DragSourceContext context, Cursor c, Image i, Point p) throws InvalidDnDOperationException - { + { this.context = context; if (p == null) p = new Point(); - + // FIXME: use proper DataFlavor, not "text/plain". // Also, add check to determine if dragging. - + setCursor(c); nativeStartDrag(i, p.x, p.y, context.getTrigger().getDragAction(), "text/plain"); @@ -133,7 +133,7 @@ public class GtkDragSourceContextPeer { // Nothing to do here. } - + /** * Called from native code. */ diff --git a/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java b/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java index f24b3f3..315a2bd 100644 --- a/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java +++ b/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java @@ -50,12 +50,12 @@ public class GtkDropTargetContextPeer extends GtkGenericPeer implements DropTargetContextPeer { - + public GtkDropTargetContextPeer(Object obj) { super(obj); } - + public void setTargetActions(int actions) { // FIXME: Not Implemented diff --git a/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java b/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java index 88b75ad..0799df5 100644 --- a/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java +++ b/libjava/classpath/gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java @@ -52,7 +52,7 @@ public class GtkDropTargetPeer { super(null); } - + public void addDropTarget(DropTarget target) { // FIXME: Not Implemented diff --git a/libjava/classpath/gnu/java/awt/font/FontDelegate.java b/libjava/classpath/gnu/java/awt/font/FontDelegate.java index a778733..e5c03a1 100644 --- a/libjava/classpath/gnu/java/awt/font/FontDelegate.java +++ b/libjava/classpath/gnu/java/awt/font/FontDelegate.java @@ -77,8 +77,8 @@ public interface FontDelegate * @return the face name. */ public String getFullName(Locale locale); - - + + /** * Returns the name of the family to which this font face belongs, * for example <i>“Univers”</i>. @@ -99,8 +99,8 @@ public interface FontDelegate * @return the name of the face inside its family. */ public String getSubFamilyName(Locale locale); - - + + /** * Returns the PostScript name of this font face, for example * <i>“Helvetica-Bold”</i>. @@ -131,7 +131,7 @@ public interface FontDelegate * glyph as an empty box. */ public int getMissingGlyphCode(); - + /** * Creates a GlyphVector by mapping each character in a @@ -205,7 +205,7 @@ public interface FontDelegate boolean fractionalMetrics, boolean horizontal, Point2D advance); - + /** * Returns the shape of a glyph. diff --git a/libjava/classpath/gnu/java/awt/font/FontFactory.java b/libjava/classpath/gnu/java/awt/font/FontFactory.java index 6c1084e..53eb5df 100644 --- a/libjava/classpath/gnu/java/awt/font/FontFactory.java +++ b/libjava/classpath/gnu/java/awt/font/FontFactory.java @@ -58,7 +58,7 @@ public final class FontFactory { } - + /** * Creates FontDelegate objects for the fonts in the specified buffer. * The following font formats are currently recognized: diff --git a/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java b/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java index 22f331e..9fd80e7 100644 --- a/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java +++ b/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java @@ -113,7 +113,7 @@ public class GNUGlyphVector this.font = font; this.renderContext = renderContext; this.glyphs = glyphs; - + fontSize = font.getSize2D(); transform = font.getTransform(); // returns a modifiable copy //transform.concatenate(renderContext.getTransform()); @@ -156,7 +156,7 @@ public class GNUGlyphVector for (i = p = 0; i < glyphs.length; i++) { p += 2; - + if ((transforms == null) || (tx = transforms[i]) == null) tx = this.transform; else @@ -164,7 +164,7 @@ public class GNUGlyphVector tx = new AffineTransform(tx); tx.concatenate(this.transform); } - + fontDelegate.getAdvance(glyphs[i], fontSize, tx, renderContext.isAntiAliased(), renderContext.usesFractionalMetrics(), @@ -502,11 +502,11 @@ public class GNUGlyphVector { return layoutFlags; } - - + + /** * Returns the positions of a range of glyphs in this vector. - * + * * @param firstGlyphIndex the index of the first glyph whose * position is retrieved. * @@ -546,7 +546,7 @@ public class GNUGlyphVector return outPositions; } - + private float getAscent() { return fontDelegate.getAscent(fontSize, transform, @@ -561,7 +561,7 @@ public class GNUGlyphVector return fontDelegate.getDescent(fontSize, transform, renderContext.isAntiAliased(), renderContext.usesFractionalMetrics(), - /* horizontal */ true); + /* horizontal */ true); } diff --git a/libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java b/libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java index e812452..d8bff11 100644 --- a/libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java +++ b/libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java @@ -180,7 +180,7 @@ public class OpenTypeFontPeer { return 0.F; } - + } private class XFontMetrics @@ -207,7 +207,7 @@ public class OpenTypeFontPeer return (int) fontDelegate.getDescent(getFont().getSize(), IDENDITY, false, false, false); } - + public int getHeight() { GlyphVector gv = fontDelegate.createGlyphVector(getFont(), @@ -441,7 +441,7 @@ public class OpenTypeFontPeer case Font.PLAIN: default: key.append("p"); - + } return key.toString(); diff --git a/libjava/classpath/gnu/java/awt/font/autofit/GlyphHints.java b/libjava/classpath/gnu/java/awt/font/autofit/GlyphHints.java index 72f07ed..033d63f 100644 --- a/libjava/classpath/gnu/java/awt/font/autofit/GlyphHints.java +++ b/libjava/classpath/gnu/java/awt/font/autofit/GlyphHints.java @@ -84,7 +84,7 @@ class GlyphHints metrics = m; // TODO: Copy scalerFlags. } - + void reload(Zone outline) { numPoints = 0; diff --git a/libjava/classpath/gnu/java/awt/font/autofit/Latin.java b/libjava/classpath/gnu/java/awt/font/autofit/Latin.java index 8951e8b..c132c2c 100644 --- a/libjava/classpath/gnu/java/awt/font/autofit/Latin.java +++ b/libjava/classpath/gnu/java/awt/font/autofit/Latin.java @@ -103,7 +103,7 @@ class Latin hints.alignStrongPoints(dim); if (hints.doAlignWeakPoints()) hints.alignWeakPoints(dim); - + } } // FreeType does a save call here. I guess that's not needed as we operate @@ -407,7 +407,7 @@ class Latin dist += 54; else dist += delta; - + } else { @@ -969,7 +969,7 @@ class Latin blue.flags = 0; if (isTopBlue(bb)) blue.flags |= LatinBlue.FLAG_TOP; - // The following flag is used later to adjust y and x scales in + // The following flag is used later to adjust y and x scales in // order to optimize the pixel grid alignment of the top small // letters. if (bb == SMALL_TOP) @@ -1043,7 +1043,7 @@ class Latin last = point; boolean passed = false; boolean onEdge = false; - while (true) + while (true) { int u, v; if (onEdge) @@ -1099,7 +1099,7 @@ class Latin point = point.getNext(); } } - + } private boolean isTopBlue(int b) @@ -1276,7 +1276,7 @@ class Latin // Debug: Print out all edges. // System.err.println("edge# " + e + ": " + edge); - } + } } private void computeBlueEdges(GlyphHints hints, LatinMetrics metrics) @@ -1297,7 +1297,7 @@ class Latin // System.err.println("checking edge: " + edge); Width bestBlue = null; int bestDist = Fixed.mul16(metrics.unitsPerEm / 40, scale); - + if (bestDist > 64 / 2) bestDist = 64 / 2; for (int bb = 0; bb < BLUE_MAX; bb++) diff --git a/libjava/classpath/gnu/java/awt/font/autofit/Utils.java b/libjava/classpath/gnu/java/awt/font/autofit/Utils.java index 4df4705..ca45bb2 100644 --- a/libjava/classpath/gnu/java/awt/font/autofit/Utils.java +++ b/libjava/classpath/gnu/java/awt/font/autofit/Utils.java @@ -158,7 +158,7 @@ class Utils return angle; } - + angle = 0; if (dx < 0) { diff --git a/libjava/classpath/gnu/java/awt/font/opentype/CharGlyphMap.java b/libjava/classpath/gnu/java/awt/font/opentype/CharGlyphMap.java index 1840750..8529f7e 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/CharGlyphMap.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/CharGlyphMap.java @@ -89,7 +89,7 @@ public abstract class CharGlyphMap /** * Reads a CharGlyphMap from an OpenType or TrueType <code>cmap</code> * table. The current implementation works as follows: - * + * * <p><ol><li>If the font has a type 4 cmap for the Unicode platform * (encoding 0, 1, 2, 3 or 4), or a type 4 cmap for the Microsoft * platform (encodings 1 or 10), that table is used to map Unicode @@ -132,7 +132,7 @@ public abstract class CharGlyphMap version = buf.getChar(); if (version != 0) return null; - + numTables = buf.getChar(); for (int i = 0; i < numTables; i++) { @@ -229,8 +229,8 @@ public abstract class CharGlyphMap return 0; } } - - + + /** * A mapping from Unicode code points to glyph IDs through CMAP Type * 0 tables. These tables have serious limitations: Only the first @@ -255,8 +255,8 @@ public abstract class CharGlyphMap * Unicode code point of glyph <code>i</code> in the font. */ private char[] glyphToUCS2 = new char[256]; - - + + /** * A String whose <code>charAt(i)</code> is the Unicode character * that corresponds to the codepoint <code>i + 127</code> in the @@ -562,7 +562,7 @@ public abstract class CharGlyphMap /* The CMAP version must be 0. */ if (buf.getChar() != 0) throw new IllegalStateException(); - + numTables = buf.getChar(); for (int i = 0; i < numTables; i++) { @@ -705,7 +705,7 @@ public abstract class CharGlyphMap return null; } } - + /** * A mapping from Unicode code points to glyph IDs through CMAP Type @@ -805,7 +805,7 @@ public abstract class CharGlyphMap buf.position(pos); idRangeOffset_glyphID = buf.asCharBuffer(); - + endCode.limit(segCount); startCode.limit(segCount); idDelta.limit(segCount); @@ -856,7 +856,7 @@ public abstract class CharGlyphMap segStart = firstChar.get(segment); if ((c < segStart) || (c > lastChar.get(segment))) return 0; - + /* * System.out.println("seg " + segment * + ", range=" + (int) rangeID[segment] @@ -912,8 +912,8 @@ public abstract class CharGlyphMap { int numGroups; IntBuffer data; - - + + /** * Determines whether this implementation supports a combination * of platform and encoding for a type 12 <code>cmap</code> table. @@ -964,8 +964,8 @@ public abstract class CharGlyphMap numGroups = buf.getInt(); data = buf.asIntBuffer(); } - - + + /** * Determines the glyph index for a given Unicode codepoint. Users * should be aware that the character-to-glyph mapping not not @@ -993,7 +993,7 @@ public abstract class CharGlyphMap startCharCode = data.get(3 * mid); endCharCode = data.get(3 * mid + 1); - + /* System.out.println("group " + mid + " (U+" + Integer.toHexString(startCharCode) @@ -1005,7 +1005,7 @@ public abstract class CharGlyphMap return ucs4 - startCharCode + /* startGlyphID */ data.get(mid * 3 + 2); - + if (endCharCode < ucs4) min = mid + 1; else diff --git a/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java b/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java index c2b009d..72cecb5 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/GlyphNamer.java @@ -411,7 +411,7 @@ final class GlyphNamer readPost(); } - + /** * Sets up the information which allows to retrieve the information @@ -625,7 +625,7 @@ final class GlyphNamer * print " private static final String %s" % name * for i in range(0, len(s), 60): * print ' + "%s"' % s[i:i+60] - * + * * glyphs = {} * for line in open('aglfn13.txt', 'r').readlines(): * if line[0] == '#': continue @@ -1009,7 +1009,7 @@ final class GlyphNamer */ min = 0; max = AGLFN_GLYPHS.length() - 1; - mid = max >> 1; + mid = max >> 1; midChar = AGLFN_GLYPHS.charAt(mid); do { @@ -1023,7 +1023,7 @@ final class GlyphNamer midChar = AGLFN_GLYPHS.charAt(mid); } while (min < max); - + if (midChar != c) return null; @@ -1078,7 +1078,7 @@ final class GlyphNamer if (name != null) return name; } - + CPStringBuilder buf = new CPStringBuilder(numChars * 8); for (int i = 0; i < numChars; i++) { diff --git a/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java b/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java index 8115e04..c0f3de8 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java @@ -123,7 +123,7 @@ final class MacResourceFork } } } - + public Resource[] getResources(int type) { @@ -137,7 +137,7 @@ final class MacResourceFork } return null; } - + public Resource getResource(int type, short id) { @@ -149,7 +149,7 @@ final class MacResourceFork { if (types[i] != type) continue; - + res = resources[i]; for (int j = 0; j < res.length; j++) if (res[j].getID() == id) diff --git a/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java b/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java index e4ea202..1f1d50a 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/NameDecoder.java @@ -139,20 +139,20 @@ public class NameDecoder nameLen = nameTable.getShort(); nameStart = offset + nameTable.getShort(); - + if (nameID != name) continue; // Handle PS seperately as it can be only ASCII, although // possibly encoded as UTF-16BE if ( name == NAME_POSTSCRIPT ) - { - if( nameTable.get(nameStart) == 0 ) // Peek at top byte - result = decodeName("UTF-16BE", nameTable, nameStart, nameLen); - else - result = decodeName("ASCII", nameTable, nameStart, nameLen); - return result; - } + { + if( nameTable.get(nameStart) == 0 ) // Peek at top byte + result = decodeName("UTF-16BE", nameTable, nameStart, nameLen); + else + result = decodeName("ASCII", nameTable, nameStart, nameLen); + return result; + } match = false; switch (namePlatform) @@ -186,7 +186,7 @@ public class NameDecoder break; } - + if (match) { result = decodeName(namePlatform, nameEncoding, nameLanguage, @@ -316,7 +316,7 @@ public class NameDecoder if (loc == null) return -1; - + code = findLanguageCode(loc.getLanguage(), macLanguageCodes); switch (code) { @@ -333,10 +333,10 @@ public class NameDecoder // know what do do about them. See the method documentation for // details. } - + return code; } - + /** * Maps a Java Locale into a Microsoft language code. @@ -348,7 +348,7 @@ public class NameDecoder if (locale == null) return -1; - + isoCode = locale.getLanguage(); code = findLanguageCode(isoCode, microsoftLanguageCodes); if (code == -1) @@ -572,7 +572,7 @@ public class NameDecoder } } - + /** * Maps a Microsoft locale ID (LCID) to the name of the * corresponding Java Charset. @@ -664,7 +664,7 @@ public class NameDecoder case 3: /* Microsoft Windows */ return getWindowsLocale(language); - + default: return null; } diff --git a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java index 6c2193b..f46addc 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java @@ -83,7 +83,7 @@ public final class OpenTypeFont static final int TAG_TRUE = 0x74727565; // 'true' static final int TAG_TTCF = 0x74746366; // 'ttcf' static final int TAG_ZAPF = 0x5a617066; // 'Zapf' - + /** * A buffer containing the font data. Note that this may well be an @@ -112,7 +112,7 @@ public final class OpenTypeFont */ private int version; - + /** * The number of font units per em. For fonts with TrueType * outlines, this is usually a power of two (such as 2048). For @@ -133,7 +133,7 @@ public final class OpenTypeFont * The scaler to which the actual scaling work is delegated. */ private Scaler scaler; - + /** * A delegate object for mapping Unicode UCS-4 codepoints to glyph @@ -277,8 +277,8 @@ public final class OpenTypeFont return i; return -1; } - - + + /** * Returns the name of the family to which this font face belongs, @@ -352,8 +352,8 @@ public final class OpenTypeFont return name; } - - + + /** * Returns the full name of this font face, for example @@ -404,7 +404,7 @@ public final class OpenTypeFont */ return numGlyphs; } - + /** * Returns the index of the glyph which gets displayed if the font @@ -489,7 +489,7 @@ public final class OpenTypeFont result.limit(len); return result; } - + /** * Returns the size of one of the tables in the font, @@ -508,7 +508,7 @@ public final class OpenTypeFont { if (cmap != null) return cmap; - + synchronized (this) { if (cmap == null) @@ -545,7 +545,7 @@ public final class OpenTypeFont return getCharGlyphMap().getGlyph(ucs4); } - + /** * Creates a GlyphVector by mapping each character in a * CharacterIterator to the corresponding glyph. @@ -584,7 +584,7 @@ public final class OpenTypeFont // Initialize hinter if necessary. checkHinter(FontDelegate.FLAG_FITTED); - CharGlyphMap cmap; + CharGlyphMap cmap; int numGlyphs; int[] glyphs; int glyph; diff --git a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java index 3a00dfb..32c4828 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/OpenTypeFontFactory.java @@ -126,7 +126,7 @@ public final class OpenTypeFontFactory rsrc = fork.getResources(OpenTypeFont.TAG_SFNT); fonts = new OpenTypeFont[rsrc.length]; - for (int i = 0; i < fonts.length; i++) + for (int i = 0; i < fonts.length; i++) fonts[i] = new OpenTypeFont(rsrc[i].getContent(), 0); return fonts; diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java index 249a87d..8a3c566 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLoader.java @@ -71,8 +71,8 @@ final class GlyphLoader * glyph. */ private final GlyphMeasurer glyphMeasurer; - - + + /** * The virtual machine for executing TrueType bytecodes. */ @@ -157,7 +157,7 @@ final class GlyphLoader yMin = glyph.getChar(); xMax = glyph.getChar(); yMax = glyph.getChar(); - + if (numContours >= 0) loadSimpleGlyph(glyphIndex, pointSize, transform, antialias, @@ -272,13 +272,13 @@ final class GlyphLoader if ((flags & WE_HAVE_A_SCALE) != 0) { a = d = getDouble214(glyph); - b = c = 0.0; + b = c = 0.0; } else if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0) { a = getDouble214(glyph); d = getDouble214(glyph); - b = c = 0.0; + b = c = 0.0; } else if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0) { @@ -310,7 +310,7 @@ final class GlyphLoader if (Math.abs(Math.abs(c) - Math.abs(d)) <= 33.0/65536.0) n = n * 2; - + if ((flags & ARGS_ARE_XY_VALUES) != 0) { e = m * arg1; @@ -320,14 +320,14 @@ final class GlyphLoader e = f = 0.0; componentTransform.setTransform(a, b, c, d, 0.0, 0.0); - + // System.out.println("componentTransform = " + componentTransform // + ", e=" + e + ", f=" + f); componentTransform.concatenate(transform); int pos = glyph.position(); int lim = glyph.limit(); - + loadSubGlyph(subGlyphIndex, pointSize, componentTransform, antialias, subGlyphZone, Math.round((float) e + preTranslateX), @@ -431,7 +431,7 @@ final class GlyphLoader glyphMeasurer.getAdvanceWidth(glyphIndex, true)); glyphZone.setOriginalY(numPoints + 1, glyphMeasurer.getAdvanceHeight(glyphIndex, true)); - + /* Phantom point 2: Vertical origin. */ int vertX = glyphMeasurer.getAscent(/* vertical */ false); int vertY = glyphMeasurer.getAscent(/* horizontal */ true); diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java index a2db8ac..fc2256b 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphLocator.java @@ -94,7 +94,7 @@ abstract class GlyphLocator case 1: return new GlyphLocator.FourByte(loca, glyf); - + default: throw new FontFormatException("unsupported loca format"); } diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java index bbd0b9b..452456d 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java @@ -69,7 +69,7 @@ final class GlyphMeasurer * font’s <code>vmtx</code> table as shorts. */ private final ShortBuffer verticalGlyphMetrics; - + private final int numLongHorizontalMetricsEntries; private final int numLongVerticalMetricsEntries; @@ -82,7 +82,7 @@ final class GlyphMeasurer private final int horizontalLineGap; - + /** * Constructs a GlyphMeasurer from TrueType/OpenType font tables. * @@ -145,7 +145,7 @@ final class GlyphMeasurer { return horizontal ? horizontalAscent : verticalAscent; } - + /** * Returns the distance from the baseline to the lowest descender. @@ -156,7 +156,7 @@ final class GlyphMeasurer * @return the maximal descent, in font units. */ public int getDescent(boolean horizontal) - { + { return horizontal ? horizontalDescent : verticalDescent; } @@ -188,7 +188,7 @@ final class GlyphMeasurer * @return the advance width, in font units. */ public int getAdvanceWidth(int glyphIndex, boolean horizontal) - { + { if (!horizontal) return 0; diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java index 31c1203..438eb65 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Point.java @@ -53,7 +53,7 @@ public class Point public static final short FLAG_INFLECTION = 32; public static final short FLAG_DONE_X = 64; public static final short FLAG_DONE_Y = 128; - + /** * Right direction. */ diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java index 5f5cc00..1d5c53f 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java @@ -137,7 +137,7 @@ public final class TrueTypeScaler ByteBuffer htmx, ByteBuffer vhea, ByteBuffer vtmx, - ByteBuffer maxp, + ByteBuffer maxp, ByteBuffer controlValueTable, ByteBuffer fpgm, int locaFormat, ByteBuffer loca, @@ -254,7 +254,7 @@ public final class TrueTypeScaler advance.setLocation( scaleFactor * glyphMeasurer.getAdvanceWidth(glyphIndex, horizontal), scaleFactor * glyphMeasurer.getAdvanceHeight(glyphIndex, horizontal)); - + transform.transform(advance, advance); } diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java index c88d4c6..512c39f 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java @@ -70,7 +70,7 @@ import java.nio.ShortBuffer; * obtained from Apple Computer to use the patented technology inside * the United States. For other countries, different dates might * apply, or no license might be needed. - * + * * <p>The default build of this class does not use the patented * algorithms. If you have obtained a license from Apple, or if the * patent protection has expired, or if no license is required for @@ -348,7 +348,7 @@ class VirtualMachine /* Read the contents of the Control Value Table. */ if (controlValueTable != null) this.controlValueTable = controlValueTable.asShortBuffer(); - + maxInstructionDefs = maxp.getChar(22); maxStackElements = maxp.getChar(24); storage = new int[maxStorage]; @@ -356,7 +356,7 @@ class VirtualMachine this.preProgram = preProgram; numTwilightPoints = maxp.getChar(16); } - + /** * Sets the graphics state to default values. @@ -462,7 +462,7 @@ class VirtualMachine changeCTM = ((pointSize_Fixed != this.pointSize) || !deviceTransform.equals(this.deviceTransform) || (antialiased != this.antialiased)); - + if (changeCTM) { this.pointSize = pointSize_Fixed; @@ -489,7 +489,7 @@ class VirtualMachine return executeGlyphInstructions; } - + /** * Executes a stream of TrueType instructions. @@ -577,7 +577,7 @@ class VirtualMachine sbuf.append(getHex(inst.get(pc + 1 + i))); } } - + while (sbuf.length() < 30) sbuf.append(' '); sbuf.append('|'); @@ -814,7 +814,7 @@ class VirtualMachine case 0x16: // SZPS, Set Zone PointerS zp0 = zp1 = zp2 = getZone(stack[sp--]); break; - + case 0x17: // SLOOP, Set LOOP variable loop = stack[sp--]; break; @@ -837,7 +837,7 @@ class VirtualMachine /* illegal: --, -- */ -1, -1, /* handle nested if clauses */ true); break; - + case 0x1C: // JMPR, JuMP Relative inst.position(inst.position() - 1 + stack[sp--]); break; @@ -905,7 +905,7 @@ class VirtualMachine execute(fdefBuffer[i], fdefEntryPoint[i]); inst.position(e1); break; - + case 0x2C: // FDEF, Function DEFinition i = stack[sp--]; fdefBuffer[i] = inst; @@ -1170,7 +1170,7 @@ class VirtualMachine sp -= 2 * count; deltaC(stack, sp + 1, count, 32); break; - + case 0x76: // SROUND, Super ROUND setRoundingMode(Fixed.ONE, stack[sp--]); break; @@ -1198,7 +1198,7 @@ class VirtualMachine break; case 0x7c: // RUTG, Round Up To Grid - setRoundingMode(Fixed.ONE, 0x40); + setRoundingMode(Fixed.ONE, 0x40); break; case 0x7d: // RDTG, Round Down To Grid @@ -1279,7 +1279,7 @@ class VirtualMachine break; } break; - + case 0xb0: // PUSHB[0] case 0xb1: // PUSHB[1] case 0xb2: // PUSHB[2] @@ -1424,7 +1424,7 @@ class VirtualMachine delta = (arg & 15) - 8; if (delta >= 0) ++delta; - + rightShift = deltaShift - 6; if (rightShift > 0) delta = delta >> rightShift; @@ -1570,7 +1570,7 @@ class VirtualMachine org_a = getOriginalProjection(zp0, rp1); cur_a = getProjection(zp0, rp1); - org_b = getOriginalProjection(zp1, rp2); + org_b = getOriginalProjection(zp1, rp2); cur_b = getProjection(zp1, rp2); while (--loop >= 0) @@ -1643,7 +1643,7 @@ class VirtualMachine { result = compensation - roundPhase + roundThreshold - distance; result &= -roundPeriod; - return Math.max(-result, 0) - roundPhase; + return Math.max(-result, 0) - roundPhase; } } @@ -1694,7 +1694,7 @@ class VirtualMachine { cachedPixelsPerEM = Fixed.intValue(Fixed.vectorLength( applyCTM_x(projX >> 8, projY >> 8), - applyCTM_y(projX >> 8, projY >> 8))); + applyCTM_y(projX >> 8, projY >> 8))); } return cachedPixelsPerEM; diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java index 7c25a0a..b0559e0 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/Zone.java @@ -229,7 +229,7 @@ public final class Zone System.out.print('.'); else System.out.print('c'); - if (isContourEnd(i)) + if (isContourEnd(i)) System.out.print('E'); System.out.println(); if (isContourEnd(i)) diff --git a/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java b/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java index 0f60828..f4534f3 100644 --- a/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java +++ b/libjava/classpath/gnu/java/awt/font/opentype/truetype/ZonePathIterator.java @@ -70,7 +70,7 @@ final class ZonePathIterator */ private static final int EMIT_CLOSE = 1; - + /** * If <code>state</code> has this value, <code>currentSegment</code> * will emit a <code>SEG_MOVETO</code> segment to the first point in @@ -115,7 +115,7 @@ final class ZonePathIterator */ private int contourStart; - + private int type; /** @@ -152,7 +152,7 @@ final class ZonePathIterator return (state != EMIT_CLOSE) && (curPoint >= numPoints); } - + public void next() { boolean onCurve; @@ -231,7 +231,7 @@ final class ZonePathIterator else return p + 1; } - + /** @@ -244,7 +244,7 @@ final class ZonePathIterator { case EMIT_CLOSE: return PathIterator.SEG_CLOSE; - + case EMIT_MOVETO: return getStartSegment(curPoint, coords); @@ -270,7 +270,7 @@ final class ZonePathIterator if (floats == null) floats = new float[6]; int result; - + result = currentSegment(floats); for (int i = 0; i < 6; i++) coords[i] = floats[i]; @@ -362,7 +362,7 @@ final class ZonePathIterator if (zone.isOnCurve(contourStart)) { x = zone.getX(contourStart, type); - y = zone.getY(contourStart, type); + y = zone.getY(contourStart, type); } else { diff --git a/libjava/classpath/gnu/java/awt/image/AsyncImage.java b/libjava/classpath/gnu/java/awt/image/AsyncImage.java index 935601a..4fa3374 100644 --- a/libjava/classpath/gnu/java/awt/image/AsyncImage.java +++ b/libjava/classpath/gnu/java/awt/image/AsyncImage.java @@ -159,9 +159,9 @@ public class AsyncImage g = r.getGraphics(); // Should we return some dummy graphics instead? return g; } - + public boolean isComplete() { - return complete; + return complete; } public int getHeight(ImageObserver observer) diff --git a/libjava/classpath/gnu/java/awt/image/ImageConverter.java b/libjava/classpath/gnu/java/awt/image/ImageConverter.java index f607b34..f9c6268 100644 --- a/libjava/classpath/gnu/java/awt/image/ImageConverter.java +++ b/libjava/classpath/gnu/java/awt/image/ImageConverter.java @@ -55,7 +55,7 @@ import java.util.Hashtable; /** * Convert an Image to a BufferedImage. - * + * * @author Roman Kennke (kennke@aicas.com) */ public class ImageConverter implements ImageConsumer @@ -121,7 +121,7 @@ public class ImageConverter implements ImageConsumer scansize, transparency); } else if (model instanceof IndexColorModel - && targetColorModel.equals(ColorModel.getRGBdefault())) + && targetColorModel.equals(ColorModel.getRGBdefault())) { transparency = convertIndexColorModelToSRGB(x, y, w, h, (IndexColorModel) model, @@ -246,7 +246,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int transferPixels(int x, int y, int w, int h, ColorModel model, @@ -281,7 +281,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int transferPixels(int x, int y, int w, int h, ColorModel model, @@ -317,7 +317,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertPixels(int x, int y, int w, int h, ColorModel model, @@ -356,7 +356,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertPixels(int x, int y, int w, int h, ColorModel model, @@ -394,7 +394,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertIndexColorModelToSRGB(int x, int y, int w, int h, @@ -447,7 +447,7 @@ public class ImageConverter implements ImageConsumer * @param offset the offset in the pixel array * @param scansize the scanline size * @param transparency the assumed transparency - * + * * @return the determined transparency */ private int convertIndexColorModelToSRGB(int x, int y, int w, int h, diff --git a/libjava/classpath/gnu/java/awt/image/ImageDecoder.java b/libjava/classpath/gnu/java/awt/image/ImageDecoder.java index 8e8eecb..a572ea3 100644 --- a/libjava/classpath/gnu/java/awt/image/ImageDecoder.java +++ b/libjava/classpath/gnu/java/awt/image/ImageDecoder.java @@ -48,7 +48,7 @@ import java.io.InputStream; import java.net.URL; import java.util.Vector; -public abstract class ImageDecoder implements ImageProducer +public abstract class ImageDecoder implements ImageProducer { Vector consumers = new Vector (); String filename; @@ -94,7 +94,7 @@ public abstract class ImageDecoder implements ImageProducer length = imagelength; } - public void addConsumer (ImageConsumer ic) + public void addConsumer (ImageConsumer ic) { consumers.addElement (ic); } @@ -103,7 +103,7 @@ public abstract class ImageDecoder implements ImageProducer { return consumers.contains (ic); } - + public void removeConsumer (ImageConsumer ic) { consumers.removeElement (ic); @@ -115,20 +115,20 @@ public abstract class ImageDecoder implements ImageProducer addConsumer(ic); Vector list = (Vector) consumers.clone (); - try + try { - // Create the input stream here rather than in the - // ImageDecoder constructors so that exceptions cause - // imageComplete to be called with an appropriate error - // status. + // Create the input stream here rather than in the + // ImageDecoder constructors so that exceptions cause + // imageComplete to be called with an appropriate error + // status. if (input == null) { - try + try { if (url != null) input = url.openStream(); - else if (datainput != null) - input = new DataInputStreamWrapper(datainput); + else if (datainput != null) + input = new DataInputStreamWrapper(datainput); else { if (filename != null) @@ -137,8 +137,8 @@ public abstract class ImageDecoder implements ImageProducer input = new ByteArrayInputStream (data, offset, length); } produce (list, input); - } - finally + } + finally { input = null; } @@ -150,16 +150,16 @@ public abstract class ImageDecoder implements ImageProducer } catch (Exception e) { - for (int i = 0; i < list.size (); i++) - { - ImageConsumer ic2 = (ImageConsumer) list.elementAt (i); - ic2.imageComplete (ImageConsumer.IMAGEERROR); - } + for (int i = 0; i < list.size (); i++) + { + ImageConsumer ic2 = (ImageConsumer) list.elementAt (i); + ic2.imageComplete (ImageConsumer.IMAGEERROR); + } } } - public void requestTopDownLeftRightResend (ImageConsumer ic) - { + public void requestTopDownLeftRightResend (ImageConsumer ic) + { } public abstract void produce (Vector v, InputStream is) throws IOException; @@ -176,13 +176,13 @@ public abstract class ImageDecoder implements ImageProducer public int read() throws IOException { try - { - return datainput.readByte() & 0xFF; - } + { + return datainput.readByte() & 0xFF; + } catch (EOFException eofe) - { - return -1; - } + { + return -1; + } } } } diff --git a/libjava/classpath/gnu/java/awt/image/XBMDecoder.java b/libjava/classpath/gnu/java/awt/image/XBMDecoder.java index 0793d8e..35a3568 100644 --- a/libjava/classpath/gnu/java/awt/image/XBMDecoder.java +++ b/libjava/classpath/gnu/java/awt/image/XBMDecoder.java @@ -55,8 +55,8 @@ public class XBMDecoder extends ImageDecoder static final ColorModel cm = ColorModel.getRGBdefault (); static final int black = 0xff000000; static final int transparent = 0x00000000; - static final int masktable[] = { 0x01, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x40, 0x80 }; + static final int masktable[] = { 0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80 }; public XBMDecoder (String filename) { @@ -75,27 +75,27 @@ public class XBMDecoder extends ImageDecoder for (int i = 0; i < 2; i++) { - String line = reader.readLine (); - StringTokenizer st = new StringTokenizer (line); - - st.nextToken (); // #define - st.nextToken (); // name_[width|height] - if (i == 0) - width = Integer.parseInt (st.nextToken (), 10); - else - height = Integer.parseInt (st.nextToken (), 10); + String line = reader.readLine (); + StringTokenizer st = new StringTokenizer (line); + + st.nextToken (); // #define + st.nextToken (); // name_[width|height] + if (i == 0) + width = Integer.parseInt (st.nextToken (), 10); + else + height = Integer.parseInt (st.nextToken (), 10); } for (int i = 0; i < v.size (); i++) { - ImageConsumer ic = (ImageConsumer) v.elementAt (i); - - ic.setDimensions (width, height); - ic.setColorModel (cm); - ic.setHints (ImageConsumer.COMPLETESCANLINES - | ImageConsumer.SINGLEFRAME - | ImageConsumer.SINGLEPASS - | ImageConsumer.TOPDOWNLEFTRIGHT); + ImageConsumer ic = (ImageConsumer) v.elementAt (i); + + ic.setDimensions (width, height); + ic.setColorModel (cm); + ic.setHints (ImageConsumer.COMPLETESCANLINES + | ImageConsumer.SINGLEFRAME + | ImageConsumer.SINGLEPASS + | ImageConsumer.TOPDOWNLEFTRIGHT); } /* skip to the byte array */ @@ -104,22 +104,22 @@ public class XBMDecoder extends ImageDecoder /* loop through each scanline */ for (int line = 0; line < height; line++) { - int scanline[] = getScanline (reader, width); + int scanline[] = getScanline (reader, width); - for (int i = 0; i < v.size (); i++) - { - ImageConsumer ic = (ImageConsumer) v.elementAt (i); - ic.setPixels (0, 0 + line, width, 1, cm, scanline, 0, width); - } + for (int i = 0; i < v.size (); i++) + { + ImageConsumer ic = (ImageConsumer) v.elementAt (i); + ic.setPixels (0, 0 + line, width, 1, cm, scanline, 0, width); + } } /* tell each ImageConsumer that we're finished */ for (int i = 0; i < v.size (); i++) { - ImageConsumer ic = (ImageConsumer) v.elementAt (i); - ic.imageComplete (ImageConsumer.STATICIMAGEDONE); + ImageConsumer ic = (ImageConsumer) v.elementAt (i); + ic.imageComplete (ImageConsumer.STATICIMAGEDONE); } - } + } public static int[] getScanline (Reader in, int len) throws IOException { @@ -129,25 +129,25 @@ public class XBMDecoder extends ImageDecoder while (x < len) { - int ch = in.read (); - if (ch == '0') - { - in.read (); // 'x' - - byteStr[0] = (char) in.read (); - byteStr[1] = (char) in.read (); - - int byteVal = Integer.parseInt (new String (byteStr), 16); - - for (int i = 0; i < 8; i++, x++) - { - if (x == len) // condition occurs if bitmap is padded - return scanline; - - scanline[x] = ((byteVal & masktable[i]) != 0) ? - black : transparent; - } - } + int ch = in.read (); + if (ch == '0') + { + in.read (); // 'x' + + byteStr[0] = (char) in.read (); + byteStr[1] = (char) in.read (); + + int byteVal = Integer.parseInt (new String (byteStr), 16); + + for (int i = 0; i < 8; i++, x++) + { + if (x == len) // condition occurs if bitmap is padded + return scanline; + + scanline[x] = ((byteVal & masktable[i]) != 0) ? + black : transparent; + } + } } return scanline; diff --git a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java index 8504659..1334866 100644 --- a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java +++ b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java @@ -166,7 +166,7 @@ public abstract class AbstractGraphics2D */ protected static final WeakHashMap<Image, HashMap<Dimension,Image>> imageCache = new WeakHashMap<Image, HashMap<Dimension, Image>>(); - + /** * Wether we use anti aliasing for rendering text by default or not. */ @@ -234,7 +234,7 @@ public abstract class AbstractGraphics2D */ private Color foreground = Color.BLACK; private boolean isForegroundColorNull = true; - + /** * The current font. */ @@ -287,16 +287,16 @@ public abstract class AbstractGraphics2D private static final HashMap<Key, Object> STANDARD_HINTS; static { - + HashMap<Key, Object> hints = new HashMap<Key, Object>(); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT); - + STANDARD_HINTS = hints; } - + /** * Creates a new AbstractGraphics2D instance. */ @@ -398,8 +398,8 @@ public abstract class AbstractGraphics2D * * @param image the source buffered image * @param op the filter to apply to the buffered image before rendering - * @param x the x coordinate to render the image to - * @param y the y coordinate to render the image to + * @param x the x coordinate to render the image to + * @param y the y coordinate to render the image to */ public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y) { @@ -415,7 +415,7 @@ public abstract class AbstractGraphics2D * transform is used to convert the image into user space. The transform * of this AbstractGraphics2D object is used to transform from user space * to device space. - * + * * The rendering is performed using the scanline algorithm that performs the * rendering of other shapes and a custom Paint implementation, that supplies * the pixel values of the rendered image. @@ -438,7 +438,7 @@ public abstract class AbstractGraphics2D * of this AbstractGraphics2D object is used to transform from user space * to device space. Only the area specified by <code>areaOfInterest</code> * is finally rendered to the target. - * + * * The rendering is performed using the scanline algorithm that performs the * rendering of other shapes and a custom Paint implementation, that supplies * the pixel values of the rendered image. @@ -504,7 +504,7 @@ public abstract class AbstractGraphics2D (int) image.getWidth(), (int) image.getHeight()); drawRenderableImageImpl(image, xform, areaOfInterest); - + } /** @@ -648,7 +648,7 @@ public abstract class AbstractGraphics2D if (p != null) { paint = p; - + if (! (paint instanceof Color)) { isOptimized = false; @@ -665,11 +665,11 @@ public abstract class AbstractGraphics2D this.foreground = Color.BLACK; isForegroundColorNull = true; } - + // free resources if needed, then put the paint context to null if (this.paintContext != null) this.paintContext.dispose(); - + this.paintContext = null; } @@ -745,7 +745,7 @@ public abstract class AbstractGraphics2D * Translates the coordinate system by (x, y). * * @param x the translation X coordinate - * @param y the translation Y coordinate + * @param y the translation Y coordinate */ public void translate(int x, int y) { @@ -775,7 +775,7 @@ public abstract class AbstractGraphics2D * Translates the coordinate system by (tx, ty). * * @param tx the translation X coordinate - * @param ty the translation Y coordinate + * @param ty the translation Y coordinate */ public void translate(double tx, double ty) { @@ -992,7 +992,7 @@ public abstract class AbstractGraphics2D if (clip == null) setClip(s); - // This is so common, let's optimize this. + // This is so common, let's optimize this. else if (clip instanceof Rectangle && s instanceof Rectangle) { Rectangle clipRect = (Rectangle) clip; @@ -1076,8 +1076,8 @@ public abstract class AbstractGraphics2D else copy.clip = null; - copy.renderingHints = new RenderingHints(null); - copy.renderingHints.putAll(renderingHints); + copy.renderingHints = new RenderingHints(null); + copy.renderingHints.putAll(renderingHints); copy.transform = new AffineTransform(transform); // The remaining state is inmmutable and doesn't need to be copied. return copy; @@ -1097,7 +1097,7 @@ public abstract class AbstractGraphics2D { if (isForegroundColorNull) return null; - + return this.foreground; } @@ -1107,7 +1107,7 @@ public abstract class AbstractGraphics2D * @param color the foreground to set */ public void setColor(Color color) - { + { this.setPaint(color); } @@ -1298,7 +1298,7 @@ public abstract class AbstractGraphics2D /** * Fills a rectangle with the current background color. * - * This implementation temporarily sets the foreground color to the + * This implementation temporarily sets the foreground color to the * background and forwards the call to {@link #fillRect(int, int, int, int)}. * * @param x the upper left corner, X coordinate @@ -1590,7 +1590,7 @@ public abstract class AbstractGraphics2D int dy = Math.min(dy1, dy2); int dw = Math.abs(dx1 - dx2); int dh = Math.abs(dy1 - dy2); - + AffineTransform t = new AffineTransform(); t.translate(sx - dx, sy - dy); double scaleX = (double) sw / (double) dw; @@ -1693,7 +1693,7 @@ public abstract class AbstractGraphics2D * * @param x0 the starting point, X coordinate * @param y0 the starting point, Y coordinate - * @param x1 the end point, X coordinate + * @param x1 the end point, X coordinate * @param y1 the end point, Y coordinate */ protected void rawDrawLine(int x0, int y0, int x1, int y1) @@ -1806,7 +1806,7 @@ public abstract class AbstractGraphics2D public void renderScanline(int y, ScanlineCoverage c) { PaintContext pCtx = getPaintContext(); - + int x0 = c.getMinX(); int x1 = c.getMaxX(); Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1); @@ -1842,7 +1842,7 @@ public abstract class AbstractGraphics2D renderingHints); WritableRaster raster = getDestinationRaster(); WritableRaster targetChild = raster.createWritableTranslatedChild(-x0, -y); - + cCtx.compose(paintRaster, targetChild, targetChild); updateRaster(raster, x0, y, x1 - x0, 1); cCtx.dispose(); @@ -2042,7 +2042,7 @@ public abstract class AbstractGraphics2D getTransform(), getRenderingHints()); } - + return this.paintContext; } diff --git a/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java b/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java index 2e3690d..f1f082a 100644 --- a/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java +++ b/libjava/classpath/gnu/java/awt/java2d/AlphaCompositeContext.java @@ -82,7 +82,7 @@ public class AlphaCompositeContext /** * Creates a new AlphaCompositeContext. * - * @param aComp the AlphaComposite object + * @param aComp the AlphaComposite object * @param srcCM the source color model * @param dstCM the destination color model */ @@ -93,7 +93,7 @@ public class AlphaCompositeContext srcColorModel = srcCM; dstColorModel = dstCM; - + // Determine the blending factors according to the rule in the // AlphaComposite. For some rules the factors must be determined // dynamically because they depend on the actual pixel value. @@ -301,7 +301,7 @@ public class AlphaCompositeContext { for (int i = 0; i < dstComponentsLength - 1; i++) { - dstComponents[i] = dstComponents[i] / dstAlpha; + dstComponents[i] = dstComponents[i] / dstAlpha; } } diff --git a/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java b/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java index bf66be8..8197c94 100644 --- a/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java +++ b/libjava/classpath/gnu/java/awt/java2d/CubicSegment.java @@ -80,11 +80,11 @@ public class CubicSegment extends Segment public Object clone() { CubicSegment segment = null; - + try { segment = (CubicSegment) super.clone(); - + segment.P1 = (Point2D) P1.clone(); segment.P2 = (Point2D) P2.clone(); segment.cp1 = (Point2D) cp1.clone(); @@ -96,7 +96,7 @@ public class CubicSegment extends Segment ie.initCause(cnse); throw ie; } - + return segment; } @@ -161,7 +161,7 @@ public class CubicSegment extends Segment return new Segment[] { segmentTop, segmentBottom }; } - + public void reverse() { Point2D temp = P1; @@ -174,11 +174,11 @@ public class CubicSegment extends Segment public double[] cp1() { - return new double[]{cp1.getX(), cp1.getY()}; + return new double[]{cp1.getX(), cp1.getY()}; } public double[] cp2() { - return new double[]{cp2.getX(), cp2.getY()}; + return new double[]{cp2.getX(), cp2.getY()}; } } // class CubicSegment diff --git a/libjava/classpath/gnu/java/awt/java2d/LineSegment.java b/libjava/classpath/gnu/java/awt/java2d/LineSegment.java index 0395fd0..9040379 100644 --- a/libjava/classpath/gnu/java/awt/java2d/LineSegment.java +++ b/libjava/classpath/gnu/java/awt/java2d/LineSegment.java @@ -63,7 +63,7 @@ public class LineSegment extends Segment public Object clone() { LineSegment segment = null; - + try { segment = (LineSegment) super.clone(); @@ -76,7 +76,7 @@ public class LineSegment extends Segment ie.initCause(cnse); throw ie; } - + return segment; } @@ -108,11 +108,11 @@ public class LineSegment extends Segment public double[] cp1() { - return new double[]{P2.getX(), P2.getY()}; + return new double[]{P2.getX(), P2.getY()}; } public double[] cp2() { - return new double[]{P1.getX(), P1.getY()}; + return new double[]{P1.getX(), P1.getY()}; } } // class LineSegment diff --git a/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java b/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java index c83ad1f..356021b 100644 --- a/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java +++ b/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java @@ -124,7 +124,7 @@ final class PixelCoverage Bucket match = current; while (match != null && match.xPos != x) { - + } return match; diff --git a/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java b/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java index 97a5372..b8d0ff5 100644 --- a/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java +++ b/libjava/classpath/gnu/java/awt/java2d/QuadSegment.java @@ -89,7 +89,7 @@ public class QuadSegment extends Segment public Object clone() { QuadSegment segment = null; - + try { segment = (QuadSegment) super.clone(); @@ -104,7 +104,7 @@ public class QuadSegment extends Segment ie.initCause(cnse); throw ie; } - + return segment; } @@ -135,10 +135,10 @@ public class QuadSegment extends Segment return new Segment[]{s1, s2}; } - + private QuadSegment offsetSubdivided(QuadCurve2D curve, boolean plus) { - double[] n1 = normal(curve.getX1(), curve.getY1(), + double[] n1 = normal(curve.getX1(), curve.getY1(), curve.getCtrlX(), curve.getCtrlY()); double[] n2 = normal(curve.getCtrlX(), curve.getCtrlY(), curve.getX2(), curve.getY2()); @@ -152,7 +152,7 @@ public class QuadSegment extends Segment n2[0] = -n2[0]; n2[1] = -n2[1]; } - + // Handle special cases where the control point is equal to an end point // or end points are equal (ie, straight lines) if (curve.getP1().equals(curve.getCtrlPt())) @@ -179,7 +179,7 @@ public class QuadSegment extends Segment double ratio = radius / length; deltaX *= ratio; deltaY *= ratio; - + if (plus) cp.setLocation(cp.getX() + deltaX, cp.getY() + deltaY); else @@ -192,16 +192,16 @@ public class QuadSegment extends Segment } else { - cp = lineIntersection(curve.getX1() + n1[0], + cp = lineIntersection(curve.getX1() + n1[0], curve.getY1() + n1[1], curve.getCtrlX() + n1[0], curve.getCtrlY() + n1[1], curve.getCtrlX() + n2[0], curve.getCtrlY() + n2[1], - curve.getX2() + n2[0], + curve.getX2() + n2[0], curve.getY2() + n2[1], true); } - + s = new QuadSegment(curve.getX1() + n1[0], curve.getY1() + n1[1], cp.getX(), cp.getY(), curve.getX2() + n2[0], curve.getY2() + n2[1]); @@ -209,9 +209,9 @@ public class QuadSegment extends Segment return s; } - private Point2D lineIntersection(double X1, double Y1, - double X2, double Y2, - double X3, double Y3, + private Point2D lineIntersection(double X1, double Y1, + double X2, double Y2, + double X3, double Y3, double X4, double Y4, boolean infinite) { @@ -250,11 +250,11 @@ public class QuadSegment extends Segment public double[] cp1() { - return new double[]{cp.getX(), cp.getY()}; + return new double[]{cp.getX(), cp.getY()}; } public double[] cp2() { - return new double[]{cp.getX(), cp.getY()}; + return new double[]{cp.getX(), cp.getY()}; } } diff --git a/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java b/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java index 04eb55e..193ea4c 100644 --- a/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java +++ b/libjava/classpath/gnu/java/awt/java2d/RasterGraphics.java @@ -77,10 +77,10 @@ public class RasterGraphics { if (y >= getDeviceBounds().width) return; - + super.renderScanline(y, c); } - + /** * Returns the color model of this Graphics object. * diff --git a/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java b/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java index b00a15c..2c3481b 100644 --- a/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java +++ b/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java @@ -206,7 +206,7 @@ public final class ScanlineConverter // Ok, now we can perform the actual scanlining. int realY = Fixed.intValue(FIXED_DIGITS, y + resolution); boolean push = lastRealY != realY; - + doScanline(p, y, push, haveClip); // Remove obsolete active edges. @@ -299,7 +299,7 @@ public final class ScanlineConverter p.renderScanline(Fixed.intValue(FIXED_DIGITS, y), scanlineCoverage); scanlineCoverage.clear(); } - } + } /** diff --git a/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java b/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java index deb603b..9ffb63e 100644 --- a/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java +++ b/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java @@ -199,7 +199,7 @@ public final class ScanlineCoverage /** * Returns the X start position (left) on the scanline. This value * is considered to be in pixels and device space. - * + * * @return the X position on the scanline */ public int getXPos() @@ -445,7 +445,7 @@ public final class ScanlineCoverage * Returns the maximum coverage value for the scanline. * * @return the maximum coverage value for the scanline - */ + */ public int getMaxCoverage() { return maxCoverage; @@ -574,7 +574,7 @@ public final class ScanlineCoverage // Testpoint 6. cov = new Coverage(); } - + cov.xPos = x; cov.covDelta = 0; cov.pixelCoverage = 0; diff --git a/libjava/classpath/gnu/java/awt/java2d/Segment.java b/libjava/classpath/gnu/java/awt/java2d/Segment.java index df1f676..1d9a570 100644 --- a/libjava/classpath/gnu/java/awt/java2d/Segment.java +++ b/libjava/classpath/gnu/java/awt/java2d/Segment.java @@ -45,12 +45,12 @@ public abstract class Segment implements Cloneable // Start and end points of THIS segment public Point2D P1; public Point2D P2; - + // Segments can be linked together internally as a linked list public Segment first; public Segment next; public Segment last; - + // Half the stroke width protected double radius; @@ -116,7 +116,7 @@ public abstract class Segment implements Cloneable { dy = radius * ((dx > 0)?1:-1); dx = 0; - } + } else if( dx == 0 ) { dx = radius * ((dy > 0)?-1:1); @@ -148,7 +148,7 @@ public abstract class Segment implements Cloneable * for a line segment. */ public abstract double[] cp1(); - + /** * Returns the coordinates of the second control point, or the end point * for a line segment. diff --git a/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java b/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java index db0a2e6..2523d23 100644 --- a/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java +++ b/libjava/classpath/gnu/java/awt/java2d/TexturePaintContext.java @@ -148,7 +148,7 @@ public class TexturePaintContext * @param h the height * * @return the Raster that is used for painting - * + * */ public Raster getRaster(int x1, int y1, int w, int h) { @@ -175,9 +175,9 @@ public class TexturePaintContext int dy = (int) dest[1]; // The modulo operation gives us the replication effect. - dx = ((dx - minX) % width) + minX; + dx = ((dx - minX) % width) + minX; dy = ((dy - minY) % height) + minY; - + // Handle possible negative values (replicating above the top-left) if (dx < 0) dx += width; diff --git a/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java index bef42dc..fd4f498 100644 --- a/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/ClasspathDesktopPeer.java @@ -51,7 +51,7 @@ import java.util.prefs.Preferences; /** * Offers a common implementation for the Desktop peers, that enables * access to default system application within java processes. - * + * * @author Mario Torre <neugens@limasoftware.net> */ public class ClasspathDesktopPeer @@ -59,39 +59,39 @@ public class ClasspathDesktopPeer { /** This is the fallback browser, if no desktop was detected. */ protected static final String _DEFAULT_BROWSER = "firefox"; - + /** gnu.java.awt.peer.Desktop.html.command */ protected static final String _BROWSE = "html"; - + /** gnu.java.awt.peer.Desktop.mail.command */ protected static final String _MAIL = "mail"; - + /** gnu.java.awt.peer.Desktop.edit.command */ protected static final String _EDIT = "edit"; - + /** gnu.java.awt.peer.Desktop.print.command */ protected static final String _PRINT = "print"; - + /** gnu.java.awt.peer.Desktop.open.command */ protected static final String _OPEN = "open"; - + /** */ protected static final KDEDesktopPeer kde = new KDEDesktopPeer(); - + /** */ protected static final GnomeDesktopPeer gnome = new GnomeDesktopPeer(); - + /** */ protected static final ClasspathDesktopPeer classpath = - new ClasspathDesktopPeer(); - + new ClasspathDesktopPeer(); + /** * Preference subsystem. Packagers and users can override the default * behaviour of this class via preferences and system properties. */ protected Preferences prefs = Preferences.userNodeForPackage(ClasspathDesktopPeer.class).node("Desktop"); - + /** * @param target */ @@ -103,131 +103,131 @@ public class ClasspathDesktopPeer public boolean isSupported(Action action) { String check = null; - + switch(action) { case BROWSE: check = _BROWSE; break; - + case MAIL: check = _MAIL; break; - + case EDIT: check = _EDIT; break; - + case PRINT: check = _PRINT; break; - + case OPEN: default: check = _OPEN; break; } - + return this.supportCommand(check); } public void browse(URI url) throws IOException { checkPermissions(); - + String browser = getCommand(_BROWSE); - + if (browser == null) throw new UnsupportedOperationException(); - + browser = browser + " " + url.toString(); - + Runtime.getRuntime().exec(browser); } public void edit(File file) throws IOException { checkPermissions(file, false); - + String edit = getCommand(_EDIT); - + if (edit == null) throw new UnsupportedOperationException(); - - edit = edit + " " + file.getAbsolutePath(); + + edit = edit + " " + file.getAbsolutePath(); Runtime.getRuntime().exec(edit); } public void mail(URI mailtoURL) throws IOException { checkPermissions(); - + String scheme = mailtoURL.getScheme(); if (scheme == null || !scheme.equalsIgnoreCase("mailto")) throw new IllegalArgumentException("URI Scheme not of type mailto"); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + mail = mail + " " + mailtoURL.toString(); - + Runtime.getRuntime().exec(mail); } public void mail() throws IOException { checkPermissions(); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + Runtime.getRuntime().exec(mail); } - + public void open(File file) throws IOException { checkPermissions(file, true); - + String open = getCommand(_OPEN); - + if (open == null) throw new UnsupportedOperationException(); - - open = open + " " + file.getAbsolutePath(); + + open = open + " " + file.getAbsolutePath(); Runtime.getRuntime().exec(open); } public void print(File file) throws IOException { checkPrintPermissions(file); - + String print = getCommand(_PRINT); - + if (print == null) throw new UnsupportedOperationException(); - - print = print + " " + file.getAbsolutePath(); + + print = print + " " + file.getAbsolutePath(); Runtime.getRuntime().exec(print); } - + protected String getCommand(String action) { // check if a system property exist String command = System.getProperty("gnu.java.awt.peer.Desktop." + action + ".command"); - + // otherwise, get it from preferences, if any if (command == null) { command = prefs.node(action).get("command", null); } - + return command; } - + /** * Note: Checks for AWTPermission("showWindowWithoutWarningBanner") only. */ @@ -238,22 +238,22 @@ public class ClasspathDesktopPeer sm.checkPermission(new AWTPermission("showWindowWithoutWarningBanner")); } } - + /** - * Calls checkPermissions() and checks for SecurityManager.checkRead() - * and, if readOnly is false, for SecurityManager.checkWrite() + * Calls checkPermissions() and checks for SecurityManager.checkRead() + * and, if readOnly is false, for SecurityManager.checkWrite() */ protected void checkPermissions(File file, boolean readOnly) { checkPermissions(); - + SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkRead(file.toString()); if (!readOnly) sm.checkWrite(file.toString()); } } - + /** * Calls checkPermissions(file, true) and checks for * SecurityManager.checkPrintJobAccess() @@ -261,13 +261,13 @@ public class ClasspathDesktopPeer protected void checkPrintPermissions(File file) { checkPermissions(file, true); - + SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPrintJobAccess(); - } + } } - + /** * @param check * @return @@ -276,7 +276,7 @@ public class ClasspathDesktopPeer { return ((this.getCommand(check) != null) ? true : false); } - + /** * @return */ @@ -285,7 +285,7 @@ public class ClasspathDesktopPeer // check if we are under Gnome or KDE or anything else String desktopSession = System.getenv("GNOME_DESKTOP_SESSION_ID"); if (desktopSession == null) - { + { desktopSession = System.getenv("KDE_FULL_SESSION"); if (desktopSession != null) return kde; @@ -294,7 +294,7 @@ public class ClasspathDesktopPeer { return gnome; } - + // revert to this class for default values return classpath; } diff --git a/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java b/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java index e43e5f2..96677a4 100644 --- a/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/ClasspathFontPeer.java @@ -68,7 +68,7 @@ import java.util.Map; * object in the default implementation. If you wish to share peers between * fonts, you will need to subclass both ClasspathFontPeer and * {@link ClasspathToolKit}.</p> - * + * * <p><b>Thread Safety:</b> Methods of this interface may be called * from arbitrary threads at any time. Implementations of the * <code>ClasspathFontPeer</code> interface are required to perform @@ -85,11 +85,11 @@ public abstract class ClasspathFontPeer { /*************************************************************************/ - + /* * Instance Variables */ - + /** * The 3 names of this font. all fonts have 3 names, some of which * may be equal: @@ -98,19 +98,19 @@ public abstract class ClasspathFontPeer * family -- a designer or brand name (Helvetica) * face -- specific instance of a design (Helvetica Regular) * - * @see isLogicalFontName + * @see isLogicalFontName */ - + protected String logicalName; protected String familyName; protected String faceName; - + /** * The font style, which is a combination (by OR-ing) of the font style * constants PLAIN, BOLD and ITALIC, in this class. */ protected int style; - + /** * The font point size. A point is 1/72 of an inch. */ @@ -143,13 +143,13 @@ public abstract class ClasspathFontPeer return (ClasspathToolkit)(Toolkit.getDefaultToolkit ()); } - /* + /* * Confusingly, a Logical Font is a concept unrelated to - * a Font's Logical Name. + * a Font's Logical Name. * * A Logical Font is one of 6 built-in, abstract font types * which must be supported by any java environment: SansSerif, - * Serif, Monospaced, Dialog, and DialogInput. + * Serif, Monospaced, Dialog, and DialogInput. * * A Font's Logical Name is the name the font was constructed * from. This might be the name of a Logical Font, or it might @@ -209,32 +209,32 @@ public abstract class ClasspathFontPeer if (fam != null) attrs.put (TextAttribute.FAMILY, fam); } - + public static void copySizeToAttrs (float size, Map attrs) { attrs.put (TextAttribute.SIZE, new Float (size)); } - + protected static void copyTransformToAttrs (AffineTransform trans, Map attrs) { if (trans != null) { - TransformAttribute ta; + TransformAttribute ta; synchronized(transCache) { - ta = transCache.get(trans); - if (ta == null) - { - ta = new TransformAttribute(trans); - transCache.put(trans, ta); - } - } - attrs.put(TextAttribute.TRANSFORM, ta); + ta = transCache.get(trans); + if (ta == null) + { + ta = new TransformAttribute(trans); + transCache.put(trans, ta); + } + } + attrs.put(TextAttribute.TRANSFORM, ta); } } - protected void setStandardAttributes (String name, String family, int style, + protected void setStandardAttributes (String name, String family, int style, float size, AffineTransform trans) { this.logicalName = name; @@ -248,7 +248,7 @@ public abstract class ClasspathFontPeer this.familyName = family; else this.familyName = faceNameToFamilyName (faceName); - + this.style = style; this.size = size; this.transform = trans; @@ -296,16 +296,16 @@ public abstract class ClasspathFontPeer if (attribs.containsKey (TextAttribute.TRANSFORM)) { - TransformAttribute ta = (TransformAttribute) + TransformAttribute ta = (TransformAttribute) attribs.get(TextAttribute.TRANSFORM); - trans = ta.getTransform (); + trans = ta.getTransform (); } setStandardAttributes (name, family, style, size, trans); } protected void getStandardAttributes (Map attrs) - { + { copyFamilyToAttrs (this.familyName, attrs); copySizeToAttrs (this.size, attrs); copyStyleToAttrs (this.style, attrs); @@ -322,11 +322,11 @@ public abstract class ClasspathFontPeer public ClasspathFontPeer (String name, int style, int size) { - setStandardAttributes (name, (String)null, style, + setStandardAttributes (name, (String)null, style, (float)size, (AffineTransform)null); } - /** + /** * Implementation of {@link Font#getName} * * @param font the font this peer is being called from. This may be @@ -334,12 +334,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getName (Font font) - { - return logicalName; + public String getName (Font font) + { + return logicalName; } - /** + /** * Implementation of {@link Font#getFamily()} * * @param font the font this peer is being called from. This may be @@ -347,12 +347,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFamily (Font font) - { - return familyName; + public String getFamily (Font font) + { + return familyName; } - /** + /** * Implementation of {@link Font#getFamily(Locale)} * * @param font the font this peer is being called from. This may be @@ -360,12 +360,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFamily (Font font, Locale lc) - { - return familyName; + public String getFamily (Font font, Locale lc) + { + return familyName; } - /** + /** * Implementation of {@link Font#getFontName()} * * @param font the font this peer is being called from. This may be @@ -373,12 +373,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFontName (Font font) - { - return faceName; + public String getFontName (Font font) + { + return faceName; } - /** + /** * Implementation of {@link Font#getFontName(Locale)} * * @param font the font this peer is being called from. This may be @@ -386,12 +386,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public String getFontName (Font font, Locale lc) - { - return faceName; + public String getFontName (Font font, Locale lc) + { + return faceName; } - /** + /** * Implementation of {@link Font#getSize} * * @param font the font this peer is being called from. This may be @@ -399,38 +399,38 @@ public abstract class ClasspathFontPeer * be ignored. */ - public float getSize (Font font) - { - return size; + public float getSize (Font font) + { + return size; } - /** + /** * Implementation of {@link Font#isPlain} * * @param font the font this peer is being called from. This may be * useful if you are sharing peers between Font objects. Otherwise it may * be ignored. */ - - public boolean isPlain (Font font) - { - return style == Font.PLAIN; + + public boolean isPlain (Font font) + { + return style == Font.PLAIN; } - /** + /** * Implementation of {@link Font#isBold} * * @param font the font this peer is being called from. This may be * useful if you are sharing peers between Font objects. Otherwise it may * be ignored. */ - - public boolean isBold (Font font) - { - return ((style & Font.BOLD) == Font.BOLD); + + public boolean isBold (Font font) + { + return ((style & Font.BOLD) == Font.BOLD); } - /** + /** * Implementation of {@link Font#isItalic} * * @param font the font this peer is being called from. This may be @@ -438,12 +438,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public boolean isItalic (Font font) - { - return ((style & Font.ITALIC) == Font.ITALIC); + public boolean isItalic (Font font) + { + return ((style & Font.ITALIC) == Font.ITALIC); } - /** + /** * Implementation of {@link Font#deriveFont(int, float)} * * @param font the font this peer is being called from. This may be @@ -460,7 +460,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(float)} * * @param font the font this peer is being called from. This may be @@ -476,7 +476,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(int)} * * @param font the font this peer is being called from. This may be @@ -492,7 +492,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(int, AffineTransform)} * * @param font the font this peer is being called from. This may be @@ -509,7 +509,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(AffineTransform)} * * @param font the font this peer is being called from. This may be @@ -525,7 +525,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#deriveFont(Map)} * * @param font the font this peer is being called from. This may be @@ -538,7 +538,7 @@ public abstract class ClasspathFontPeer return tk().getFont (logicalName, attrs); } - /** + /** * Implementation of {@link Font#getAttributes()} * * @param font the font this peer is being called from. This may be @@ -553,7 +553,7 @@ public abstract class ClasspathFontPeer return h; } - /** + /** * Implementation of {@link Font#getAvailableAttributes()} * * @param font the font this peer is being called from. This may be @@ -563,7 +563,7 @@ public abstract class ClasspathFontPeer public AttributedCharacterIterator.Attribute[] getAvailableAttributes(Font font) { - AttributedCharacterIterator.Attribute a[] = + AttributedCharacterIterator.Attribute a[] = new AttributedCharacterIterator.Attribute[5]; a[0] = TextAttribute.FAMILY; a[1] = TextAttribute.SIZE; @@ -573,7 +573,7 @@ public abstract class ClasspathFontPeer return a; } - /** + /** * Implementation of {@link Font#getTransform()} * * @param font the font this peer is being called from. This may be @@ -588,7 +588,7 @@ public abstract class ClasspathFontPeer return transform; } - /** + /** * Implementation of {@link Font#isTransformed()} * * @param font the font this peer is being called from. This may be @@ -601,7 +601,7 @@ public abstract class ClasspathFontPeer return ! transform.isIdentity (); } - /** + /** * Implementation of {@link Font#getItalicAngle()} * * @param font the font this peer is being called from. This may be @@ -618,7 +618,7 @@ public abstract class ClasspathFontPeer } - /** + /** * Implementation of {@link Font#getStyle()} * * @param font the font this peer is being called from. This may be @@ -626,9 +626,9 @@ public abstract class ClasspathFontPeer * be ignored. */ - public int getStyle (Font font) - { - return style; + public int getStyle (Font font) + { + return style; } @@ -636,7 +636,7 @@ public abstract class ClasspathFontPeer /* Remaining methods are abstract */ - /** + /** * Implementation of {@link Font#canDisplay(char)} * * @param font the font this peer is being called from. This may be @@ -646,7 +646,7 @@ public abstract class ClasspathFontPeer public abstract boolean canDisplay (Font font, int c); - /** + /** * Implementation of {@link Font#canDisplay(String)}, * {@link Font#canDisplay(char [], int, int)}, and * {@link Font#canDisplay(CharacterIterator, int, int)}. @@ -678,9 +678,9 @@ public abstract class ClasspathFontPeer */ public abstract String getSubFamilyName (Font font, Locale locale); - - /** + + /** * Implementation of {@link Font#getPSName()} * * @param font the font this peer is being called from. This may be @@ -691,7 +691,7 @@ public abstract class ClasspathFontPeer public abstract String getPostScriptName (Font font); - /** + /** * Implementation of {@link Font#getNumGlyphs()} * * @param font the font this peer is being called from. This may be @@ -702,7 +702,7 @@ public abstract class ClasspathFontPeer public abstract int getNumGlyphs (Font font); - /** + /** * Implementation of {@link Font#getMissingGlyphCode()} * * @param font the font this peer is being called from. This may be @@ -713,7 +713,7 @@ public abstract class ClasspathFontPeer public abstract int getMissingGlyphCode (Font font); - /** + /** * Implementation of {@link Font#getBaselineFor(char)} * * @param font the font this peer is being called from. This may be @@ -767,7 +767,7 @@ public abstract class ClasspathFontPeer public abstract String getGlyphName (Font font, int glyphIndex); - /** + /** * Implementation of {@link * Font#createGlyphVector(FontRenderContext, String)}, {@link * Font#createGlyphVector(FontRenderContext, char[])}, and {@link @@ -782,9 +782,9 @@ public abstract class ClasspathFontPeer public abstract GlyphVector createGlyphVector (Font font, FontRenderContext frc, CharacterIterator ci); - - /** + + /** * Implementation of {@link Font#createGlyphVector(FontRenderContext, * int[])}. * @@ -794,12 +794,12 @@ public abstract class ClasspathFontPeer * not with font peers. */ - public abstract GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, + public abstract GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, int[] glyphCodes); - /** + /** * Implementation of {@link Font#layoutGlyphVector(FontRenderContext, * char[], int, int, int)}. * @@ -809,13 +809,13 @@ public abstract class ClasspathFontPeer * not with font peers. */ - public abstract GlyphVector layoutGlyphVector (Font font, - FontRenderContext frc, - char[] chars, int start, + public abstract GlyphVector layoutGlyphVector (Font font, + FontRenderContext frc, + char[] chars, int start, int limit, int flags); - /** + /** * Implementation of {@link Font#getFontMetrics()} * * @param font the font this peer is being called from. This may be @@ -826,7 +826,7 @@ public abstract class ClasspathFontPeer public abstract FontMetrics getFontMetrics (Font font); - /** + /** * Implementation of {@link Font#hasUniformLineMetrics()} * * @param font the font this peer is being called from. This may be @@ -837,7 +837,7 @@ public abstract class ClasspathFontPeer public abstract boolean hasUniformLineMetrics (Font font); - /** + /** * Implementation of {@link Font#getLineMetrics(CharacterIterator, int, * int, FontRenderContext)} * @@ -846,12 +846,12 @@ public abstract class ClasspathFontPeer * be ignored. */ - public abstract LineMetrics getLineMetrics (Font font, - CharacterIterator ci, - int begin, int limit, + public abstract LineMetrics getLineMetrics (Font font, + CharacterIterator ci, + int begin, int limit, FontRenderContext rc); - /** + /** * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)} * * @param font the font this peer is being called from. This may be @@ -859,7 +859,7 @@ public abstract class ClasspathFontPeer * be ignored. */ - public abstract Rectangle2D getMaxCharBounds (Font font, + public abstract Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc); } diff --git a/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java b/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java index bf40bf3..fe128c2 100644 --- a/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/GLightweightPeer.java @@ -71,7 +71,7 @@ import java.awt.peer.LightweightPeer; * Lightweight components are painted directly onto their parent * containers through an Image object provided by the toolkit. */ -public class GLightweightPeer +public class GLightweightPeer implements LightweightPeer, ContainerPeer { public GLightweightPeer() @@ -80,39 +80,39 @@ public class GLightweightPeer } // -------- java.awt.peer.ContainerPeer implementation: - + public Insets insets() { // Nothing to do here for lightweights. return null; } - + public Insets getInsets() { // Nothing to do here for lightweights. return null; } - + public void beginValidate() { // Nothing to do here for lightweights. } - + public void endValidate() { // Nothing to do here for lightweights. } - + public void beginLayout() { // Nothing to do here for lightweights. } - + public void endLayout() { // Nothing to do here for lightweights. } - + public boolean isPaintPending() { // Nothing to do here for lightweights. @@ -235,7 +235,7 @@ public class GLightweightPeer // Nothing to do here for lightweights. } - public boolean isFocusable() + public boolean isFocusable() { // Nothing to do here for lightweights. return false; @@ -263,7 +263,7 @@ public class GLightweightPeer } public boolean prepareImage(Image img, int width, int height, - ImageObserver o) + ImageObserver o) { // Nothing to do here for lightweights. return false; @@ -373,10 +373,10 @@ public class GLightweightPeer // Nothing to do here for lightweights. } - public VolatileImage createVolatileImage(int width, int height) - { + public VolatileImage createVolatileImage(int width, int height) + { // Nothing to do here for lightweights. - return null; + return null; } public boolean handlesWheelScrolling() @@ -385,7 +385,7 @@ public class GLightweightPeer return false; } - public void createBuffers(int x, BufferCapabilities capabilities) + public void createBuffers(int x, BufferCapabilities capabilities) throws AWTException { // Nothing to do here for lightweights. diff --git a/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java index cc41f74..2347371 100644 --- a/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/GnomeDesktopPeer.java @@ -60,13 +60,13 @@ public class GnomeDesktopPeer { // check if a command already exists String command = super.getCommand(action); - + if (command == null) { try { if (action == _BROWSE) - { + { command = execQuery(BROWSER_QUERY_GNOME); } else if (action == _PRINT) @@ -83,46 +83,46 @@ public class GnomeDesktopPeer command = null; } } - + return command; } - + public void browse(URI url) throws IOException { checkPermissions(); - + String browser = getCommand(_BROWSE); - + if (browser == null) throw new UnsupportedOperationException(); - + browser = browser + " " + url.toString(); - + Runtime.getRuntime().exec(browser); } protected boolean supportCommand(String check) { if (check == _PRINT) - { + { return super.supportCommand(check); } - + return true; } public void mail() throws IOException { checkPermissions(); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + Runtime.getRuntime().exec(mail + " mailto:"); } - + protected String execQuery(String command) throws IOException { InputStream in = null; @@ -149,7 +149,7 @@ public class GnomeDesktopPeer // remove %s from the string, leave only the command line int index = output.indexOf("%s"); output.delete(index, index + 1); - + return output.toString().trim(); } } diff --git a/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java index 8bc3e65..44a5084 100644 --- a/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java @@ -56,16 +56,16 @@ public class KDEDesktopPeer "gconftool-2 -g /desktop/gnome/url-handlers/http/command"; protected String getCommand(String action) - { + { // check if a command already exists String command = super.getCommand(action); - + if (command == null) { try { if (action == _MAIL) - { + { command = "kfmclient exec"; } else if (action == _PRINT) @@ -82,27 +82,27 @@ public class KDEDesktopPeer command = null; } } - + return command; } - + protected boolean supportCommand(String check) { return true; } - + public void mail() throws IOException { checkPermissions(); - + String mail = getCommand(_MAIL); - + if (mail == null) throw new UnsupportedOperationException(); - + Runtime.getRuntime().exec(mail + " 'mailto: '"); } - + protected String execQuery(String command) throws IOException { InputStream in = null; @@ -129,7 +129,7 @@ public class KDEDesktopPeer // remove %s from the string, leave only the command line int index = output.indexOf("%s"); output.delete(index, index + 1); - + return output.toString().trim(); } } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java b/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java index dad537a..786dcf2 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/AsyncImage.java @@ -98,7 +98,7 @@ public class AsyncImage ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE); } } - + } /** diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java index 31c5e64..f9609bf 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java @@ -64,7 +64,7 @@ import java.util.WeakHashMap; /** * Implementation of Graphics2D on a Cairo surface. * - * Simutanously maintains a CairoSurface and updates the + * Simutanously maintains a CairoSurface and updates the * BufferedImage from that after each drawing operation. */ public class BufferedImageGraphics extends CairoGraphics2D @@ -73,7 +73,7 @@ public class BufferedImageGraphics extends CairoGraphics2D * the buffered Image. */ private BufferedImage image, buffer; - + /** * Image size. */ @@ -104,7 +104,7 @@ public class BufferedImageGraphics extends CairoGraphics2D this.image = bi; imageWidth = bi.getWidth(); imageHeight = bi.getHeight(); - + if (!(image.getSampleModel() instanceof SinglePixelPackedSampleModel)) hasFastCM = false; else if(bi.getColorModel().equals(CairoSurface.cairoCM_opaque)) @@ -151,11 +151,11 @@ public class BufferedImageGraphics extends CairoGraphics2D { int[] pixels2 = new int[imageWidth * imageHeight]; int scanline = sm.getScanlineStride(); - + for (int i = 0; i < imageHeight; i++) System.arraycopy(pixels, (i - minY) * scanline - minX, pixels2, i * imageWidth, imageWidth); - + pixels = pixels2; } @@ -172,11 +172,11 @@ public class BufferedImageGraphics extends CairoGraphics2D System.arraycopy(pixels, 0, surface.getData(), 0, pixels.length); } - + setup( cairo_t ); setClip(0, 0, imageWidth, imageHeight); } - + BufferedImageGraphics(BufferedImageGraphics copyFrom) { image = copyFrom.image; @@ -184,7 +184,7 @@ public class BufferedImageGraphics extends CairoGraphics2D cairo_t = surface.newCairoContext(); imageWidth = copyFrom.imageWidth; imageHeight = copyFrom.imageHeight; - + hasFastCM = copyFrom.hasFastCM; hasAlpha = copyFrom.hasAlpha; @@ -195,7 +195,7 @@ public class BufferedImageGraphics extends CairoGraphics2D * Update a rectangle of the bufferedImage. This can be improved upon a lot. */ private void updateBufferedImage(int x, int y, int width, int height) - { + { Rectangle bounds = new Rectangle(x, y, width, height); bounds = getTransformedBounds(bounds, transform).getBounds(); x = bounds.x; @@ -207,7 +207,7 @@ public class BufferedImageGraphics extends CairoGraphics2D if( x > imageWidth || y > imageHeight ) return; - + // Deal with negative width/height. if (height < 0) { @@ -219,44 +219,44 @@ public class BufferedImageGraphics extends CairoGraphics2D x += width; width = -width; } - + // Clip edges. if( x < 0 ) x = 0; if( y < 0 ) y = 0; - - if( x + width > imageWidth ) + + if( x + width > imageWidth ) width = imageWidth - x; - if( y + height > imageHeight ) + if( y + height > imageHeight ) height = imageHeight - y; - + if(!hasFastCM) { - image.setRGB(x, y, width, height, pixels, + image.setRGB(x, y, width, height, pixels, x + y * imageWidth, imageWidth); // The setRGB method assumes (or should assume) that pixels are NOT // alpha-premultiplied, but Cairo stores data with premultiplication // (thus the pixels returned in getPixels are premultiplied). // This is ignored for consistency, however, since in // CairoGrahpics2D.drawImage we also use non-premultiplied data - + } else { int[] db = ((DataBufferInt)image.getRaster().getDataBuffer()). getData(); - + // This should not fail, as we check the image sample model when we // set the hasFastCM flag SinglePixelPackedSampleModel sm = (SinglePixelPackedSampleModel)image.getSampleModel() ; - + int minX = image.getRaster().getSampleModelTranslateX(); int minY = image.getRaster().getSampleModelTranslateY(); - - if (sm.getScanlineStride() == imageWidth && minX == 0) + + if (sm.getScanlineStride() == imageWidth && minX == 0) { - System.arraycopy(pixels, y * imageWidth, + System.arraycopy(pixels, y * imageWidth, db, (y - minY) * imageWidth, height * imageWidth); } @@ -266,19 +266,19 @@ public class BufferedImageGraphics extends CairoGraphics2D for (int i = y; i < (height + y); i++) System.arraycopy(pixels, i * imageWidth + x, db, (i - minY) * scanline + x - minX, width); - + } } } /** * Abstract methods. - */ + */ public Graphics create() { return new BufferedImageGraphics(this); } - + public GraphicsConfiguration getDeviceConfiguration() { return null; @@ -288,7 +288,7 @@ public class BufferedImageGraphics extends CairoGraphics2D { return new Rectangle2D.Double(0.0, 0.0, imageWidth, imageHeight); } - + public void copyAreaImpl(int x, int y, int width, int height, int dx, int dy) { surface.copyAreaNative(x, y, width, height, dx, dy, surface.width); @@ -296,7 +296,7 @@ public class BufferedImageGraphics extends CairoGraphics2D } /** - * Overloaded methods that do actual drawing need to enter the gdk threads + * Overloaded methods that do actual drawing need to enter the gdk threads * and also do certain things before and after. */ public void draw(Shape s) @@ -308,7 +308,7 @@ public class BufferedImageGraphics extends CairoGraphics2D r.width++; r.height++; } - + // Do the drawing if (comp == null || comp instanceof AlphaComposite) { @@ -318,13 +318,13 @@ public class BufferedImageGraphics extends CairoGraphics2D else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setStroke(this.getStroke()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.draw(s); - + drawComposite(r.getBounds2D(), null); } } @@ -340,13 +340,13 @@ public class BufferedImageGraphics extends CairoGraphics2D else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } } @@ -366,14 +366,14 @@ public class BufferedImageGraphics extends CairoGraphics2D g2d.setRenderingHints(this.getRenderingHints()); g2d.setTransform(transform); g2d.drawRenderedImage(image, xform); - + drawComposite(buffer.getRaster().getBounds(), null); } } protected boolean drawImage(Image img, AffineTransform xform, - Color bgcolor, ImageObserver obs) + Color bgcolor, ImageObserver obs) { if (comp == null || comp instanceof AlphaComposite) { @@ -392,16 +392,16 @@ public class BufferedImageGraphics extends CairoGraphics2D img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find translated bounds Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(), bImg.getWidth(), bImg.getHeight()); if (xform != null) bounds = getTransformedBounds(bounds, xform); - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -413,20 +413,20 @@ public class BufferedImageGraphics extends CairoGraphics2D public void drawGlyphVector(GlyphVector gv, float x, float y) { - // Find absolute bounds, in user-space, of this glyph vector + // Find absolute bounds, in user-space, of this glyph vector Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); - + // Perform draw operation if (comp == null || comp instanceof AlphaComposite) { super.drawGlyphVector(gv, x, y); - + // this returns an integer-based Rectangle (rather than a // Rectangle2D), which takes care of any necessary rounding for us. bounds = bounds.getBounds(); - + updateBufferedImage((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); } @@ -439,17 +439,17 @@ public class BufferedImageGraphics extends CairoGraphics2D g2d.setStroke(this.getStroke()); g2d.setTransform(transform); g2d.drawGlyphVector(gv, x, y); - + drawComposite(bounds, null); } } - + /** * Perform composite drawing from the buffer onto the main image. - * + * * The image to be composited should already be drawn into the buffer, in the * proper place, after all necessary transforms have been applied. - * + * * @param bounds The bounds to draw, in user-space. * @param observer The image observer, if any (may be null). * @return True on success, false on failure. @@ -465,7 +465,7 @@ public class BufferedImageGraphics extends CairoGraphics2D devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(), buffer.getWidth(), buffer.getHeight()); Rectangle2D.intersect(bounds, devClip, bounds); - + // Round bounds as needed, but be careful in our rounding // (otherwise it may leave unpainted stripes) double x = bounds.getX(); @@ -475,7 +475,7 @@ public class BufferedImageGraphics extends CairoGraphics2D x = Math.round(x); y = Math.round(y); bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y)); - + // Find subimage of internal buffer for updating BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) @@ -492,12 +492,12 @@ public class BufferedImageGraphics extends CairoGraphics2D // Perform actual composite operation compCtx.compose(buffer2.getRaster(), current.getRaster(), current.getRaster()); - + // Set cairo's composite to direct SRC, since we've already done our own - // compositing + // compositing Composite oldcomp = comp; setComposite(AlphaComposite.Src); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -509,7 +509,7 @@ public class BufferedImageGraphics extends CairoGraphics2D updateColor(); return rv; } - + private void createBuffer() { if (buffer == null) @@ -520,20 +520,19 @@ public class BufferedImageGraphics extends CairoGraphics2D else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } } - + protected ColorModel getNativeCM() { return image.getColorModel(); } - + protected ColorModel getBufferCM() { return ColorModel.getRGBdefault(); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java index 8f8d7ea..05d35c5 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java @@ -101,7 +101,7 @@ import java.util.HashMap; import java.util.Map; /** - * This is an abstract implementation of Graphics2D on Cairo. + * This is an abstract implementation of Graphics2D on Cairo. * * It should be subclassed for different Cairo contexts. * @@ -112,7 +112,7 @@ import java.util.Map; * GraphicsConfiguration getDeviceConfiguration() * copyArea(int x, int y, int width, int height, int dx, int dy) * - * Also, dispose() must be overloaded to free any native datastructures + * Also, dispose() must be overloaded to free any native datastructures * used by subclass and in addition call super.dispose() to free the * native cairographics2d structure and cairo_t. * @@ -120,7 +120,7 @@ import java.util.Map; */ public abstract class CairoGraphics2D extends Graphics2D { - static + static { if (true) // GCJ LOCAL { @@ -177,7 +177,7 @@ public abstract class CairoGraphics2D extends Graphics2D * Rendering hint map. */ private RenderingHints hints; - + /** * Status of the anti-alias flag in cairo. */ @@ -187,7 +187,7 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Some operations (drawing rather than filling) require that their * coords be shifted to land on 0.5-pixel boundaries, in order to land on - * "middle of pixel" coordinates and light up complete pixels. + * "middle of pixel" coordinates and light up complete pixels. */ protected boolean shiftDrawCalls = false; @@ -203,8 +203,8 @@ public abstract class CairoGraphics2D extends Graphics2D private static BasicStroke draw3DRectStroke = new BasicStroke(); static ColorModel rgb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF); - static ColorModel argb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, - 0xFF000000); + static ColorModel argb32 = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, + 0xFF000000); /** * Native constants for interpolation methods. @@ -217,7 +217,7 @@ public abstract class CairoGraphics2D extends Graphics2D ALPHA_INTERPOLATION_QUALITY = 3, ALPHA_INTERPOLATION_DEFAULT = 4; // TODO: Does ALPHA_INTERPOLATION really correspond to CAIRO_FILTER_FAST/BEST/GOOD? - + /** * Constructor does nothing. */ @@ -230,7 +230,7 @@ public abstract class CairoGraphics2D extends Graphics2D * @param cairo_t_pointer a native pointer to a cairo_t of the context. */ public void setup(long cairo_t_pointer) - { + { nativePointer = init(cairo_t_pointer); setRenderingHints(new RenderingHints(getDefaultHints())); setFont(new Font("SansSerif", Font.PLAIN, 12)); @@ -251,7 +251,7 @@ public abstract class CairoGraphics2D extends Graphics2D paint = g.paint; stroke = g.stroke; setRenderingHints(g.hints); - + Color foreground; if (g.fg.getAlpha() != -1) @@ -286,7 +286,7 @@ public abstract class CairoGraphics2D extends Graphics2D setTransformImpl(transform); setClip(clip); setComposite(comp); - + antialias = !g.antialias; setAntialias(g.antialias); } @@ -300,9 +300,9 @@ public abstract class CairoGraphics2D extends Graphics2D } /** - * Disposes the native cairographics2d structure, including the - * cairo_t and any gradient stuff, if allocated. - * Subclasses should of course overload and call this if + * Disposes the native cairographics2d structure, including the + * cairo_t and any gradient stuff, if allocated. + * Subclasses should of course overload and call this if * they have additional native structures. */ public void dispose() @@ -332,7 +332,7 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Find the bounds of this graphics context, in device space. - * + * * @return the bounds in device-space */ protected abstract Rectangle2D getRealBounds(); @@ -359,7 +359,7 @@ public abstract class CairoGraphics2D extends Graphics2D double x2, double y2, int r1, int g1, int b1, int a1, int r2, int g2, int b2, int a2, boolean cyclic); - + protected native void setPaintPixels(long pointer, int[] pixels, int w, int h, int stride, boolean repeat, int x, int y); @@ -368,7 +368,7 @@ public abstract class CairoGraphics2D extends Graphics2D * Set the current transform matrix */ protected native void cairoSetMatrix(long pointer, double[] m); - + /** * Scaling method */ @@ -406,8 +406,8 @@ public abstract class CairoGraphics2D extends Graphics2D /* * Draws a Glyph Vector */ - protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font, - float x, float y, int n, + protected native void cairoDrawGlyphVector(long pointer, GdkFontPeer font, + float x, float y, int n, int[] codes, float[] positions, long[] fontset); /** @@ -420,7 +420,7 @@ public abstract class CairoGraphics2D extends Graphics2D */ protected native void cairoRectangle(long pointer, double x, double y, double width, double height); - + /** * Appends an arc to the current path */ @@ -438,7 +438,7 @@ public abstract class CairoGraphics2D extends Graphics2D */ protected native void cairoNewPath(long pointer); - /** + /** * Close current path */ protected native void cairoClosePath(long pointer); @@ -464,16 +464,16 @@ public abstract class CairoGraphics2D extends Graphics2D */ protected native void cairoFill(long pointer, double alpha); - /** + /** * Clip current path */ protected native void cairoClip(long pointer); - /** + /** * Clear clip */ protected native void cairoResetClip(long pointer); - + /** * Set antialias. */ @@ -483,7 +483,7 @@ public abstract class CairoGraphics2D extends Graphics2D ///////////////////////// TRANSFORMS /////////////////////////////////// /** * Set the current transform - */ + */ public void setTransform(AffineTransform tx) { // Transform clip into target space using the old transform. @@ -588,7 +588,7 @@ public abstract class CairoGraphics2D extends Graphics2D setTransformImpl(transform); } - + public void translate(int x, int y) { translate((double) x, (double) y); @@ -670,13 +670,13 @@ public abstract class CairoGraphics2D extends Graphics2D setColor((Color) paint); customPaint = false; } - + else if (paint instanceof TexturePaint) { TexturePaint tp = (TexturePaint) paint; BufferedImage img = tp.getImage(); - // map the image to the anchor rectangle + // map the image to the anchor rectangle int width = (int) tp.getAnchorRect().getWidth(); int height = (int) tp.getAnchorRect().getHeight(); @@ -690,7 +690,7 @@ public abstract class CairoGraphics2D extends Graphics2D setPaintPixels(nativePointer, pixels, width, height, width, true, 0, 0); customPaint = false; } - + else if (paint instanceof GradientPaint) { GradientPaint gp = (GradientPaint) paint; @@ -707,12 +707,12 @@ public abstract class CairoGraphics2D extends Graphics2D else { customPaint = true; - } + } } - + /** * Sets a custom paint - * + * * @param bounds the bounding box, in user space */ protected void setCustomPaint(Rectangle bounds) @@ -720,12 +720,12 @@ public abstract class CairoGraphics2D extends Graphics2D if (paint instanceof Color || paint instanceof TexturePaint || paint instanceof GradientPaint) return; - + int userX = bounds.x; int userY = bounds.y; int userWidth = bounds.width; int userHeight = bounds.height; - + // Find bounds in device space Rectangle2D bounds2D = getTransformedBounds(bounds, transform); int deviceX = (int)bounds2D.getX(); @@ -740,14 +740,14 @@ public abstract class CairoGraphics2D extends Graphics2D deviceHeight), bounds, transform, hints); - + Raster raster = pc.getRaster(deviceX, deviceY, deviceWidth, deviceHeight); - + // Clear the transform matrix in Cairo, since the raster returned by the // PaintContext is already in device-space AffineTransform oldTx = new AffineTransform(transform); - setTransformImpl(new AffineTransform()); + setTransformImpl(new AffineTransform()); // Set pixels in cairo, aligning the top-left of the background image // to the top-left corner in device space @@ -762,7 +762,7 @@ public abstract class CairoGraphics2D extends Graphics2D deviceWidth, deviceHeight, deviceWidth, false, deviceX, deviceY); } - + else if (pc.getColorModel().equals(CairoSurface.cairoCM_opaque) && raster.getSampleModel().getTransferType() == DataBuffer.TYPE_INT) { @@ -770,36 +770,36 @@ public abstract class CairoGraphics2D extends Graphics2D // but without an alpha channel; we just add the alpha int[] pixels = (int[])raster.getDataElements(0, 0, deviceWidth, deviceHeight, null); - + for (int i = 0; i < pixels.length; i++) pixels[i] = 0xff000000 | (pixels[i] & 0x00ffffff); - + setPaintPixels(nativePointer, pixels, deviceWidth, deviceHeight, deviceWidth, false, deviceX, deviceY); } - + else { - // Fall back on wrapping the raster in a BufferedImage, and - // use BufferedImage.getRGB() to do color-model conversion + // Fall back on wrapping the raster in a BufferedImage, and + // use BufferedImage.getRGB() to do color-model conversion WritableRaster wr = Raster.createWritableRaster(raster.getSampleModel(), new Point(raster.getMinX(), raster.getMinY())); wr.setRect(raster); - + BufferedImage img2 = new BufferedImage(pc.getColorModel(), wr, pc.getColorModel().isAlphaPremultiplied(), null); - + setPaintPixels(nativePointer, img2.getRGB(0, 0, deviceWidth, deviceHeight, null, 0, deviceWidth), deviceWidth, deviceHeight, deviceWidth, false, deviceX, deviceY); } - + // Restore transform - setTransformImpl(oldTx); + setTransformImpl(oldTx); } public Stroke getStroke() @@ -813,7 +813,7 @@ public abstract class CairoGraphics2D extends Graphics2D if (stroke instanceof BasicStroke) { BasicStroke bs = (BasicStroke) stroke; - cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(), + cairoSetLine(nativePointer, bs.getLineWidth(), bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit()); float[] dashes = bs.getDashArray(); @@ -822,7 +822,7 @@ public abstract class CairoGraphics2D extends Graphics2D double[] double_dashes = new double[dashes.length]; for (int i = 0; i < dashes.length; i++) double_dashes[i] = dashes[i]; - + cairoSetDash(nativePointer, double_dashes, double_dashes.length, (double) bs.getDashPhase()); } @@ -833,14 +833,14 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Utility method to find the bounds of a shape, including the stroke width. - * + * * @param s the shape * @return the bounds of the shape, including stroke width */ protected Rectangle findStrokedBounds(Shape s) { Rectangle r = s.getBounds(); - + if (stroke instanceof BasicStroke) { int strokeWidth = (int)Math.ceil(((BasicStroke)stroke).getLineWidth()); @@ -854,7 +854,7 @@ public abstract class CairoGraphics2D extends Graphics2D Shape s2 = stroke.createStrokedShape(s); r = s2.getBounds(); } - + return r; } @@ -877,7 +877,7 @@ public abstract class CairoGraphics2D extends Graphics2D paint = c; updateColor(); } - + /** * Set the current fg value as the cairo color. */ @@ -885,7 +885,7 @@ public abstract class CairoGraphics2D extends Graphics2D { if (fg == null) fg = Color.BLACK; - + cairoSetRGBAColor(nativePointer, fg.getRed() / 255.0, fg.getGreen() / 255.0,fg.getBlue() / 255.0, fg.getAlpha() / 255.0); @@ -951,9 +951,9 @@ public abstract class CairoGraphics2D extends Graphics2D public void setClip(Shape s) { - // The first time the clip is set, save it as the original clip - // to reset to on s == null. We can rely on this being non-null - // because the constructor in subclasses is expected to set the + // The first time the clip is set, save it as the original clip + // to reset to on s == null. We can rely on this being non-null + // because the constructor in subclasses is expected to set the // initial clip properly. if( firstClip ) { @@ -975,7 +975,7 @@ public abstract class CairoGraphics2D extends Graphics2D } else walkPath(clip.getPathIterator(null), false); - + cairoClip(nativePointer); } } @@ -1010,7 +1010,7 @@ public abstract class CairoGraphics2D extends Graphics2D { if (this.comp == comp) return; - + this.comp = comp; if (compCtx != null) compCtx.dispose(); @@ -1021,11 +1021,11 @@ public abstract class CairoGraphics2D extends Graphics2D AlphaComposite a = (AlphaComposite) comp; cairoSetOperator(nativePointer, a.getRule()); } - + else { cairoSetOperator(nativePointer, AlphaComposite.SRC_OVER); - + if (comp != null) { // FIXME: this check is only required "if this Graphics2D @@ -1033,24 +1033,24 @@ public abstract class CairoGraphics2D extends Graphics2D SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new AWTPermission("readDisplayPixels")); - + compCtx = comp.createContext(getBufferCM(), getNativeCM(), hints); } } } - + /** * Returns the Colour Model describing the native, raw image data for this * specific peer. - * + * * @return ColorModel the ColorModel of native data in this peer */ protected abstract ColorModel getNativeCM(); - + /** * Returns the Color Model describing the buffer that this peer uses * for custom composites. - * + * * @return ColorModel the ColorModel of the composite buffer in this peer. */ protected ColorModel getBufferCM() @@ -1107,7 +1107,7 @@ public abstract class CairoGraphics2D extends Graphics2D if (s instanceof Rectangle2D) { Rectangle2D r = (Rectangle2D) s; - + // Pixels need to be shifted in draw operations to ensure that they // light up entire pixels, but we also need to make sure the rectangle // does not get distorted by this shifting operation @@ -1117,7 +1117,7 @@ public abstract class CairoGraphics2D extends Graphics2D double h = Math.round(r.getHeight()); cairoRectangle(nativePointer, x, y, w, h); } - + // Lines are easy too else if (s instanceof Line2D) { @@ -1170,7 +1170,7 @@ public abstract class CairoGraphics2D extends Graphics2D /** * Note that the rest of the drawing methods go via fill() or draw() for the drawing, - * although subclasses may with to overload these methods where context-specific + * although subclasses may with to overload these methods where context-specific * optimizations are possible (e.g. bitmaps and fillRect(int, int, int, int) */ @@ -1274,17 +1274,17 @@ public abstract class CairoGraphics2D extends Graphics2D } /** - * CopyArea - performs clipping to the native surface as a convenience + * CopyArea - performs clipping to the native surface as a convenience * (requires getRealBounds). Then calls copyAreaImpl. */ - public void copyArea(int ox, int oy, int owidth, int oheight, - int odx, int ody) + public void copyArea(int ox, int oy, int owidth, int oheight, + int odx, int ody) { // FIXME: does this handle a rotation transform properly? // (the width/height might not be correct) Point2D pos = transform.transform(new Point2D.Double(ox, oy), (Point2D) null); - Point2D dim = transform.transform(new Point2D.Double(ox + owidth, + Point2D dim = transform.transform(new Point2D.Double(ox + owidth, oy + oheight), (Point2D) null); Point2D p2 = transform.transform(new Point2D.Double(ox + odx, oy + ody), @@ -1307,7 +1307,7 @@ public abstract class CairoGraphics2D extends Graphics2D if( x + dx + width < r.getX() || y + dy + height < r.getY() ) return; - // Clip edges if necessary + // Clip edges if necessary if( x + dx < r.getX() ) // left { width = x + dx + width; @@ -1348,10 +1348,10 @@ public abstract class CairoGraphics2D extends Graphics2D { this.hints = new RenderingHints(getDefaultHints()); this.hints.putAll(hints); - + shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE) || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT); - + if (compCtx != null) { compCtx.dispose(); @@ -1368,7 +1368,7 @@ public abstract class CairoGraphics2D extends Graphics2D { return hints; } - + private int getInterpolation() { if (this.hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)) @@ -1392,18 +1392,18 @@ public abstract class CairoGraphics2D extends Graphics2D // Do bilinear interpolation as default return INTERPOLATION_BILINEAR; } - + /** * Set antialias if needed. If the ignoreAA flag is set, this method will * return without doing anything. - * + * * @param needAA RenderingHints.VALUE_ANTIALIAS_ON or RenderingHints.VALUE_ANTIALIAS_OFF */ private void setAntialias(boolean needAA) { if (ignoreAA) return; - + if (needAA != antialias) { antialias = !antialias; @@ -1425,8 +1425,8 @@ public abstract class CairoGraphics2D extends Graphics2D // In this case, xform is an AffineTransform that transforms bounding // box of the specified image from image space to user space. However // when we pass this transform to cairo, cairo will use this transform - // to map "user coordinates" to "pixel" coordinates, which is the - // other way around. Therefore to get the "user -> pixel" transform + // to map "user coordinates" to "pixel" coordinates, which is the + // other way around. Therefore to get the "user -> pixel" transform // that cairo wants from "image -> user" transform that we currently // have, we will need to invert the transformation matrix. AffineTransform invertedXform; @@ -1459,10 +1459,10 @@ public abstract class CairoGraphics2D extends Graphics2D double[] i2u = new double[6]; int width = b.getWidth(); int height = b.getHeight(); - - // If this BufferedImage has a BufferedImageGraphics object, + + // If this BufferedImage has a BufferedImageGraphics object, // use the cached CairoSurface that BIG is drawing onto - + if( BufferedImageGraphics.bufferedImages.get( b ) != null ) raster = BufferedImageGraphics.bufferedImages.get( b ); else @@ -1481,18 +1481,18 @@ public abstract class CairoGraphics2D extends Graphics2D updateColor(); return true; } - + if( bgcolor != null ) { Color oldColor = bg; setBackground(bgcolor); - + Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height); bounds = getTransformedBounds(bounds, xform); - + clearRect((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); - + setBackground(oldColor); } @@ -1500,7 +1500,7 @@ public abstract class CairoGraphics2D extends Graphics2D // FIXME: The above method returns data in the standard ARGB colorspace, // meaning data should NOT be alpha pre-multiplied; however Cairo expects // data to be premultiplied. - + cairoSave(nativePointer); Rectangle2D bounds = new Rectangle2D.Double(0, 0, width, height); bounds = getTransformedBounds(bounds, xform); @@ -1510,7 +1510,7 @@ public abstract class CairoGraphics2D extends Graphics2D drawPixels(nativePointer, pixels, width, height, width, i2u, alpha, getInterpolation()); - + cairoRestore(nativePointer); // Cairo seems to lose the current color which must be restored. @@ -1585,7 +1585,7 @@ public abstract class CairoGraphics2D extends Graphics2D int destWidth = dx2 - dx1; int destHeight = dy2 - dy1; - if(destWidth == 0 || destHeight == 0 || sourceWidth == 0 || + if(destWidth == 0 || destHeight == 0 || sourceWidth == 0 || sourceHeight == 0) return true; @@ -1593,18 +1593,18 @@ public abstract class CairoGraphics2D extends Graphics2D double scaleY = destHeight / (double) sourceHeight; // FIXME: Avoid using an AT if possible here - it's at least twice as slow. - + Shape oldClip = getClip(); int cx, cy, cw, ch; - if( dx1 < dx2 ) + if( dx1 < dx2 ) { cx = dx1; cw = dx2 - dx1; } else { cx = dx2; cw = dx1 - dx2; } - if( dy1 < dy2 ) + if( dy1 < dy2 ) { cy = dy1; ch = dy2 - dy1; } else { cy = dy2; ch = dy1 - dy2; } - + clipRect( cx, cy, cw, ch ); AffineTransform tx = new AffineTransform(); @@ -1622,10 +1622,10 @@ public abstract class CairoGraphics2D extends Graphics2D { return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, observer); } - + /** * Optimized method for drawing a CairoSurface onto this graphics context. - * + * * @param surface The surface to draw. * @param tx The transformation matrix (cannot be null). * @param alpha The alpha value to paint with ( 0 <= alpha <= 1). @@ -1642,19 +1642,19 @@ public abstract class CairoGraphics2D extends Graphics2D Point2D origin = new Point2D.Double(0, 0); Point2D offset = new Point2D.Double(surface.getSampleModelTranslateX(), surface.getSampleModelTranslateY()); - + tx.transform(origin, origin); tx.transform(offset, offset); - + tx.translate(offset.getX() - origin.getX(), offset.getY() - origin.getY()); } - + // Find dimensions of this surface relative to the root parent surface Rectangle bounds = new Rectangle(-surface.getSampleModelTranslateX(), -surface.getSampleModelTranslateY(), surface.width, surface.height); - + // Clip to the translated image // We use direct cairo methods to avoid the overhead of maintaining a // java copy of the clip, since we will be reverting it immediately @@ -1663,7 +1663,7 @@ public abstract class CairoGraphics2D extends Graphics2D cairoSave(nativePointer); walkPath(newBounds.getPathIterator(null), false); cairoClip(nativePointer); - + // Draw the surface try { @@ -1677,7 +1677,7 @@ public abstract class CairoGraphics2D extends Graphics2D // This should never happen(?), so we don't need to do anything here. ; } - + // Restore clip cairoRestore(nativePointer); } @@ -1696,13 +1696,13 @@ public abstract class CairoGraphics2D extends Graphics2D tl = new TextLayout( str, getFont(), getFontRenderContext() ); fontPeer.textLayoutCache.put(str, tl); } - + // Set antialias to text_antialiasing, and set the ignoreAA flag so that // the setting doesn't get overridden in a draw() or fill() call. setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING) .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)); ignoreAA = true; - + tl.draw(this, x, y); ignoreAA = false; } @@ -1726,14 +1726,14 @@ public abstract class CairoGraphics2D extends Graphics2D if (customPaint) setCustomPaint(gv.getOutline().getBounds()); - + if (comp instanceof AlphaComposite) alpha = ((AlphaComposite) comp).getAlpha(); - + setAntialias(!hints.get(RenderingHints.KEY_TEXT_ANTIALIASING) .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)); ignoreAA = true; - + if (gv instanceof FreetypeGlyphVector && alpha == 1.0 && !((FreetypeGlyphVector)gv).hasTransforms()) { @@ -1744,8 +1744,8 @@ public abstract class CairoGraphics2D extends Graphics2D setFont (gv.getFont ()); GdkFontPeer fontPeer = (GdkFontPeer) font.getPeer(); - synchronized (fontPeer) - { + synchronized (fontPeer) + { cairoDrawGlyphVector(nativePointer, fontPeer, x, y, n, codes, positions, fontset); } @@ -1756,7 +1756,7 @@ public abstract class CairoGraphics2D extends Graphics2D fill(gv.getOutline()); translate(-x, -y); } - + ignoreAA = false; } @@ -1767,7 +1767,7 @@ public abstract class CairoGraphics2D extends Graphics2D } /** - * Should perhaps be contexct dependent, but this is left for now as an + * Should perhaps be contexct dependent, but this is left for now as an * overloadable default implementation. */ public FontRenderContext getFontRenderContext() @@ -1799,10 +1799,10 @@ public abstract class CairoGraphics2D extends Graphics2D if (f.getPeer() instanceof GdkFontPeer) font = f; else - font = + font = ((ClasspathToolkit)(Toolkit.getDefaultToolkit())) - .getFont(f.getName(), f.getAttributes()); - + .getFont(f.getName(), f.getAttributes()); + GdkFontPeer fontpeer = (GdkFontPeer) getFont().getPeer(); synchronized (fontpeer) { @@ -1824,11 +1824,11 @@ public abstract class CairoGraphics2D extends Graphics2D if( onStroke ) { Shape stroked = stroke.createStrokedShape( s ); - return stroked.intersects( (double)rect.x, (double)rect.y, + return stroked.intersects( (double)rect.x, (double)rect.y, (double)rect.width, (double)rect.height ); } - return s.intersects( (double)rect.x, (double)rect.y, - (double)rect.width, (double)rect.height ); + return s.intersects( (double)rect.x, (double)rect.y, + (double)rect.width, (double)rect.height ); } public String toString() @@ -1836,7 +1836,7 @@ public abstract class CairoGraphics2D extends Graphics2D return (getClass().getName() + "[font=" + getFont().toString() + ",color=" + fg.toString() - + "]"); + + "]"); } ///////////////////////// PRIVATE METHODS /////////////////////////////////// @@ -1845,7 +1845,7 @@ public abstract class CairoGraphics2D extends Graphics2D * All the drawImage() methods eventually get delegated here if the image * is not a Cairo surface. * - * @param bgcolor - if non-null draws the background color before + * @param bgcolor - if non-null draws the background color before * drawing the image. */ private boolean drawRaster(ColorModel cm, Raster r, @@ -1881,7 +1881,7 @@ public abstract class CairoGraphics2D extends Graphics2D if (pixels == null) { // FIXME: I don't think this code will work correctly with a non-RGB - // MultiPixelPackedSampleModel. Although this entire method should + // MultiPixelPackedSampleModel. Although this entire method should // probably be rewritten to better utilize Cairo's different supported // data formats. if (sm instanceof MultiPixelPackedSampleModel) @@ -1917,13 +1917,13 @@ public abstract class CairoGraphics2D extends Graphics2D double alpha = 1.0; if (comp instanceof AlphaComposite) alpha = ((AlphaComposite) comp).getAlpha(); - + drawPixels(nativePointer, pixels, r.getWidth(), r.getHeight(), r.getWidth(), i2u, alpha, getInterpolation()); // Cairo seems to lose the current color which must be restored. updateColor(); - + return true; } @@ -2112,7 +2112,7 @@ public abstract class CairoGraphics2D extends Graphics2D { if (! (clip instanceof GeneralPath)) clip = new GeneralPath(clip); - + GeneralPath p = (GeneralPath) clip; p.transform(t); } @@ -2138,7 +2138,7 @@ public abstract class CairoGraphics2D extends Graphics2D return rect; } - + static Rectangle2D getTransformedBounds(Rectangle2D bounds, AffineTransform tx) { double x1 = bounds.getX(); @@ -2149,10 +2149,10 @@ public abstract class CairoGraphics2D extends Graphics2D double y2 = y1; double y3 = bounds.getY() + bounds.getHeight(); double y4 = y3; - + double[] points = new double[] {x1, y1, x2, y2, x3, y3, x4, y4}; tx.transform(points, 0, points, 0, 4); - + double minX = points[0]; double maxX = minX; double minY = points[1]; @@ -2164,13 +2164,13 @@ public abstract class CairoGraphics2D extends Graphics2D if (points[i] > maxX) maxX = points[i]; i++; - + if (points[i] < minY) minY = points[i]; if (points[i] > maxY) maxY = points[i]; } - + return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY)); } } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java index 6c8a30d..71f6638 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java @@ -68,7 +68,7 @@ public class CairoSurface extends WritableRaster int width = -1, height = -1; /** - * The native pointer to the Cairo surface. + * The native pointer to the Cairo surface. */ long surfacePointer; @@ -93,8 +93,8 @@ public class CairoSurface extends WritableRaster 0xFF000000, true, Buffers.smallestAppropriateTransferType(32)); - - // This CM corresponds to the CAIRO_FORMAT_RGB24 type in Cairo + + // This CM corresponds to the CAIRO_FORMAT_RGB24 type in Cairo static ColorModel cairoCM_opaque = new DirectColorModel(24, 0x00FF0000, 0x0000FF00, 0x000000FF); @@ -112,7 +112,7 @@ public class CairoSurface extends WritableRaster private native void destroy(long surfacePointer, int[] buf); /** - * Draws this image to a given CairoGraphics context, + * Draws this image to a given CairoGraphics context, * with an affine transform given by i2u. */ public native void nativeDrawSurface(long surfacePointer, long contextPointer, @@ -122,23 +122,23 @@ public class CairoSurface extends WritableRaster /** * Synchronizes the image's data buffers, copying any changes made in the * Java array into the native array. - * + * * This method should only be called if (sharedBuffers == false). */ native void syncNativeToJava(long surfacePointer, int[] buffer); - + /** * Synchronizes the image's data buffers, copying any changes made in the * native array into the Java array. - * + * * This method should only be called if (sharedBuffers == false). */ native void syncJavaToNative(long surfacePointer, int[] buffer); - + /** * Return the buffer, with the sample values of each pixel reversed - * (ie, in ABGR instead of ARGB). - * + * (ie, in ABGR instead of ARGB). + * * @return A pointer to a flipped buffer. The memory is allocated in native * code, and must be explicitly freed when it is no longer needed. */ @@ -146,21 +146,21 @@ public class CairoSurface extends WritableRaster /** * Create a cairo_surface_t with specified width and height. - * The format will be ARGB32 with premultiplied alpha and native bit + * The format will be ARGB32 with premultiplied alpha and native bit * and word ordering. */ public CairoSurface(int width, int height) { this(0, 0, width, height); } - + public CairoSurface(int x, int y, int width, int height) { super(createCairoSampleModel(width, height), null, new Point(x, y)); if(width <= 0 || height <= 0) throw new IllegalArgumentException("Image must be at least 1x1 pixels."); - + this.width = width; this.height = height; dataBuffer = new DataBufferInt(width * height); @@ -169,7 +169,7 @@ public class CairoSurface extends WritableRaster if(surfacePointer == 0) throw new Error("Could not allocate bitmap."); } - + /** * Create a Cairo Surface that is a subimage of another Cairo Surface */ @@ -177,7 +177,7 @@ public class CairoSurface extends WritableRaster Point origin) { super(sm, parent.dataBuffer, bounds, origin, parent); - + this.width = super.width; this.height = super.height; this.surfacePointer = parent.surfacePointer; @@ -258,10 +258,10 @@ public class CairoSurface extends WritableRaster { return new GtkImage(width, height, getFlippedBuffer(surfacePointer)); } - + /** * Convenience method to quickly grab the data array backing this Raster. - * + * * @return The array behind the databuffer. */ public int[] getData() @@ -271,16 +271,16 @@ public class CairoSurface extends WritableRaster /** * Returns a BufferedImage backed by a Cairo surface. - */ + */ public static BufferedImage getBufferedImage(int width, int height) { return getBufferedImage(new CairoSurface(width, height)); } /** - * Returns a BufferedImage backed by a Cairo surface, + * Returns a BufferedImage backed by a Cairo surface, * created from a GtkImage. - */ + */ public static BufferedImage getBufferedImage(GtkImage image) { return getBufferedImage(new CairoSurface(image)); @@ -288,7 +288,7 @@ public class CairoSurface extends WritableRaster /** * Returns a BufferedImage backed by a Cairo surface. - */ + */ public static BufferedImage getBufferedImage(CairoSurface surface) { return new BufferedImage(cairoColorModel, surface, @@ -302,7 +302,7 @@ public class CairoSurface extends WritableRaster public Graphics2D getGraphics() { return new CairoSurfaceGraphics(this); - } + } ///// Methods used by CairoSurfaceGraphics ///// /** @@ -319,7 +319,7 @@ public class CairoSurface extends WritableRaster /** * Copy a portion of this surface to another area on the surface. The given * parameters must be within bounds - count on a segfault otherwise. - * + * * @param x The x coordinate of the area to be copied from. * @param y The y coordinate of the area to be copied from. * @param width The width of the area to be copied. @@ -336,7 +336,7 @@ public class CairoSurface extends WritableRaster native void copyAreaNative2(long surfacePointer, int x, int y, int width, int height, int dx, int dy, int stride); - + /** * Creates a SampleModel that matches Cairo's native format */ @@ -344,12 +344,12 @@ public class CairoSurface extends WritableRaster { return new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, w, h, new int[]{0x00FF0000, 0x0000FF00, - 0x000000FF, 0xFF000000}); + 0x000000FF, 0xFF000000}); } - + /** * Returns whether this ColorModel is compatible with Cairo's native types. - * + * * @param cm The color model to check. * @return Whether it is compatible. */ @@ -358,10 +358,10 @@ public class CairoSurface extends WritableRaster return (cm.equals(cairoCM_pre) || cm.equals(cairoCM_opaque) || cm.equals(cairoColorModel)); } - + /** * Returns whether this SampleModel is compatible with Cairo's native types. - * + * * @param sm The sample model to check. * @return Whether it is compatible. */ @@ -381,23 +381,23 @@ public class CairoSurface extends WritableRaster return createWritableChild(parentX, parentY, width, height, childMinX, childMinY, bandList); } - + public WritableRaster createCompatibleWritableRaster() { return new CairoSurface(width, height); } - + public WritableRaster createCompatibleWritableRaster (int x, int y, int w, int h) { return new CairoSurface(x, y, w, h); } - + public Raster createTranslatedChild(int childMinX, int childMinY) { return createWritableTranslatedChild(childMinX, childMinY); } - + public WritableRaster createWritableChild(int parentX, int parentY, int w, int h, int childMinX, int childMinY, int[] bandList) @@ -405,7 +405,7 @@ public class CairoSurface extends WritableRaster if (parentX < minX || parentX + w > minX + width || parentY < minY || parentY + h > minY + height) throw new RasterFormatException("Child raster extends beyond parent"); - + SampleModel sm = (bandList == null) ? sampleModel : sampleModel.createSubsetSampleModel(bandList); @@ -415,12 +415,12 @@ public class CairoSurface extends WritableRaster new Point(sampleModelTranslateX + childMinX - parentX, sampleModelTranslateY + childMinY - parentY)); } - + public WritableRaster createWritableTranslatedChild(int x, int y) { int tcx = sampleModelTranslateX - minX + x; int tcy = sampleModelTranslateY - minY + y; - + return new CairoSurface(sampleModel, this, new Rectangle(x, y, width, height), new Point(tcx, tcy)); diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java index 35b015f..a0c6caa 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java @@ -67,7 +67,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D protected CairoSurface surface; private BufferedImage buffer; private long cairo_t; - + /** * Create a graphics context from a cairo surface */ @@ -82,24 +82,24 @@ public class CairoSurfaceGraphics extends CairoGraphics2D /** * Creates another context from a surface. * Used by create(). - */ + */ private CairoSurfaceGraphics(CairoSurfaceGraphics copyFrom) { surface = copyFrom.surface; cairo_t = surface.newCairoContext(); copy( copyFrom, cairo_t ); } - + public Graphics create() { return new CairoSurfaceGraphics(this); } - + public GraphicsConfiguration getDeviceConfiguration() { return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); } - + protected Rectangle2D getRealBounds() { return new Rectangle2D.Double(0.0, 0.0, surface.width, surface.height); @@ -109,7 +109,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { surface.copyAreaNative(x, y, width, height, dx, dy, surface.width); } - + /** * Overloaded methods that do actual drawing need to account for custom * composites @@ -118,7 +118,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + // Find total bounds of shape Rectangle r = findStrokedBounds(s); if (shiftDrawCalls) @@ -126,24 +126,24 @@ public class CairoSurfaceGraphics extends CairoGraphics2D r.width++; r.height++; } - + // Do the drawing if (comp == null || comp instanceof AlphaComposite) super.draw(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setStroke(this.getStroke()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.draw(s); - + drawComposite(r.getBounds2D(), null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } @@ -152,23 +152,23 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + if (comp == null || comp instanceof AlphaComposite) super.fill(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.setTransform(transform); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } @@ -177,10 +177,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + if (comp == null || comp instanceof AlphaComposite) super.drawRenderedImage(image, xform); - + else { createBuffer(); @@ -189,10 +189,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D g2d.setRenderingHints(this.getRenderingHints()); g2d.setTransform(transform); g2d.drawRenderedImage(image, xform); - + drawComposite(buffer.getRaster().getBounds(), null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } @@ -206,7 +206,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D boolean ret; if (comp == null || comp instanceof AlphaComposite) ret = super.drawImage(img, xform, bgcolor, obs); - + else { // Get buffered image of source @@ -218,16 +218,16 @@ public class CairoSurfaceGraphics extends CairoGraphics2D img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find translated bounds Rectangle2D bounds = new Rectangle(bImg.getMinX(), bImg.getMinY(), bImg.getWidth(), bImg.getHeight()); if (xform != null) bounds = getTransformedBounds(bounds, xform); - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -235,10 +235,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D // Perform compositing ret = drawComposite(bounds, obs); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); - + return ret; } @@ -246,10 +246,10 @@ public class CairoSurfaceGraphics extends CairoGraphics2D { if (!surface.sharedBuffer) surface.syncJavaToNative(surface.surfacePointer, surface.getData()); - + if (comp == null || comp instanceof AlphaComposite) super.drawGlyphVector(gv, x, y); - + else { createBuffer(); @@ -258,17 +258,17 @@ public class CairoSurfaceGraphics extends CairoGraphics2D g2d.setPaint(this.getPaint()); g2d.setStroke(this.getStroke()); g2d.drawGlyphVector(gv, x, y); - + Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); drawComposite(bounds, null); } - + if (!surface.sharedBuffer) surface.syncNativeToJava(surface.surfacePointer, surface.getData()); } - + private boolean drawComposite(Rectangle2D bounds, ImageObserver observer) { // Find bounds in device space @@ -280,7 +280,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D devClip = new Rectangle(buffer.getMinX(), buffer.getMinY(), buffer.getWidth(), buffer.getHeight()); Rectangle2D.intersect(bounds, devClip, bounds); - + // Round bounds as needed, but be careful in our rounding // (otherwise it may leave unpainted stripes) double x = bounds.getX(); @@ -290,7 +290,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D x = Math.round(x); y = Math.round(y); bounds.setRect(x, y, Math.round(maxX - x), Math.round(maxY - y)); - + // Find subimage of internal buffer for updating BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) @@ -307,12 +307,12 @@ public class CairoSurfaceGraphics extends CairoGraphics2D // Perform actual composite operation compCtx.compose(buffer2.getRaster(), current.getRaster(), buffer2.getRaster()); - + // Set cairo's composite to direct SRC, since we've already done our own - // compositing + // compositing Composite oldcomp = comp; setComposite(AlphaComposite.Src); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -324,7 +324,7 @@ public class CairoSurfaceGraphics extends CairoGraphics2D updateColor(); return rv; } - + private void createBuffer() { if (buffer == null) @@ -337,17 +337,17 @@ public class CairoSurfaceGraphics extends CairoGraphics2D else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } } - + protected ColorModel getNativeCM() { return CairoSurface.cairoCM_pre; } - + protected ColorModel getBufferCM() { return CairoSurface.cairoColorModel; diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java index bfa3bc9..50161b2 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java @@ -83,7 +83,7 @@ public class ComponentGraphics extends CairoGraphics2D ComponentGraphics() { } - + private ComponentGraphics(GtkComponentPeer component) { this.component = component; @@ -114,7 +114,7 @@ public class ComponentGraphics extends CairoGraphics2D /** * Obtain and hold a GDK lock, which is required for all drawing operations * in this graphics context (since it is backed by an X surface). - * + * * This method causes the GDK locking behaviour to be re-entrant. No race * conditions are caused since a ThreadLocal is used and each thread has its * own lock counter. @@ -176,11 +176,11 @@ public class ComponentGraphics extends CairoGraphics2D */ private static native Pointer nativeGrab(GtkComponentPeer component); - private native void copyAreaNative(GtkComponentPeer component, int x, int y, + private native void copyAreaNative(GtkComponentPeer component, int x, int y, int width, int height, int dx, int dy); private native void drawVolatile(GtkComponentPeer component, - long vimg, int x, int y, + long vimg, int x, int y, int width, int height, int cx, int cy, int cw, int ch); @@ -193,7 +193,7 @@ public class ComponentGraphics extends CairoGraphics2D } /** - * Returns a Graphics2D object for a component, either an instance of this + * Returns a Graphics2D object for a component, either an instance of this * class (if xrender is supported), or a context which copies. */ public static Graphics2D getComponentGraphics(GtkComponentPeer component) @@ -214,7 +214,7 @@ public class ComponentGraphics extends CairoGraphics2D { return new ComponentGraphics(this); } - + protected Rectangle2D getRealBounds() { return component.awtComponent.getBounds(); @@ -226,23 +226,23 @@ public class ComponentGraphics extends CairoGraphics2D } /** - * Overloaded methods that do actual drawing need to enter the gdk threads + * Overloaded methods that do actual drawing need to enter the gdk threads * and also do certain things before and after. */ public void draw(Shape s) { if (comp == null || comp instanceof AlphaComposite) super.draw(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setStroke(this.getStroke()); g2d.setColor(this.getColor()); g2d.draw(s); - + drawComposite(s.getBounds2D(), null); } } @@ -251,16 +251,16 @@ public class ComponentGraphics extends CairoGraphics2D { if (comp == null || comp instanceof AlphaComposite) super.fill(s); - + else { createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } } @@ -269,7 +269,7 @@ public class ComponentGraphics extends CairoGraphics2D { if (comp == null || comp instanceof AlphaComposite) super.drawRenderedImage(image, xform); - + else { createBuffer(); @@ -277,18 +277,18 @@ public class ComponentGraphics extends CairoGraphics2D Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawRenderedImage(image, xform); - + drawComposite(buffer.getRaster().getBounds(), null); } } protected boolean drawImage(Image img, AffineTransform xform, - Color bgcolor, ImageObserver obs) + Color bgcolor, ImageObserver obs) { boolean rv; if (comp == null || comp instanceof AlphaComposite) rv = super.drawImage(img, xform, bgcolor, obs); - + else { // Get buffered image of source @@ -300,7 +300,7 @@ public class ComponentGraphics extends CairoGraphics2D img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find translated bounds Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY()); Point2D pt = new Point2D.Double(bImg.getWidth() + bImg.getMinX(), @@ -310,10 +310,10 @@ public class ComponentGraphics extends CairoGraphics2D origin = xform.transform(origin, origin); pt = xform.transform(pt, pt); } - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -331,7 +331,7 @@ public class ComponentGraphics extends CairoGraphics2D { if (comp == null || comp instanceof AlphaComposite) super.drawGlyphVector(gv, x, y); - + else { createBuffer(); @@ -340,14 +340,14 @@ public class ComponentGraphics extends CairoGraphics2D g2d.setPaint(this.getPaint()); g2d.setStroke(this.getStroke()); g2d.drawGlyphVector(gv, x, y); - + Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); drawComposite(bounds, null); } } - + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { // If it is a GtkVolatileImage with an "easy" transform then @@ -390,7 +390,7 @@ public class ComponentGraphics extends CairoGraphics2D } return super.drawImage(bimg, x, y, observer); } - + public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { @@ -446,41 +446,41 @@ public class ComponentGraphics extends CairoGraphics2D clip = new Rectangle(buffer.getMinX(), buffer.getMinY(), buffer.getWidth(), buffer.getHeight()); Rectangle2D.intersect(bounds, clip, bounds); - + BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) buffer2 = buffer2.getSubimage((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); - + // Get destination clip to bounds double[] points = new double[] {bounds.getX(), bounds.getY(), bounds.getMaxX(), bounds.getMaxY()}; transform.transform(points, 0, points, 0, 2); - + Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1], points[2] - points[0], points[3] - points[1]); - + Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds); - + // Get current image on the component GtkImage img = grab(component); Graphics gr = componentBuffer.createGraphics(); gr.drawImage(img, 0, 0, null); gr.dispose(); - + BufferedImage cBuffer = componentBuffer; if (!deviceBounds.equals(cBuffer.getRaster().getBounds())) cBuffer = cBuffer.getSubimage((int)deviceBounds.getX(), (int)deviceBounds.getY(), (int)deviceBounds.getWidth(), (int)deviceBounds.getHeight()); - + // Perform actual composite operation compCtx.compose(buffer2.getRaster(), cBuffer.getRaster(), cBuffer.getRaster()); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -490,7 +490,7 @@ public class ComponentGraphics extends CairoGraphics2D null, null); return rv; } - + private void createBuffer() { if (buffer == null) @@ -499,7 +499,7 @@ public class ComponentGraphics extends CairoGraphics2D rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(component.awtComponent.getWidth(), component.awtComponent.getHeight()), new Point(0,0)); - + buffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst, GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(), new Hashtable()); @@ -507,60 +507,60 @@ public class ComponentGraphics extends CairoGraphics2D else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } - + if (componentBuffer == null) { WritableRaster rst; rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(component.awtComponent.getWidth(), component.awtComponent.getHeight()), new Point(0,0)); - + componentBuffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst, GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(), new Hashtable()); } } - + protected ColorModel getNativeCM() { return GtkVolatileImage.gdkColorModel; } - + /* --- START OVERRIDDEN NATIVE METHODS ---- * All native methods in CairoGraphics2D should be overridden here and * enclosed in locks, since the cairo surface is backed by an X surface * in this graphics context and the X surface requires external locking. - * + * * We lock everything "just in case", since it's difficult to know which * calls are and aren't thread-safe. Overriding and locking the native - * methods allows superclass code in CairoGraphics2D to execute properly, + * methods allows superclass code in CairoGraphics2D to execute properly, * without the need to override every single method. - * + * * CAVEAT: if native code obtains a lock (using gdk_threads_enter(), not the * lock() method provided here) and then calls back into Java and one of these * methods ends up being called, we will deadlock. The lock is only reentrant - * when called via our lock() method. + * when called via our lock() method. */ - + /* These methods are already locked in the superclass CairoGraphics2D * so they do not need to be overridden: - * + * * public void disposeNative * * protected void cairoDrawGlyphVector - * + * * protected void cairoSetFont */ - + @Override protected long init(long pointer) { long ret; - + try { lock(); @@ -570,10 +570,10 @@ public class ComponentGraphics extends CairoGraphics2D { unlock(); } - + return ret; } - + @Override protected void drawPixels(long pointer, int[] pixels, int w, int h, int stride, double[] i2u, double alpha, @@ -590,10 +590,10 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override - protected void setGradient(long pointer, double x1, double y1, - double x2, double y2, + protected void setGradient(long pointer, double x1, double y1, + double x2, double y2, int r1, int g1, int b1, int a1, int r2, int g2, int b2, int a2, boolean cyclic) { @@ -608,7 +608,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void setPaintPixels(long pointer, int[] pixels, int w, int h, int stride, boolean repeat, int x, int y) @@ -623,7 +623,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetMatrix(long pointer, double[] m) { @@ -637,7 +637,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoScale(long pointer, double x, double y) { @@ -651,7 +651,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetOperator(long pointer, int cairoOperator) { @@ -665,7 +665,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetRGBAColor(long pointer, double red, double green, double blue, double alpha) @@ -680,7 +680,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetFillRule(long pointer, int cairoFillRule) { @@ -694,7 +694,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetLine(long pointer, double width, int cap, int join, double miterLimit) @@ -709,9 +709,9 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override - protected void cairoSetDash(long pointer, double[] dashes, int ndash, + protected void cairoSetDash(long pointer, double[] dashes, int ndash, double offset) { try @@ -739,9 +739,9 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override - protected void cairoArc(long pointer, double x, double y, + protected void cairoArc(long pointer, double x, double y, double radius, double angle1, double angle2) { try @@ -754,7 +754,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSave(long pointer) { @@ -768,7 +768,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoRestore(long pointer) { @@ -782,7 +782,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoNewPath(long pointer) { @@ -796,7 +796,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoClosePath(long pointer) { @@ -810,7 +810,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoMoveTo(long pointer, double x, double y) { @@ -824,7 +824,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoLineTo(long pointer, double x, double y) { @@ -838,7 +838,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoCurveTo(long pointer, double x1, double y1, double x2, double y2, double x3, double y3) @@ -853,7 +853,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoStroke(long pointer) { @@ -867,7 +867,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoFill(long pointer, double alpha) { @@ -881,7 +881,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoClip(long pointer) { @@ -895,7 +895,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoResetClip(long pointer) { @@ -909,7 +909,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void cairoSetAntialias(long pointer, boolean aa) { @@ -923,7 +923,7 @@ public class ComponentGraphics extends CairoGraphics2D unlock(); } } - + @Override protected void drawCairoSurface(CairoSurface surface, AffineTransform tx, double alpha, int interpolation) diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java index 2216d45..a73012d 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java @@ -48,7 +48,7 @@ import java.awt.image.RenderedImage; import java.awt.image.ImageObserver; /** - * Implementation of Graphics2D for Components for servers which + * Implementation of Graphics2D for Components for servers which * do not have xrender. * * A mirrored GtkImage of the component is stored in memory @@ -62,17 +62,17 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics * GtkImage sharing its data buffer with this Cairo surface. */ private GtkImage gtkimage; - + private int width, height; native void getPixbuf( GtkComponentPeer component, GtkImage image ); - native void copyPixbuf( GtkComponentPeer component, GtkImage image, - int x, int y, int w, int h ); + native void copyPixbuf( GtkComponentPeer component, GtkImage image, + int x, int y, int w, int h ); - public ComponentGraphicsCopy(int width, int height, - GtkComponentPeer component) - { + public ComponentGraphicsCopy(int width, int height, + GtkComponentPeer component) + { super( new CairoSurface( width, height ) ); this.component = component; this.width = width; @@ -82,7 +82,7 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics } /** - * Overloaded methods that do actual drawing need to enter the gdk threads + * Overloaded methods that do actual drawing need to enter the gdk threads * and also do certain things before and after. */ public void draw(Shape s) @@ -106,7 +106,7 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics } protected boolean drawImage(Image img, AffineTransform xform, - Color bgcolor, ImageObserver obs) + Color bgcolor, ImageObserver obs) { boolean rv = super.drawImage(img, xform, bgcolor, obs); copyPixbuf(component, gtkimage, 0, 0, width, height); @@ -120,4 +120,3 @@ public class ComponentGraphicsCopy extends CairoSurfaceGraphics copyPixbuf(component, gtkimage, r.x, r.y, r.width, r.height); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java b/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java index af975f3..8fd7347 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java @@ -81,7 +81,7 @@ public class FreetypeGlyphVector extends GlyphVector * The glyph codes */ private int[] glyphCodes; - + /** * The set of fonts used in this glyph vector. */ @@ -89,22 +89,22 @@ public class FreetypeGlyphVector extends GlyphVector /** * Glyph transforms. Supports all transform operations. - * + * * The identity transform should not be stored in this array; use a null * instead (will result in performance improvements). */ private AffineTransform[] glyphTransforms; private GlyphMetrics[] metricsCache; - + private native void dispose(long[] fonts); - + /** * Returns a pointer to the native PangoFcFont object. - * + * * The object will be referenced with g_object_ref n times before being * returned, and must be unreferenced a corresponding number of times. - * + * * @param n Number of times to reference the object. * @return Pointer to the native default font. */ @@ -158,19 +158,19 @@ public class FreetypeGlyphVector extends GlyphVector glyphCodes = new int[ codes.length ]; System.arraycopy(codes, 0, glyphCodes, 0, codes.length); nGlyphs = glyphCodes.length; - + if (fontSet == null) { fontSet = new long[nGlyphs]; Arrays.fill(fontSet, getNativeFontPointer(nGlyphs)); } - + performDefaultLayout(); } /** * Cloning constructor - */ + */ private FreetypeGlyphVector( FreetypeGlyphVector gv ) { font = gv.font; @@ -191,7 +191,7 @@ public class FreetypeGlyphVector extends GlyphVector glyphPositions = new float[(nGlyphs + 1) * 2]; glyphTransforms = new AffineTransform[ nGlyphs ]; Arrays.fill(glyphTransforms, null); - + for(int i = 0; i < nGlyphs; i++ ) { if (gv.glyphTransforms[i] != null) @@ -203,7 +203,7 @@ public class FreetypeGlyphVector extends GlyphVector System.arraycopy(gv.glyphCodes, 0, glyphCodes, 0, nGlyphs); System.arraycopy(gv.fontSet, 0, fontSet, 0, nGlyphs); } - + public void finalize() { dispose(fontSet); @@ -247,8 +247,8 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns the kerning of a glyph pair */ - private native void getKerning(int leftGlyph, int rightGlyph, long font, - float[] p); + private native void getKerning(int leftGlyph, int rightGlyph, long font, + float[] p); private native double[] getMetricsNative(int glyphCode, long font); @@ -268,9 +268,9 @@ public class FreetypeGlyphVector extends GlyphVector if( ! (gv instanceof FreetypeGlyphVector) ) return false; - return (((FreetypeGlyphVector)gv).font.equals(font) && - ((FreetypeGlyphVector)gv).frc.equals(frc) - && ((FreetypeGlyphVector)gv).s.equals(s)); + return (((FreetypeGlyphVector)gv).font.equals(font) && + ((FreetypeGlyphVector)gv).frc.equals(frc) + && ((FreetypeGlyphVector)gv).s.equals(s)); } /** @@ -323,19 +323,19 @@ public class FreetypeGlyphVector extends GlyphVector } glyphPositions[nGlyphs * 2] = x; glyphPositions[nGlyphs * 2 + 1] = y; - + // Apply any transform that may be in the font's attributes TransformAttribute ta; ta = (TransformAttribute)font.getAttributes().get(TextAttribute.TRANSFORM); if (ta != null) { AffineTransform tx = ta.getTransform(); - + // Transform glyph positions tx.transform(glyphPositions, 0, glyphPositions, 0, glyphPositions.length / 2); - - // Also store per-glyph scale/shear/rotate (but not translation) + + // Also store per-glyph scale/shear/rotate (but not translation) double[] matrix = new double[4]; tx.getMatrix(matrix); AffineTransform deltaTx = new AffineTransform(matrix); @@ -355,7 +355,7 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns multiple glyphcodes. */ - public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, + public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn) { int[] rval; @@ -364,7 +364,7 @@ public class FreetypeGlyphVector extends GlyphVector rval = new int[ numEntries ]; else rval = codeReturn; - + System.arraycopy(glyphCodes, beginGlyphIndex, rval, 0, numEntries); return rval; @@ -372,10 +372,10 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns pointers to the fonts used in this glyph vector. - * + * * The array index matches that of the glyph vector itself. */ - protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries, + protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries, long[] codeReturn) { long[] rval; @@ -384,7 +384,7 @@ public class FreetypeGlyphVector extends GlyphVector rval = new long[ numEntries ]; else rval = codeReturn; - + System.arraycopy(fontSet, beginGlyphIndex, rval, 0, numEntries); return rval; @@ -394,18 +394,18 @@ public class FreetypeGlyphVector extends GlyphVector { GlyphMetrics gm = getGlyphMetrics( glyphIndex ); if( gm == null ) - return null; + return null; Rectangle2D r = gm.getBounds2D(); Point2D p = getGlyphPosition( glyphIndex ); - + double[] bounds = new double[] {p.getX() + r.getX() - gm.getLSB(), p.getY() + r.getY(), p.getX() + r.getX() - gm.getLSB() + gm.getAdvanceX(), p.getY() + r.getY() + r.getHeight()}; - + if (glyphTransforms[glyphIndex] != null) glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 2); - + return new Rectangle2D.Double(bounds[0], bounds[1], bounds[2] - bounds[0], bounds[3] - bounds[1]); } @@ -428,10 +428,10 @@ public class FreetypeGlyphVector extends GlyphVector gm = null; else { - gm = new GlyphMetrics(true, - (float)val[1], - (float)val[2], - new Rectangle2D.Double(val[3], val[4], + gm = new GlyphMetrics(true, + (float)val[1], + (float)val[2], + new Rectangle2D.Double(val[3], val[4], val[5], val[6] ), GlyphMetrics.STANDARD ); peer.putGlyphMetrics( glyphCodes[ i ], gm ); @@ -454,7 +454,7 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns the outline of a single glyph. - * + * * Despite what the Sun API says, this method returns the glyph relative to * the origin of the *entire string*, not each individual glyph. */ @@ -462,7 +462,7 @@ public class FreetypeGlyphVector extends GlyphVector { GeneralPath gp = getGlyphOutlineNative(glyphCodes[glyphIndex], fontSet[glyphIndex]); - + AffineTransform tx = AffineTransform.getTranslateInstance(glyphPositions[glyphIndex*2], glyphPositions[glyphIndex*2+1]); if (glyphTransforms[glyphIndex] != null) @@ -484,12 +484,12 @@ public class FreetypeGlyphVector extends GlyphVector /** * Returns the positions of multiple glyphs. */ - public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, - float[] positionReturn) + public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, + float[] positionReturn) { if (positionReturn == null || positionReturn.length < (numEntries * 2)) positionReturn = new float[numEntries*2]; - + System.arraycopy(glyphPositions, beginGlyphIndex*2, positionReturn, 0, numEntries*2); return positionReturn; @@ -502,7 +502,7 @@ public class FreetypeGlyphVector extends GlyphVector { return glyphTransforms[glyphIndex]; } - + /** * Checks whether any transform has been set on any glyphs. */ @@ -511,10 +511,10 @@ public class FreetypeGlyphVector extends GlyphVector for (int i = 0; i < glyphTransforms.length; i++) if (glyphTransforms[i] != null) return true; - + return false; } - + /** * Returns the visual bounds of a glyph * May be off by a pixel or two due to hinting/rasterization. @@ -538,7 +538,7 @@ public class FreetypeGlyphVector extends GlyphVector for( int i = 1; i < nGlyphs; i++ ) { Rectangle2D r2 = (Rectangle2D)getGlyphLogicalBounds( i ); - + rect = rect.createUnion( r2 ); } @@ -566,9 +566,9 @@ public class FreetypeGlyphVector extends GlyphVector } /** - * TODO: - * FreeType does not currently have an API for the JSTF table. We should - * probably get the table ourselves from FT and pass it to some parser + * TODO: + * FreeType does not currently have an API for the JSTF table. We should + * probably get the table ourselves from FT and pass it to some parser * which the native font peers will need. */ public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) @@ -615,14 +615,14 @@ public class FreetypeGlyphVector extends GlyphVector // using and checking for nulls can be much faster. if (newTX != null && newTX.isIdentity()) newTX = null; - + // If the old and new transforms are identical, bail if (glyphTransforms[glyphIndex] == null && newTX == null) return; - + if (newTX != null && newTX.equals(glyphTransforms[glyphIndex])) return; - + // Invalidate bounds cache and set new transform logicalBounds = null; glyphTransforms[glyphIndex] = newTX; diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java index 826cfbe..6b09906 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java @@ -78,7 +78,7 @@ public class GdkFontPeer extends ClasspathFontPeer { public GdkFontMetrics (Font font) - { + { super(initFont(font)); } @@ -167,7 +167,7 @@ public class GdkFontPeer extends ClasspathFontPeer GdkFontMetrics metrics; - static + static { if (true) // GCJ LOCAL { @@ -204,7 +204,7 @@ public class GdkFontPeer extends ClasspathFontPeer dispose (); } - /* + /* * Helpers for the 3-way overloading that this class seems to suffer * from. Remove them if you feel like they're a performance bottleneck, * for the time being I prefer my code not be written and debugged in @@ -214,7 +214,7 @@ public class GdkFontPeer extends ClasspathFontPeer private String buildString(CharacterIterator iter) { CPStringBuilder sb = new CPStringBuilder(); - for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) + for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) sb.append(c); return sb.toString(); } @@ -223,7 +223,7 @@ public class GdkFontPeer extends ClasspathFontPeer { CPStringBuilder sb = new CPStringBuilder(); int i = 0; - for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++) + for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++) { if (begin <= i) sb.append(c); @@ -232,7 +232,7 @@ public class GdkFontPeer extends ClasspathFontPeer } return sb.toString(); } - + private String buildString(char[] chars, int begin, int limit) { return new String(chars, begin, limit - begin); @@ -247,8 +247,8 @@ public class GdkFontPeer extends ClasspathFontPeer } public GdkFontPeer (String name, int style, int size) - { - super(name, style, size); + { + super(name, style, size); initState (); setFont (this.familyName, this.style, (int)this.size); metricsCache = new HashMap<Integer,GlyphMetrics>(); @@ -299,14 +299,14 @@ public class GdkFontPeer extends ClasspathFontPeer /** * Unneeded, but implemented anyway. - */ + */ public String getSubFamilyName(Font font, Locale locale) { String name; - + if (locale == null) locale = Locale.getDefault(); - + name = getName(NameDecoder.NAME_SUBFAMILY, locale); if (name == null) { @@ -322,20 +322,20 @@ public class GdkFontPeer extends ClasspathFontPeer * Returns the bytes belonging to a TrueType/OpenType table, * Parameters n,a,m,e identify the 4-byte ASCII tag of the table. * - * Returns null if the font is not TT, the table is nonexistant, + * Returns null if the font is not TT, the table is nonexistant, * or if some other unexpected error occured. * */ private native byte[] getTrueTypeTable(byte n, byte a, byte m, byte e); /** - * Returns the PostScript name of the font, defaults to the familyName if + * Returns the PostScript name of the font, defaults to the familyName if * a PS name could not be retrieved. */ public String getPostScriptName(Font font) { - String name = getName(NameDecoder.NAME_POSTSCRIPT, - /* any language */ null); + String name = getName(NameDecoder.NAME_POSTSCRIPT, + /* any language */ null); if( name == null ) return this.familyName; @@ -356,7 +356,7 @@ public class GdkFontPeer extends ClasspathFontPeer { if (nameTable == null) { - byte[] data = getTrueTypeTable((byte)'n', (byte) 'a', + byte[] data = getTrueTypeTable((byte)'n', (byte) 'a', (byte) 'm', (byte) 'e'); if( data == null ) return null; @@ -378,16 +378,16 @@ public class GdkFontPeer extends ClasspathFontPeer // FIXME: inquire with pango return -1; } - - public GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, + + public GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, CharacterIterator i) { return new FreetypeGlyphVector(font, buildString (i), ctx); } - public GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, + public GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, int[] glyphCodes) { return new FreetypeGlyphVector(font, glyphCodes, ctx); @@ -411,32 +411,32 @@ public class GdkFontPeer extends ClasspathFontPeer { return ascent; } - + public int getBaselineIndex() - { + { // FIXME return Font.ROMAN_BASELINE; } - + public float[] getBaselineOffsets() { return new float[3]; } - + public float getDescent() { return descent; } - + public float getHeight() { return height; } - + public float getLeading() { return height - (ascent + descent); - } + } public int getNumChars() { @@ -447,13 +447,13 @@ public class GdkFontPeer extends ClasspathFontPeer { // FreeType doesn't seem to provide a value here. return ascent / 2; - } + } public float getStrikethroughThickness() { // FreeType doesn't seem to provide a value here. return 1.f; - } + } public float getUnderlineOffset() { @@ -467,7 +467,7 @@ public class GdkFontPeer extends ClasspathFontPeer } - public LineMetrics getLineMetrics (Font font, CharacterIterator ci, + public LineMetrics getLineMetrics (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext rc) { return new GdkFontLineMetrics (this, limit - begin); @@ -490,12 +490,12 @@ public class GdkFontPeer extends ClasspathFontPeer public int getNumGlyphs (Font font) { - byte[] data = getTrueTypeTable((byte)'m', (byte) 'a', - (byte)'x', (byte) 'p'); + byte[] data = getTrueTypeTable((byte)'m', (byte) 'a', + (byte)'x', (byte) 'p'); if( data == null ) return -1; - ByteBuffer buf = ByteBuffer.wrap( data ); + ByteBuffer buf = ByteBuffer.wrap( data ); return buf.getShort(4); } @@ -504,15 +504,15 @@ public class GdkFontPeer extends ClasspathFontPeer return true; } - public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc, - char[] chars, int start, int limit, + public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc, + char[] chars, int start, int limit, int flags) { return new FreetypeGlyphVector(font, chars, start, limit - start, frc, flags); } - public LineMetrics getLineMetrics (Font font, String str, + public LineMetrics getLineMetrics (Font font, String str, FontRenderContext frc) { return new GdkFontLineMetrics (this, str.length ()); @@ -536,7 +536,7 @@ public class GdkFontPeer extends ClasspathFontPeer /** * Put a GlyphMetrics object in the cache. - */ + */ void putGlyphMetrics( int glyphCode, GlyphMetrics metrics ) { metricsCache.put( new Integer( glyphCode ), metrics ); diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java index 147f8f3..40474ff 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java @@ -51,21 +51,21 @@ import java.awt.image.ColorModel; import java.awt.image.DirectColorModel; import java.awt.image.VolatileImage; -public class GdkGraphicsConfiguration +public class GdkGraphicsConfiguration extends GraphicsConfiguration { GdkScreenGraphicsDevice gdkScreenGraphicsDevice; - + ColorModel opaqueColorModel; ColorModel bitmaskColorModel; ColorModel translucentColorModel; - + public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev) { gdkScreenGraphicsDevice = dev; - + opaqueColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0); bitmaskColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0x1000000); translucentColorModel = new DirectColorModel(32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000); @@ -81,7 +81,7 @@ public class GdkGraphicsConfiguration return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); } - public BufferedImage createCompatibleImage(int w, int h, + public BufferedImage createCompatibleImage(int w, int h, int transparency) { return createCompatibleImage(w, h); @@ -137,7 +137,7 @@ public class GdkGraphicsConfiguration public BufferCapabilities getBufferCapabilities() { - return new BufferCapabilities(getImageCapabilities(), + return new BufferCapabilities(getImageCapabilities(), getImageCapabilities(), BufferCapabilities.FlipContents.UNDEFINED); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java index dd62994..d931f44 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java @@ -58,9 +58,9 @@ import gnu.classpath.Pointer; public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment { private final int native_state = GtkGenericPeer.getUniqueInteger (); - + private GdkScreenGraphicsDevice defaultDevice; - + private GdkScreenGraphicsDevice[] devices; /** @@ -81,14 +81,14 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment GtkToolkit.initializeGlobalIDs(); initIDs(); } - + private static native void initIDs(); - + public GdkGraphicsEnvironment () { nativeInitState(); } - + native void nativeInitState(); public GraphicsDevice[] getScreenDevices () @@ -97,17 +97,17 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment { devices = nativeGetScreenDevices(); } - + return (GraphicsDevice[]) devices.clone(); } - + private native GdkScreenGraphicsDevice[] nativeGetScreenDevices(); public GraphicsDevice getDefaultScreenDevice () { if (GraphicsEnvironment.isHeadless ()) throw new HeadlessException (); - + synchronized (GdkGraphicsEnvironment.class) { if (defaultDevice == null) @@ -115,10 +115,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment defaultDevice = nativeGetDefaultScreenDevice(); } } - + return defaultDevice; } - + private native GdkScreenGraphicsDevice nativeGetDefaultScreenDevice(); public Graphics2D createGraphics (BufferedImage image) @@ -129,7 +129,7 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment return new BufferedImageGraphics( image ); } - + private native int nativeGetNumFontFamilies(); private native void nativeGetFontFamilies(String[] family_names); @@ -157,10 +157,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment /** * Used by GtkMouseInfoPeer. - */ + */ native int[] getMouseCoordinates(); native boolean isWindowUnderMouse(GtkWindowPeer windowPeer); - + public WritableRaster createRaster(ColorModel cm, SampleModel sm) { if (CairoSurface.isCompatibleSampleModel(sm) diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java index 9b02695..1b247c6 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java @@ -73,7 +73,7 @@ import gnu.classpath.Pointer; public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder { - static + static { if (true) // GCJ LOCAL { @@ -82,7 +82,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder initStaticState (); } - + /** * Lock that should be held for all gdkpixbuf operations. We don't use * the global gdk_threads_enter/leave functions since gdkpixbuf @@ -124,9 +124,9 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder boolean hasAlpha, GdkPixbufWriter writer); // gdk-pixbuf provids data in RGBA format - static final ColorModel cm = new DirectColorModel (32, 0xff000000, - 0x00ff0000, - 0x0000ff00, + static final ColorModel cm = new DirectColorModel (32, 0xff000000, + 0x00ff0000, + 0x0000ff00, 0x000000ff); public GdkPixbufDecoder (DataInput datainput) { @@ -142,7 +142,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder { super (filename); } - + public GdkPixbufDecoder (URL url) { super (url); @@ -168,21 +168,21 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder ic.setHints (ImageConsumer.RANDOMPIXELORDER); } } - + // called back by native side: area_updated_cb - void areaUpdated (int x, int y, int width, int height, + void areaUpdated (int x, int y, int width, int height, int pixels[], int scansize) { if (curr == null) return; - + for (int i = 0; i < curr.size (); i++) { ImageConsumer ic = (ImageConsumer) curr.elementAt (i); ic.setPixels (x, y, width, height, cm, pixels, 0, scansize); } } - + // called from an async image loader of one sort or another, this method // repeatedly reads bytes from the input stream and passes them through a // GdkPixbufLoader using the native method pumpBytes. pumpBytes in turn @@ -217,7 +217,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder } needsClose = false; - + for (int i = 0; i < curr.size (); i++) { ImageConsumer ic = (ImageConsumer) curr.elementAt (i); @@ -239,7 +239,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public static class ImageFormatSpec { public String name; - public boolean writable = false; + public boolean writable = false; public ArrayList<String> mimeTypes = new ArrayList<String>(); public ArrayList<String> extensions = new ArrayList<String>(); @@ -257,12 +257,12 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public synchronized void addExtension(String e) { extensions.add(e); - } + } } static ArrayList<ImageFormatSpec> imageFormatSpecs; - public static ImageFormatSpec registerFormat(String name, boolean writable) + public static ImageFormatSpec registerFormat(String name, boolean writable) { ImageFormatSpec ifs = new ImageFormatSpec(name, writable); synchronized(GdkPixbufDecoder.class) @@ -277,7 +277,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static String[] getFormatNames(boolean writable) { ArrayList<String> names = new ArrayList<String>(); - synchronized (imageFormatSpecs) + synchronized (imageFormatSpecs) { Iterator<ImageFormatSpec> i = imageFormatSpecs.iterator(); while (i.hasNext()) @@ -287,10 +287,10 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder continue; names.add(ifs.name); - /* + /* * In order to make the filtering code work, we need to register * this type under every "format name" likely to be used as a synonym. - * This generally means "all the extensions people might use". + * This generally means "all the extensions people might use". */ Iterator<String> j = ifs.extensions.iterator(); @@ -304,7 +304,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static String[] getFormatExtensions(boolean writable) { ArrayList<String> extensions = new ArrayList<String>(); - synchronized (imageFormatSpecs) + synchronized (imageFormatSpecs) { Iterator<ImageFormatSpec> i = imageFormatSpecs.iterator(); while (i.hasNext()) @@ -323,7 +323,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder static String[] getFormatMimeTypes(boolean writable) { ArrayList<String> mimeTypes = new ArrayList<String>(); - synchronized (imageFormatSpecs) + synchronized (imageFormatSpecs) { Iterator<ImageFormatSpec> i = imageFormatSpecs.iterator(); while (i.hasNext()) @@ -339,7 +339,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return mimeTypes.toArray(new String[mimeTypes.size()]); } - + static String findFormatName(Object ext, boolean needWritable) { if (ext == null) @@ -361,7 +361,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder if (ifs.name.equals(str)) return str; - Iterator<String> j = ifs.extensions.iterator(); + Iterator<String> j = ifs.extensions.iterator(); while (j.hasNext()) { String extension = j.next(); @@ -369,14 +369,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return ifs.name; } - j = ifs.mimeTypes.iterator(); + j = ifs.mimeTypes.iterator(); while (j.hasNext()) { String mimeType = j.next(); if (mimeType.equals(str)) return ifs.name; } - } + } throw new IllegalArgumentException("unknown extension '" + str + "'"); } @@ -397,7 +397,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return writerSpi; } - public static void registerSpis(IIORegistry reg) + public static void registerSpis(IIORegistry reg) { reg.registerServiceProvider(getReaderSpi(), ImageReaderSpi.class); reg.registerServiceProvider(getWriterSpi(), ImageWriterSpi.class); @@ -405,11 +405,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public static class GdkPixbufWriterSpi extends ImageWriterSpi { - public GdkPixbufWriterSpi() - { + public GdkPixbufWriterSpi() + { super("GdkPixbuf", "2.x", - GdkPixbufDecoder.getFormatNames(true), - GdkPixbufDecoder.getFormatExtensions(true), + GdkPixbufDecoder.getFormatNames(true), + GdkPixbufDecoder.getFormatExtensions(true), GdkPixbufDecoder.getFormatMimeTypes(true), "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriter", new Class[] { ImageOutputStream.class }, @@ -437,11 +437,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder public static class GdkPixbufReaderSpi extends ImageReaderSpi { - public GdkPixbufReaderSpi() - { + public GdkPixbufReaderSpi() + { super("GdkPixbuf", "2.x", - GdkPixbufDecoder.getFormatNames(false), - GdkPixbufDecoder.getFormatExtensions(false), + GdkPixbufDecoder.getFormatNames(false), + GdkPixbufDecoder.getFormatExtensions(false), GdkPixbufDecoder.getFormatMimeTypes(false), "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReader", new Class[] { ImageInputStream.class }, @@ -450,9 +450,9 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder false, null, null, null, null); } - public boolean canDecodeInput(Object obj) - { - return true; + public boolean canDecodeInput(Object obj) + { + return true; } public ImageReader createReaderInstance(Object ext) @@ -489,7 +489,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return null; } - public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, + public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, ImageWriteParam param) { return null; @@ -509,7 +509,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder int height = ras.getHeight(); ColorModel model = image.getColorModel(); int[] pixels = CairoGraphics2D.findSimpleIntegerArray (image.getColorModel(), ras); - + if (pixels == null) { BufferedImage img; @@ -520,7 +520,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder for (int y = 0; y < height; ++y) for (int x = 0; x < width; ++x) img.setRGB(x, y, model.getRGB(ras.getPixel(x, y, pix))); - pixels = CairoGraphics2D.findSimpleIntegerArray (img.getColorModel(), + pixels = CairoGraphics2D.findSimpleIntegerArray (img.getColorModel(), img.getRaster()); model = img.getColorModel(); } @@ -530,7 +530,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder processImageStarted(1); synchronized(pixbufLock) { - streamImage(pixels, this.ext, width, height, model.hasAlpha(), + streamImage(pixels, this.ext, width, height, model.hasAlpha(), this); } synchronized(data) @@ -555,7 +555,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder throw exception; processImageComplete(); - } + } /** * Object marking end of data from native streamImage code. @@ -627,7 +627,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder } } - private static class GdkPixbufReader + private static class GdkPixbufReader extends ImageReader implements ImageConsumer { @@ -638,7 +638,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder int width; int height; String ext; - + public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext) { super(ownerSpi); @@ -658,29 +658,29 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder width = w; height = h; } - + public void setProperties(Hashtable props) {} - public void setColorModel(ColorModel model) + public void setColorModel(ColorModel model) { defaultModel = model; } public void setHints(int flags) {} - public void setPixels(int x, int y, int w, int h, - ColorModel model, byte[] pixels, + public void setPixels(int x, int y, int w, int h, + ColorModel model, byte[] pixels, int offset, int scansize) { - } + } - public void setPixels(int x, int y, int w, int h, - ColorModel model, int[] pixels, + public void setPixels(int x, int y, int w, int h, + ColorModel model, int[] pixels, int offset, int scansize) { if (model == null) model = defaultModel; - + if (bufferedImage == null) { if(model != null && model.hasAlpha()) @@ -709,7 +709,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder processImageProgress(y / (height == 0 ? 1 : height)); } - public void imageComplete(int status) + public void imageComplete(int status) { processImageComplete(); } @@ -729,7 +729,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder return 1; } - public IIOMetadata getImageMetadata(int i) + public IIOMetadata getImageMetadata(int i) { return null; } @@ -748,7 +748,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder vec.add(new ImageTypeSpecifier(img)); return vec.iterator(); } - + public int getHeight(int imageIndex) throws IOException { diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java index d3e9774..2609bad 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkRobotPeer.java @@ -53,9 +53,9 @@ public class GdkRobotPeer implements RobotPeer { // gdk-pixbuf provides data in RGBA format static final ColorModel cm = new DirectColorModel (32, 0xff000000, - 0x00ff0000, - 0x0000ff00, - 0x000000ff); + 0x00ff0000, + 0x0000ff00, + 0x000000ff); public GdkRobotPeer (GraphicsDevice screen) throws AWTException { diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java index 58b5834..1c849df 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java @@ -52,28 +52,28 @@ import gnu.classpath.Pointer; class GdkScreenGraphicsDevice extends GraphicsDevice { private final int native_state = GtkGenericPeer.getUniqueInteger (); - + private Window fullscreenWindow; - + private boolean oldWindowDecorationState; - + private Rectangle oldWindowBounds; - + private Rectangle bounds; - + private GdkGraphicsConfiguration[] configurations; - + /** The <code>GdkGraphicsEnvironment</code> instance that created this * <code>GdkScreenGraphicsDevice</code>. This is only needed for native * methods which need to access the 'native_state' field storing a pointer * to a GdkDisplay object. - */ + */ GdkGraphicsEnvironment env; - + /** An identifier that is created by Gdk */ String idString; - + /** The display modes supported by this <code>GdkScreenGraphicsDevice</code>. * If the array is <code>null</code> <code>nativeGetDisplayModes</code> has * to be called. @@ -85,7 +85,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice * is still <code>null</code> afterwards, the XRandR extension is available * and display mode changes are possible. If it is non-null XRandR is not * available, no display mode changes are possible and no other native - * method must be called. + * method must be called. */ DisplayMode fixedDisplayMode; @@ -107,14 +107,14 @@ class GdkScreenGraphicsDevice extends GraphicsDevice GtkToolkit.initializeGlobalIDs(); initIDs(); } - + static native void initIDs(); - + GdkScreenGraphicsDevice (GdkGraphicsEnvironment e) { super(); env = e; - + configurations = new GdkGraphicsConfiguration[1]; configurations[0] = new GdkGraphicsConfiguration(this); } @@ -126,13 +126,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { fixedDisplayMode = nativeGetFixedDisplayMode(env); } - + /** Depending on the availability of the XRandR extension the method returns * the screens' non-changeable display mode or null, meaning that XRandR can * handle display mode changes. */ native DisplayMode nativeGetFixedDisplayMode(GdkGraphicsEnvironment env); - + public int getType () { // Gdk manages only raster screens. @@ -143,17 +143,17 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { if (idString == null) idString = nativeGetIDString(); - + return idString; } - - private native String nativeGetIDString(); + + private native String nativeGetIDString(); public GraphicsConfiguration[] getConfigurations () { return (GraphicsConfiguration[]) configurations.clone(); } - + public GraphicsConfiguration getDefaultConfiguration () { return configurations[0]; @@ -172,7 +172,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { if (fixedDisplayMode != null) return fixedDisplayMode; - + synchronized (this) { if (displayModes == null) @@ -181,28 +181,28 @@ class GdkScreenGraphicsDevice extends GraphicsDevice int index = nativeGetDisplayModeIndex(env); int rate = nativeGetDisplayModeRate(env); - + return new DisplayMode(displayModes[index].width, displayModes[index].height, DisplayMode.BIT_DEPTH_MULTI, rate); } - + native int nativeGetDisplayModeIndex(GdkGraphicsEnvironment env); - + native int nativeGetDisplayModeRate(GdkGraphicsEnvironment env); - + public DisplayMode[] getDisplayModes() { if (fixedDisplayMode != null) return new DisplayMode[] { fixedDisplayMode }; - + synchronized (this) { if (displayModes == null) displayModes = nativeGetDisplayModes(env); } - + ArrayList<DisplayMode> list = new ArrayList<DisplayMode>(); for(int i=0;i<displayModes.length;i++) for(int j=0;j<displayModes[i].rates.length;j++) @@ -210,10 +210,10 @@ class GdkScreenGraphicsDevice extends GraphicsDevice displayModes[i].height, DisplayMode.BIT_DEPTH_MULTI, displayModes[i].rates[j])); - + return list.toArray(new DisplayMode[list.size()]); } - + native X11DisplayMode[] nativeGetDisplayModes(GdkGraphicsEnvironment env); /** @@ -226,7 +226,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { return true; } - + public boolean isDisplayChangeSupported() { return fixedDisplayMode == null; @@ -236,16 +236,16 @@ class GdkScreenGraphicsDevice extends GraphicsDevice { if (fixedDisplayMode != null) throw new UnsupportedOperationException("Cannnot change display mode."); - + if (dm == null) throw new IllegalArgumentException("DisplayMode must not be null."); - + synchronized (this) { if (displayModes == null) displayModes = nativeGetDisplayModes(env); } - + for (int i=0; i<displayModes.length; i++) if (displayModes[i].width == dm.getWidth() && displayModes[i].height == dm.getHeight()) @@ -255,19 +255,19 @@ class GdkScreenGraphicsDevice extends GraphicsDevice nativeSetDisplayMode(env, i, (short) dm.getRefreshRate()); - + bounds = null; } - + return; } - + throw new IllegalArgumentException("Mode not supported by this device."); } - + native void nativeSetDisplayMode(GdkGraphicsEnvironment env, int index, short rate); - + /** A class that simply encapsulates the X11 display mode data. */ static class X11DisplayMode @@ -275,16 +275,16 @@ class GdkScreenGraphicsDevice extends GraphicsDevice short[] rates; int width; int height; - + X11DisplayMode(int width, int height, short[] rates) { this.width = width; this.height = height; this.rates = rates; } - + } - + public void setFullScreenWindow(Window w) { // Bring old fullscreen window back into its original state. @@ -293,7 +293,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice if (fullscreenWindow instanceof Frame) { // Decoration state can only be switched when the peer is - // non-existent. That means we have to dispose the + // non-existent. That means we have to dispose the // Frame. Frame f = (Frame) fullscreenWindow; if (oldWindowDecorationState != f.isUndecorated()) @@ -302,13 +302,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice f.setUndecorated(oldWindowDecorationState); } } - + fullscreenWindow.setBounds(oldWindowBounds); if (!fullscreenWindow.isVisible()) fullscreenWindow.setVisible(true); } - + // If applicable remove decoration, then maximize the window and // bring it to the foreground. if (w != null) @@ -323,27 +323,27 @@ class GdkScreenGraphicsDevice extends GraphicsDevice f.setUndecorated(true); } } - + oldWindowBounds = w.getBounds(); - + DisplayMode dm = getDisplayMode(); - + w.setBounds(0, 0, dm.getWidth(), dm.getHeight()); - + if (!w.isVisible()) w.setVisible(true); - + w.requestFocus(); w.toFront(); - + } - + fullscreenWindow = w; } - + public Window getFullScreenWindow() { - return fullscreenWindow; + return fullscreenWindow; } Rectangle getBounds() @@ -353,10 +353,10 @@ class GdkScreenGraphicsDevice extends GraphicsDevice if (bounds == null) bounds = nativeGetBounds(); } - + return bounds; } - + native Rectangle nativeGetBounds(); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java index f18db7a..6ff56c0 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkButtonPeer.java @@ -78,7 +78,7 @@ public class GtkButtonPeer extends GtkComponentPeer create (((Button) awtComponent).getLabel ()); } - public void setLabel (String label) + public void setLabel (String label) { gtkSetLabel(label); } @@ -86,8 +86,8 @@ public class GtkButtonPeer extends GtkComponentPeer void postActionEvent (int mods) { q().postEvent (new ActionEvent (awtWidget, - ActionEvent.ACTION_PERFORMED, - ((Button) awtComponent).getActionCommand (), - mods)); + ActionEvent.ACTION_PERFORMED, + ((Button) awtComponent).getActionCommand (), + mods)); } } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java index 4a41d06..6321bc6 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java @@ -66,7 +66,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer public native void addToGroup (long groupPointer); public native void removeFromGroup (); public native void switchToGroup (long groupPointer); - + public native void connectSignals (); /** @@ -101,7 +101,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer { groupPointer = groupMap.get(current_group); } - + if (groupPointer == null) { // We don't know about this group. Create a new native @@ -118,7 +118,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer } currentState = checkbox.getState(); gtkToggleButtonSetActive(currentState); - + String label = checkbox.getLabel(); if (label != null) gtkButtonSetLabel(label); @@ -161,7 +161,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer { groupPointer = groupMap.get(current_group); } - + if (groupPointer == null) { // We don't know about this group. Create a new native @@ -199,14 +199,14 @@ public class GtkCheckboxPeer extends GtkComponentPeer // to the other group. current_group = group; - + // See if the new group is already stored in our map. Long groupPointer = null; synchronized (groupMap) { groupPointer = groupMap.get(current_group); } - + if (groupPointer == null) { // We don't know about this group. Create a new native @@ -236,7 +236,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer state ? ItemEvent.SELECTED : ItemEvent.DESELECTED); } } - + public void addToGroupMap(long groupPointer) { synchronized (groupMap) diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java index ff061d3..59cacf0 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java @@ -47,7 +47,7 @@ public class GtkChoicePeer extends GtkComponentPeer implements ChoicePeer { private int selected; - + public GtkChoicePeer (Choice c) { super (c); @@ -95,7 +95,7 @@ public class GtkChoicePeer extends GtkComponentPeer // Ensure the triggering of an event when removing item zero if zero is the // selected item, even though the selected index doesn't change. if( index == 0 && selected == 0 ) - selected = -1; + selected = -1; nativeRemove( index ); } @@ -104,14 +104,14 @@ public class GtkChoicePeer extends GtkComponentPeer selected = -1; // we do not want to trigger a select event here. nativeRemoveAll(); } - + public void addItem (String item, int position) { add (item, position); } /** - * Callback from the native side on an item-select event, + * Callback from the native side on an item-select event, * which posts an event. The event is only posted if it represents an actual * change. Selected is set to the peer's state initially, so that the * first call to select(int) from the constructor will not trigger an event. @@ -122,7 +122,7 @@ public class GtkChoicePeer extends GtkComponentPeer if( selected != index ) { selected = index; - postItemEvent (((Choice) awtComponent).getItem( selected ), + postItemEvent (((Choice) awtComponent).getItem( selected ), ItemEvent.SELECTED); } } @@ -140,4 +140,3 @@ public class GtkChoicePeer extends GtkComponentPeer ((Choice)awtComponent).select( selected ); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java index e248b6d..4250cab 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkClipboard.java @@ -149,7 +149,7 @@ public class GtkClipboard extends Clipboard * gtk+ clipboard. */ public synchronized void setContents(Transferable contents, - ClipboardOwner owner) + ClipboardOwner owner) { super.setContents(contents, owner); @@ -224,7 +224,7 @@ public class GtkClipboard extends Clipboard boolean text, boolean images, boolean files); - + /** * Called by the gtk+ clipboard when an application has requested * text. Return a string representing the current clipboard diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java index 4b8fc12..6e5069b 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java @@ -95,7 +95,7 @@ public class GtkComponentPeer extends GtkGenericPeer private Rectangle currentPaintArea; /* this isEnabled differs from Component.isEnabled, in that it - knows if a parent is disabled. In that case Component.isEnabled + knows if a parent is disabled. In that case Component.isEnabled may return true, but our isEnabled will always return false */ native boolean isEnabled (); static native boolean modalHasGrab(); @@ -206,13 +206,13 @@ public class GtkComponentPeer extends GtkGenericPeer setEnabled (awtComponent.isEnabled ()); } - public int checkImage (Image image, int width, int height, - ImageObserver observer) + public int checkImage (Image image, int width, int height, + ImageObserver observer) { return getToolkit().checkImage(image, width, height, observer); } - public Image createImage (ImageProducer producer) + public Image createImage (ImageProducer producer) { return new GtkImage (producer); } @@ -222,17 +222,17 @@ public class GtkComponentPeer extends GtkGenericPeer return CairoSurface.getBufferedImage(width, height); } - public void disable () + public void disable () { setEnabled (false); } - public void enable () + public void enable () { setEnabled (true); } - public ColorModel getColorModel () + public ColorModel getColorModel () { return ColorModel.getRGBdefault (); } @@ -249,8 +249,8 @@ public class GtkComponentPeer extends GtkGenericPeer return ComponentGraphics.getComponentGraphics(this); } - public Point getLocationOnScreen () - { + public Point getLocationOnScreen () + { int point[] = new int[2]; if (Thread.currentThread() == GtkMainThread.mainThread) gtkWidgetGetLocationOnScreenUnlocked (point); @@ -259,7 +259,7 @@ public class GtkComponentPeer extends GtkGenericPeer return new Point (point[0], point[1]); } - public Dimension getMinimumSize () + public Dimension getMinimumSize () { return minimumSize (); } @@ -273,7 +273,7 @@ public class GtkComponentPeer extends GtkGenericPeer { return Toolkit.getDefaultToolkit(); } - + public void handleEvent (AWTEvent event) { int id = event.getID(); @@ -375,12 +375,12 @@ public class GtkComponentPeer extends GtkGenericPeer } } - public boolean isFocusTraversable () + public boolean isFocusTraversable () { return true; } - public Dimension minimumSize () + public Dimension minimumSize () { int dim[] = new int[2]; @@ -403,12 +403,12 @@ public class GtkComponentPeer extends GtkGenericPeer } public boolean prepareImage (Image image, int width, int height, - ImageObserver observer) + ImageObserver observer) { return getToolkit().prepareImage(image, width, height, observer); } - public void print (Graphics g) + public void print (Graphics g) { g.drawImage( ComponentGraphics.grab( this ), 0, 0, null ); } @@ -420,7 +420,7 @@ public class GtkComponentPeer extends GtkGenericPeer if (tm <= 0) q().postEvent(new PaintEvent(awtComponent, PaintEvent.UPDATE, - new Rectangle(x, y, width, height))); + new Rectangle(x, y, width, height))); else RepaintTimerTask.schedule(tm, x, y, width, height, awtComponent); } @@ -451,7 +451,7 @@ public class GtkComponentPeer extends GtkGenericPeer } static void schedule(long tm, int x, int y, int width, int height, - Component c) + Component c) { repaintTimer.schedule(new RepaintTimerTask(c, x, y, width, height), tm); } @@ -462,12 +462,12 @@ public class GtkComponentPeer extends GtkGenericPeer assert false: "Call new requestFocus() method instead"; } - public void reshape (int x, int y, int width, int height) + public void reshape (int x, int y, int width, int height) { setBounds (x, y, width, height); } - public void setBackground (Color c) + public void setBackground (Color c) { gtkWidgetSetBackground (c.getRed(), c.getGreen(), c.getBlue()); } @@ -480,7 +480,7 @@ public class GtkComponentPeer extends GtkGenericPeer int new_y = y; Component parent = awtComponent.getParent (); - + // Heavyweight components that are children of one or more // lightweight containers have to be handled specially. Because // calls to GLightweightPeer.setBounds do nothing, GTK has no @@ -491,14 +491,14 @@ public class GtkComponentPeer extends GtkGenericPeer // so we need to continue adding offsets until we reach a // container whose position GTK knows -- that is, the first // non-lightweight. - Insets i; + Insets i; while (parent.isLightweight()) { i = ((Container) parent).getInsets(); - + new_x += parent.getX() + i.left; new_y += parent.getY() + i.top; - + parent = parent.getParent(); } // We only need to convert from Java to GTK coordinates if we're @@ -515,7 +515,7 @@ public class GtkComponentPeer extends GtkGenericPeer int menuBarHeight = 0; if (peer instanceof GtkFramePeer) menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight (); - + new_x -= insets.left; new_y -= insets.top; new_y += menuBarHeight; @@ -533,7 +533,7 @@ public class GtkComponentPeer extends GtkGenericPeer setCursor (awtComponent.getCursor ()); } - public void setCursor (Cursor cursor) + public void setCursor (Cursor cursor) { int x, y; GtkImage image; @@ -572,7 +572,7 @@ public class GtkComponentPeer extends GtkGenericPeer gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize()); } - public void setForeground (Color c) + public void setForeground (Color c) { gtkWidgetSetForeground (c.getRed(), c.getGreen(), c.getBlue()); } @@ -618,7 +618,7 @@ public class GtkComponentPeer extends GtkGenericPeer } protected void postMouseEvent(int id, long when, int mods, int x, int y, - int clickCount, boolean popupTrigger) + int clickCount, boolean popupTrigger) { // It is important to do the getLocationOnScreen() here, instead // of using the old MouseEvent constructors, because @@ -637,7 +637,7 @@ public class GtkComponentPeer extends GtkGenericPeer protected void postMouseWheelEvent(int id, long when, int mods, int x, int y, int clickCount, boolean popupTrigger, - int type, int amount, int rotation) + int type, int amount, int rotation) { q().postEvent(new MouseWheelEvent(awtComponent, id, when, mods, x, y, clickCount, popupTrigger, @@ -692,7 +692,7 @@ public class GtkComponentPeer extends GtkGenericPeer protected void postItemEvent (Object item, int stateChange) { - q().postEvent (new ItemEvent ((ItemSelectable)awtComponent, + q().postEvent (new ItemEvent ((ItemSelectable)awtComponent, ItemEvent.ITEM_STATE_CHANGED, item, stateChange)); } @@ -720,7 +720,7 @@ public class GtkComponentPeer extends GtkGenericPeer return false; } - public boolean requestFocus (Component request, boolean temporary, + public boolean requestFocus (Component request, boolean temporary, boolean allowWindowFocus, long time) { assert request == awtComponent || isLightweightDescendant(request); @@ -840,7 +840,7 @@ public class GtkComponentPeer extends GtkGenericPeer caps.getBackBufferCapabilities()); else throw new AWTException("GtkComponentPeer.createBuffers:" - + " multi-buffering not supported"); + + " multi-buffering not supported"); this.caps = caps; } @@ -860,13 +860,13 @@ public class GtkComponentPeer extends GtkGenericPeer // create new back buffer and clear it to the background color. if (contents == BufferCapabilities.FlipContents.BACKGROUND) - { - backBuffer = createVolatileImage(awtComponent.getWidth(), - awtComponent.getHeight()); - backBuffer.getGraphics().clearRect(0, 0, - awtComponent.getWidth(), - awtComponent.getHeight()); - } + { + backBuffer = createVolatileImage(awtComponent.getWidth(), + awtComponent.getHeight()); + backBuffer.getGraphics().clearRect(0, 0, + awtComponent.getWidth(), + awtComponent.getHeight()); + } // FIXME: support BufferCapabilities.FlipContents.PRIOR } @@ -875,7 +875,7 @@ public class GtkComponentPeer extends GtkGenericPeer { backBuffer.flush(); } - + public String toString () { return "peer of " + awtComponent.toString(); @@ -888,13 +888,13 @@ public class GtkComponentPeer extends GtkGenericPeer public void reparent(ContainerPeer parent) { // FIXME: implement - + } public void setBounds(int x, int y, int width, int height, int z) { // FIXME: implement setBounds (x, y, width, height); - + } public boolean isReparentSupported() { @@ -905,7 +905,7 @@ public class GtkComponentPeer extends GtkGenericPeer public void layout() { // FIXME: implement - + } public boolean requestFocus(Component lightweightChild, boolean temporary, diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java index 541de3d..b7eacb9 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkContainerPeer.java @@ -64,12 +64,12 @@ public class GtkContainerPeer extends GtkComponentPeer { } - public Insets getInsets() + public Insets getInsets() { return insets; } - public Insets insets() + public Insets insets() { return getInsets (); } @@ -103,7 +103,7 @@ public class GtkContainerPeer extends GtkComponentPeer public void setBackground (Color c) { super.setBackground(c); - + Object components[] = ((Container) awtComponent).getComponents(); for (int i = 0; i < components.length; i++) { @@ -133,6 +133,6 @@ public class GtkContainerPeer extends GtkComponentPeer public void restack() { //FIXME: implement - + } } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkCursor.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkCursor.java index eb9e713..e382d63 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkCursor.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkCursor.java @@ -64,7 +64,7 @@ public class GtkCursor extends Cursor { return image; } - + Point getHotspot() { return hotspot; diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java index 1390654..3393eb9 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java @@ -52,7 +52,7 @@ public class GtkDialogPeer extends GtkWindowPeer void create () { Dialog dialog = (Dialog) awtComponent; - + // Create a decorated dialog window. create (GDK_WINDOW_TYPE_HINT_DIALOG, !((Dialog) awtComponent).isUndecorated ()); diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java index 7d5ef91..cddc530 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java @@ -48,7 +48,7 @@ import java.io.FilenameFilter; public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer { static final String FS = System.getProperty("file.separator"); - + private String currentFile = null; private String currentDirectory = null; private FilenameFilter filter; @@ -66,7 +66,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer ((FileDialog) awtComponent).getMode()); FileDialog fd = (FileDialog) awtComponent; - + nativeSetDirectory(System.getProperty("user.dir")); setDirectory(fd.getDirectory()); setFile(fd.getFile()); @@ -136,7 +136,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer nativeSetDirectory(FS); return; } - + // GtkFileChooser requires absolute directory names. If the given directory // name is not absolute, construct it based on current directory if it is not // null. Otherwise, use FS. @@ -175,15 +175,15 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer // called back by native side: handle_response_cb // only called from the GTK thread - void gtkHideFileDialog () + void gtkHideFileDialog () { // hide calls back the peer's setVisible method, so locking is a // problem. ((Dialog) awtComponent).hide(); } - + // called back by native side: handle_response_cb - void gtkDisposeFileDialog () + void gtkDisposeFileDialog () { ((Dialog) awtComponent).dispose(); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java index 87dbd5e..a36854c 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java @@ -130,8 +130,8 @@ public class GtkFramePeer extends GtkWindowPeer setMenuBarWidth (menuBar, menuBarWidth); super.setBounds(x, y, width, height + menuBarHeight); - } - + } + public void setResizable (boolean resizable) { // Call setSize; otherwise when resizable is changed from true to @@ -144,7 +144,7 @@ public class GtkFramePeer extends GtkWindowPeer } protected void postInsetsChangedEvent (int top, int left, - int bottom, int right) + int bottom, int right) { insets.top = top + menuBarHeight; insets.left = left; @@ -174,15 +174,15 @@ public class GtkFramePeer extends GtkWindowPeer native void nativeSetIconImage (GtkImage image); - public void setIconImage (Image image) + public void setIconImage (Image image) { if (image != null) { GtkImage gtkImage; if (image instanceof GtkImage) gtkImage = (GtkImage) image; - else - gtkImage = new GtkImage(image.getSource()); + else + gtkImage = new GtkImage(image.getSource()); if (gtkImage.isLoaded && ! gtkImage.errorLoading) nativeSetIconImage(gtkImage); @@ -236,7 +236,7 @@ public class GtkFramePeer extends GtkWindowPeer public void setBoundsPrivate(int x, int y, int width, int height) { // TODO Auto-generated method stub - + } public boolean requestWindowFocus() @@ -252,5 +252,3 @@ public class GtkFramePeer extends GtkWindowPeer } } - - diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java index 8d63699..1b2c07b 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkGenericPeer.java @@ -109,10 +109,10 @@ public class GtkGenericPeer this.awtWidget = awtWidget; } - protected void postActionEvent (String command, int mods) + protected void postActionEvent (String command, int mods) { - q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, - command, mods)); + q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, + command, mods)); } // Return a unique integer for use in the native state mapping @@ -123,7 +123,7 @@ public class GtkGenericPeer // Let's assume this will never wrap. return next_native_state++; } - + /** * Helper method to set Font for Gtk Widget. */ diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java index 719669e..b0a5aa0 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImage.java @@ -60,7 +60,7 @@ import gnu.classpath.Pointer; * A GdkPixbuf is 'on-screen' and the gdk cannot draw to it, * this is used for the other constructors (and other createImage methods), and * corresponds to the Image implementations returned by the Toolkit.createImage - * methods, and is basically immutable. + * methods, and is basically immutable. * * @author Sven de Marothy */ @@ -79,7 +79,7 @@ public class GtkImage extends Image boolean isLoaded; /** - * Pointer to the GdkPixbuf - + * Pointer to the GdkPixbuf - * don't change the name without changing the native code. */ Pointer pixbuf; @@ -102,7 +102,7 @@ public class GtkImage extends Image /* * The 32-bit AABBGGRR format the GDK uses. */ - static ColorModel nativeModel = new DirectColorModel(32, + static ColorModel nativeModel = new DirectColorModel(32, 0x000000FF, 0x0000FF00, 0x00FF0000, @@ -116,7 +116,7 @@ public class GtkImage extends Image /** * Lock that should be held for all gdkpixbuf operations. We don't use * the global gdk_threads_enter/leave functions in most places since - * most gdkpixbuf operations can be done in parallel to drawing and + * most gdkpixbuf operations can be done in parallel to drawing and * manipulating gtk widgets. */ static Object pixbufLock = new Object(); @@ -170,8 +170,8 @@ public class GtkImage extends Image /** * Constructs a GtkImage from an ImageProducer. Asynchronity is handled in - * the following manner: - * A GtkImageConsumer gets the image data, and calls setImage() when + * the following manner: + * A GtkImageConsumer gets the image data, and calls setImage() when * completely finished. The GtkImage is not considered loaded until the * GtkImageConsumer is completely finished. We go for all "all or nothing". */ @@ -215,7 +215,7 @@ public class GtkImage extends Image throw new IllegalArgumentException("Couldn't load image: " + filename); } - } + } catch(IOException e) { IllegalArgumentException iae; @@ -269,7 +269,7 @@ public class GtkImage extends Image int n = 0; while ((n = bis.read(buf)) != -1) - baos.write(buf, 0, n); + baos.write(buf, 0, n); bis.close(); } catch(IOException e) @@ -361,8 +361,8 @@ public class GtkImage extends Image /** * Callback from the image consumer. */ - public void setImage(int width, int height, - int[] pixels, Hashtable<?,?> properties) + public void setImage(int width, int height, + int[] pixels, Hashtable<?,?> properties) { this.width = width; this.height = height; @@ -392,12 +392,12 @@ public class GtkImage extends Image return width; } - + public synchronized int getHeight (ImageObserver observer) { if (addObserver(observer)) return -1; - + return height; } @@ -405,7 +405,7 @@ public class GtkImage extends Image { if (addObserver(observer)) return UndefinedProperty; - + Object value = props.get (name); return (value == null) ? UndefinedProperty : value; } @@ -426,7 +426,7 @@ public class GtkImage extends Image else return null; } - return new MemoryImageSource(width, height, nativeModel, pixels, + return new MemoryImageSource(width, height, nativeModel, pixels, 0, width); } @@ -438,7 +438,7 @@ public class GtkImage extends Image throw new IllegalAccessError("This method only works for off-screen" +" Images."); } - + /** * Returns a scaled instance of this pixbuf. */ @@ -454,7 +454,7 @@ public class GtkImage extends Image } /** - * If the image is loaded and comes from an ImageProducer, + * If the image is loaded and comes from an ImageProducer, * regenerate the image from there. * * I have no idea if this is ever actually used. Since GtkImage can't be @@ -468,9 +468,9 @@ public class GtkImage extends Image observers = new Vector<ImageObserver>(); isLoaded = false; synchronized(pixbufLock) - { - freePixbuf(); - } + { + freePixbuf(); + } source.startProduction(new GtkImageConsumer(this, source)); } } @@ -510,7 +510,7 @@ public class GtkImage extends Image */ private void deliver() { - int flags = ImageObserver.HEIGHT | + int flags = ImageObserver.HEIGHT | ImageObserver.WIDTH | ImageObserver.PROPERTIES | ImageObserver.ALLBITS; @@ -522,7 +522,7 @@ public class GtkImage extends Image observers = null; } - + /** * Adds an observer, if we need to. * @return true if an observer was added. diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java index 44cfaf9..65cae7a 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkImageConsumer.java @@ -92,11 +92,11 @@ public class GtkImageConsumer implements ImageConsumer public synchronized void setHints (int flags) { // This method informs us in which order the pixels are - // delivered, for progressive-loading support, etc. + // delivered, for progressive-loading support, etc. // Since we wait until it's all loaded, we can ignore the hints. } - public synchronized void setPixels (int x, int y, int width, int height, + public synchronized void setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels, int offset, int scansize) { @@ -158,7 +158,7 @@ public class GtkImageConsumer implements ImageConsumer for (int i = 0; i < pixels.length; i++) ret[i] = pixels[i] & 0xFF; - + return ret; } @@ -167,5 +167,3 @@ public class GtkImageConsumer implements ImageConsumer this.properties = props; } } - - diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java index 76f8e5f..0bdacbf 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkLabelPeer.java @@ -74,7 +74,7 @@ public class GtkLabelPeer extends GtkComponentPeer if (text != null) setNativeText(text); } - + public GtkLabelPeer (Label l) { super (l); diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java index f943a75..b1cc6e5 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkListPeer.java @@ -73,7 +73,7 @@ public class GtkListPeer extends GtkComponentPeer public GtkListPeer (List list) { super (list); - + setMultipleMode (list.isMultipleMode ()); if (list.getItemCount () > 0) @@ -83,20 +83,20 @@ public class GtkListPeer extends GtkComponentPeer native void append (String items[]); public native void add (String item, int index); - + public void addItem (String item, int index) { add (item, index); } - + public void clear () { removeAll (); } - + public native void delItems (int start, int end); public native void deselect (int index); - + public Dimension getMinimumSize (int rows) { return minimumSize (rows); @@ -106,7 +106,7 @@ public class GtkListPeer extends GtkComponentPeer { return preferredSize (rows); } - + public native int[] getSelectedIndexes (); public native void makeVisible (int index); @@ -158,7 +158,7 @@ public class GtkListPeer extends GtkComponentPeer // Double-click only generates an Action event if // something is selected. if (selectedItem != null) - postActionEvent (((List) awtComponent).getSelectedItem (), + postActionEvent (((List) awtComponent).getSelectedItem (), me.getModifiersEx ()); } } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java index 1e37cef..78f6403 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java @@ -60,7 +60,7 @@ public abstract class GtkMenuComponentPeer extends GtkGenericPeer { MenuComponent mc = ((MenuComponent) awtWidget); Font f = mc.getFont(); - + if (f == null) { MenuContainer parent = mc.getParent (); diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java index ff6bdca..c553473 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMenuPeer.java @@ -57,7 +57,7 @@ public class GtkMenuPeer extends GtkMenuItemPeer protected native void create (String label); private native void addItem(MenuItemPeer item, int key, - boolean shiftModifier); + boolean shiftModifier); /** XXX - Document this and the override in GtkPopupMenuPeer. */ native void setupAccelGroup (GtkGenericPeer container); @@ -75,7 +75,7 @@ public class GtkMenuPeer extends GtkMenuItemPeer public GtkMenuPeer (Menu menu) { super (menu); - + if (menu.isTearOff()) addTearOff(); diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java index 7407744..55c9146 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java @@ -49,18 +49,17 @@ import java.awt.peer.MouseInfoPeer; public class GtkMouseInfoPeer implements MouseInfoPeer { private static GdkGraphicsEnvironment gde = new GdkGraphicsEnvironment(); - + public int fillPointWithCoords(Point p) { int[] coords = gde.getMouseCoordinates(); - p.x = coords[1]; + p.x = coords[1]; p.y = coords[2]; return coords[0]; } - + public boolean isWindowUnderMouse(Window w) { return gde.isWindowUnderMouse((GtkWindowPeer) w.getPeer()); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java index e0053f7..00b506c 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPanelPeer.java @@ -59,7 +59,7 @@ public class GtkPanelPeer extends GtkContainerPeer if (id == MouseEvent.MOUSE_PRESSED) awtComponent.requestFocusInWindow(); - + super.handleEvent(event); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java index 4d66a3f..1b0ec8e 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java @@ -60,7 +60,7 @@ public class GtkPopupMenuPeer extends GtkMenuPeer Point abs = origin.getLocationOnScreen (); show (abs.x + x, abs.y + y, 0); } - + public void show (Event e) { diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java index c29706f..d3f160c 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java @@ -50,7 +50,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer Scrollbar sb = (Scrollbar) awtComponent; create (sb.getOrientation (), sb.getValue (), - sb.getMinimum (), sb.getMaximum (), + sb.getMinimum (), sb.getMaximum (), sb.getUnitIncrement (), sb.getBlockIncrement (), sb.getVisibleAmount ()); } @@ -85,7 +85,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer protected void postAdjustmentEvent (int type, int value) { Scrollbar bar = (Scrollbar) awtComponent; - q().postEvent(new AdjustmentEvent(bar, + q().postEvent(new AdjustmentEvent(bar, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, type, value, true)); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java index 967a2ed..78ed696 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkSelection.java @@ -87,7 +87,7 @@ public class GtkSelection implements Transferable * mimeTypesDelivered is true. */ private DataFlavor[] dataFlavors; - + /** * Indicates a requestText() call was made and the corresponding * textAvailable() callback was triggered. @@ -100,7 +100,7 @@ public class GtkSelection implements Transferable * is true. */ private String text; - + /** * Indicates a requestImage() call was made and the corresponding * imageAvailable() callback was triggered. @@ -228,7 +228,7 @@ public class GtkSelection implements Transferable // extra element. ArrayList<DataFlavor> flavorsList = new ArrayList<DataFlavor>(mimeTypes.length + 1); - + for (int i = 0; i < mimeTypes.length; i++) { try @@ -262,7 +262,7 @@ public class GtkSelection implements Transferable npe.printStackTrace(); } } - + dataFlavors = new DataFlavor[flavorsList.size()]; flavorsList.toArray(dataFlavors); } @@ -406,10 +406,10 @@ public class GtkSelection implements Transferable } requestInProgress = false; } - + if (imagePointer != null) image = new GtkImage(imagePointer); - + imagePointer = null; result = image; if (! GtkClipboard.canCache) @@ -572,7 +572,7 @@ public class GtkSelection implements Transferable bytes = null; bytesDelivered = false; requestInProgress = false; - + requestLock.notifyAll(); } return result; diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java index 3b11446..1506565 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java @@ -182,10 +182,10 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit */ initializeGlobalIDs(); - int portableNativeSync; - String portNatSyncProp = + int portableNativeSync; + String portNatSyncProp = System.getProperty("gnu.classpath.awt.gtk.portable.native.sync"); - + if (portNatSyncProp == null) portableNativeSync = -1; // unset else if (Boolean.valueOf(portNatSyncProp).booleanValue()) @@ -204,12 +204,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit public native void beep(); private native void getScreenSizeDimensions(int[] xy); - - public int checkImage (Image image, int width, int height, - ImageObserver observer) + + public int checkImage (Image image, int width, int height, + ImageObserver observer) { - int status = ImageObserver.ALLBITS - | ImageObserver.WIDTH + int status = ImageObserver.ALLBITS + | ImageObserver.WIDTH | ImageObserver.HEIGHT; if (image instanceof GtkImage) @@ -223,17 +223,17 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit -1, -1, image.getWidth (observer), image.getHeight (observer)); - + return status; } - /** + /** * Helper to return either a Image -- the argument -- or a * GtkImage with the errorLoading flag set if the argument is null. */ static Image imageOrError(Image b) { - if (b == null) + if (b == null) return GtkImage.getErrorImage(); else return b; @@ -243,7 +243,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit { if (filename.length() == 0) return new GtkImage (); - + Image image; try { @@ -261,11 +261,11 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new AsyncImage(url); } - public Image createImage (ImageProducer producer) + public Image createImage (ImageProducer producer) { if (producer == null) return null; - + Image image; try { @@ -279,7 +279,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } public Image createImage (byte[] imagedata, int imageoffset, - int imagelength) + int imagelength) { Image image; try @@ -294,13 +294,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } return imageOrError(image); } - + /** * Creates an ImageProducer from the specified URL. The image is assumed - * to be in a recognised format. + * to be in a recognised format. * * @param url URL to read image data from. - */ + */ public ImageProducer createImageProducer(URL url) { return createImage( url ).getSource(); @@ -308,29 +308,29 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit /** * Returns the native color model (which isn't the same as the default - * ARGB color model, but doesn't have to be). + * ARGB color model, but doesn't have to be). */ - public ColorModel getColorModel () + public ColorModel getColorModel () { /* Return the GDK-native ABGR format */ - return new DirectColorModel(32, + return new DirectColorModel(32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); } - public String[] getFontList () + public String[] getFontList () { - return (new String[] { "Dialog", - "DialogInput", - "Monospaced", + return (new String[] { "Dialog", + "DialogInput", + "Monospaced", "Serif", "SansSerif" }); } static class LRUCache<K,V> extends LinkedHashMap<K,V> - { + { int max_entries; public LRUCache(int max) { @@ -347,12 +347,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit new LRUCache<Map,ClasspathFontPeer>(50); private LRUCache<Object,Image> imageCache = new LRUCache<Object,Image>(50); - public FontMetrics getFontMetrics (Font font) + public FontMetrics getFontMetrics (Font font) { return ((GdkFontPeer) font.getPeer()).getFontMetrics(font); } - public Image getImage (String filename) + public Image getImage (String filename) { if (imageCache.containsKey(filename)) return imageCache.get(filename); @@ -364,7 +364,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } } - public Image getImage (URL url) + public Image getImage (URL url) { if (imageCache.containsKey(url)) return imageCache.get(url); @@ -376,7 +376,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } } - public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) + public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) { SecurityManager sm; sm = System.getSecurityManager(); @@ -395,7 +395,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new Dimension(dim[0], dim[1]); } - public Clipboard getSystemClipboard() + public Clipboard getSystemClipboard() { SecurityManager secman = System.getSecurityManager(); if (secman != null) @@ -409,7 +409,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit SecurityManager secman = System.getSecurityManager(); if (secman != null) secman.checkSystemClipboardAccess(); - + return GtkClipboard.getSelectionInstance(); } @@ -417,8 +417,8 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit * Prepares a GtkImage. For every other kind of Image it just * assumes the image is already prepared for rendering. */ - public boolean prepareImage (Image image, int width, int height, - ImageObserver observer) + public boolean prepareImage (Image image, int width, int height, + ImageObserver observer) { /* GtkImages are always prepared, as long as they're loaded. */ if (image instanceof GtkImage) @@ -446,13 +446,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit if (c.getBackground () == null) c.setBackground (cp.getBackground ()); // if (c.getFont () == null) - // c.setFont (cp.getFont ()); - + // c.setFont (cp.getFont ()); + /* Make the Peer reflect the state of the Component */ if (! (c instanceof Window)) { cp.setCursor (c.getCursor ()); - + Rectangle bounds = c.getBounds (); cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height); cp.setVisible (c.isVisible ()); @@ -465,13 +465,13 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkButtonPeer (b); } - protected CanvasPeer createCanvas (Canvas c) + protected CanvasPeer createCanvas (Canvas c) { checkHeadless(); return new GtkCanvasPeer (c); } - protected CheckboxPeer createCheckbox (Checkbox cb) + protected CheckboxPeer createCheckbox (Checkbox cb) { checkHeadless(); return new GtkCheckboxPeer (cb); @@ -483,7 +483,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkCheckboxMenuItemPeer (cmi); } - protected ChoicePeer createChoice (Choice c) + protected ChoicePeer createChoice (Choice c) { checkHeadless(); return new GtkChoicePeer (c); @@ -509,7 +509,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkFramePeer (f); } - protected LabelPeer createLabel (Label label) + protected LabelPeer createLabel (Label label) { checkHeadless(); return new GtkLabelPeer (label); @@ -521,55 +521,55 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkListPeer (list); } - protected MenuPeer createMenu (Menu m) + protected MenuPeer createMenu (Menu m) { checkHeadless(); return new GtkMenuPeer (m); } - protected MenuBarPeer createMenuBar (MenuBar mb) + protected MenuBarPeer createMenuBar (MenuBar mb) { checkHeadless(); return new GtkMenuBarPeer (mb); } - protected MenuItemPeer createMenuItem (MenuItem mi) + protected MenuItemPeer createMenuItem (MenuItem mi) { checkHeadless(); return new GtkMenuItemPeer (mi); } - protected PanelPeer createPanel (Panel p) + protected PanelPeer createPanel (Panel p) { checkHeadless(); return new GtkPanelPeer (p); } - protected PopupMenuPeer createPopupMenu (PopupMenu target) + protected PopupMenuPeer createPopupMenu (PopupMenu target) { checkHeadless(); return new GtkPopupMenuPeer (target); } - protected ScrollPanePeer createScrollPane (ScrollPane sp) + protected ScrollPanePeer createScrollPane (ScrollPane sp) { checkHeadless(); return new GtkScrollPanePeer (sp); } - protected ScrollbarPeer createScrollbar (Scrollbar sb) + protected ScrollbarPeer createScrollbar (Scrollbar sb) { checkHeadless(); return new GtkScrollbarPeer (sb); } - protected TextAreaPeer createTextArea (TextArea ta) + protected TextAreaPeer createTextArea (TextArea ta) { checkHeadless(); return new GtkTextAreaPeer (ta); } - protected TextFieldPeer createTextField (TextField tf) + protected TextFieldPeer createTextField (TextField tf) { checkHeadless(); return new GtkTextFieldPeer (tf); @@ -589,7 +589,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit return new GtkEmbeddedWindowPeer (w); } - /** + /** * @deprecated part of the older "logical font" system in earlier AWT * implementations. Our newer Font class uses getClasspathFontPeer. */ @@ -601,7 +601,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit /** * Private method that allows size to be set at initialization time. */ - private FontPeer getFontPeer (String name, int style, int size) + private FontPeer getFontPeer (String name, int style, int size) { Map<TextAttribute,Object> attrs = new HashMap<TextAttribute,Object>(); ClasspathFontPeer.copyStyleToAttrs (style, attrs); @@ -612,7 +612,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit /** * Newer method to produce a peer for a Font object, even though Sun's * design claims Font should now be peerless, we do not agree with this - * model, hence "ClasspathFontPeer". + * model, hence "ClasspathFontPeer". */ public ClasspathFontPeer getClasspathFontPeer (String name, @@ -634,7 +634,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit } } - protected EventQueue getSystemEventQueueImpl() + protected EventQueue getSystemEventQueueImpl() { synchronized (GtkToolkit.class) { @@ -642,7 +642,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit { q = new EventQueue(); } - } + } return q; } @@ -659,9 +659,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit throw new InvalidDnDOperationException(); return new GtkDragSourceContextPeer(e); } - + public <T extends DragGestureRecognizer> T - createDragGestureRecognizer(Class<T> recognizer, DragSource ds, + createDragGestureRecognizer(Class<T> recognizer, DragSource ds, Component comp, int actions, DragGestureListener l) { @@ -690,7 +690,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit getScreenSizeDimensions(dims); return new Rectangle(0, 0, dims[0], dims[1]); } - + // ClasspathToolkit methods public GraphicsEnvironment getLocalGraphicsEnvironment() @@ -711,14 +711,14 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit public boolean getLockingKeyState(int keyCode) { int state = getLockState(keyCode); - + if (state != -1) return state == 1; - + if (AWTUtilities.isValidKey(keyCode)) throw new UnsupportedOperationException ("cannot get locking state of key code " + keyCode); - + throw new IllegalArgumentException("invalid key code " + keyCode); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java index 8660ced..663839f 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java @@ -65,7 +65,7 @@ public class GtkVolatileImage extends VolatileImage 0x0000FF00, 0x00FF0000, 0xFF000000); - + /** * Don't touch, accessed from native code. */ @@ -76,15 +76,15 @@ public class GtkVolatileImage extends VolatileImage native void destroy(long pointer); native int[] nativeGetPixels(long pointer); - + /** * Gets the pixels in the current image from GDK. - * + * * Note that pixels are in 32-bit RGBA, non-premultiplied, which is different * from Cairo's premultiplied ARGB, which is different from Java's standard * non-premultiplied ARGB. Caution is advised when using this method, to * ensure that the data format remains consistent with what you expect. - * + * * @return the current pixels, as reported by GDK. */ public int[] getPixels() @@ -106,8 +106,8 @@ public class GtkVolatileImage extends VolatileImage nativeDrawVolatile(nativePointer, srcPtr, x, y, w, h); } - public GtkVolatileImage(GtkComponentPeer component, - int width, int height, ImageCapabilities caps) + public GtkVolatileImage(GtkComponentPeer component, + int width, int height, ImageCapabilities caps) { this.width = width; this.height = height; @@ -184,7 +184,7 @@ public class GtkVolatileImage extends VolatileImage { return width; } - + public int getHeight(java.awt.image.ImageObserver observer) { return height; @@ -194,7 +194,7 @@ public class GtkVolatileImage extends VolatileImage { return null; } - + /** * Creates a SampleModel that matches GDK's native format */ diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java index 9744c3a..c8e1bce 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java @@ -119,13 +119,13 @@ public class GtkWindowPeer extends GtkContainerPeer y = awtComponent.getY(); height = awtComponent.getHeight(); width = awtComponent.getWidth(); - + if (!window.isFocusableWindow()) type = GDK_WINDOW_TYPE_HINT_MENU; - + if (parent != null) parent_peer = (GtkWindowPeer) awtComponent.getParent().getPeer(); - + create (type, decorated, parent_peer); } @@ -173,14 +173,14 @@ public class GtkWindowPeer extends GtkContainerPeer public void setBounds (int x, int y, int width, int height) { - if (x != getX() || y != getY() || width != getWidth() + if (x != getX() || y != getY() || width != getWidth() || height != getHeight()) { this.x = x; this.y = y; this.width = width; this.height = height; - + nativeSetBounds (x, y, width - insets.left - insets.right, height - insets.top - insets.bottom); @@ -194,7 +194,7 @@ public class GtkWindowPeer extends GtkContainerPeer // Called from setResizable protected native void setSize (int width, int height); - + /** * Needed by both GtkFramePeer and GtkDialogPeer subclasses, so * implemented here. But never actually called on a GtkWindowPeer @@ -215,7 +215,7 @@ public class GtkWindowPeer extends GtkContainerPeer } protected void postInsetsChangedEvent (int top, int left, - int bottom, int right) + int bottom, int right) { insets.top = top; insets.left = left; @@ -324,8 +324,8 @@ public class GtkWindowPeer extends GtkContainerPeer // insets but GtkFramePeer and GtkDialogPeer insets will be // non-zero. q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT, - new Rectangle (x + insets.left, - y + insets.top, + new Rectangle (x + insets.left, + y + insets.top, width, height))); } @@ -335,7 +335,7 @@ public class GtkWindowPeer extends GtkContainerPeer return false; } - public boolean requestFocus (Component request, boolean temporary, + public boolean requestFocus (Component request, boolean temporary, boolean allowWindowFocus, long time) { assert request == awtComponent || isLightweightDescendant(request); @@ -380,7 +380,7 @@ public class GtkWindowPeer extends GtkContainerPeer return g; } - protected void postMouseEvent(int id, long when, int mods, int x, int y, + protected void postMouseEvent(int id, long when, int mods, int x, int y, int clickCount, boolean popupTrigger) { // Translate AWT co-ordinates, which include a window frame's @@ -388,8 +388,8 @@ public class GtkWindowPeer extends GtkContainerPeer // frame's insets. GtkWindowPeer should always have all-zero // insets but GtkFramePeer and GtkDialogPeer insets will be // non-zero. - super.postMouseEvent (id, when, mods, - x + insets.left, y + insets.top, + super.postMouseEvent (id, when, mods, + x + insets.left, y + insets.top, clickCount, popupTrigger); } diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java index b5858f9..2dfcdbd 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java @@ -108,7 +108,7 @@ public class VolatileImageGraphics extends ComponentGraphics { if (comp == null || comp instanceof AlphaComposite) super.draw(s); - + // Custom composite else { @@ -119,11 +119,11 @@ public class VolatileImageGraphics extends ComponentGraphics g2d.setColor(this.getColor()); g2d.setStroke(this.getStroke()); g2d.draw(s); - + drawComposite(s.getBounds2D(), null); } } - + public void fill(Shape s) { if (comp == null || comp instanceof AlphaComposite) @@ -139,16 +139,16 @@ public class VolatileImageGraphics extends ComponentGraphics g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.fill(s); - + drawComposite(s.getBounds2D(), null); } } - + public void drawGlyphVector(GlyphVector gv, float x, float y) { if (comp == null || comp instanceof AlphaComposite) super.drawGlyphVector(gv, x, y); - + // Custom composite else { @@ -156,11 +156,11 @@ public class VolatileImageGraphics extends ComponentGraphics createBuffer(); Graphics2D g2d = (Graphics2D)buffer.getGraphics(); - + g2d.setPaint(this.getPaint()); g2d.setColor(this.getColor()); g2d.drawGlyphVector(gv, x, y); - + Rectangle2D bounds = gv.getLogicalBounds(); bounds = new Rectangle2D.Double(x + bounds.getX(), y + bounds.getY(), bounds.getWidth(), bounds.getHeight()); @@ -173,7 +173,7 @@ public class VolatileImageGraphics extends ComponentGraphics { if (comp == null || comp instanceof AlphaComposite) return super.drawImage(img, xform, bgcolor, obs); - + // Custom composite else { @@ -186,7 +186,7 @@ public class VolatileImageGraphics extends ComponentGraphics img = Toolkit.getDefaultToolkit().createImage(source); } BufferedImage bImg = (BufferedImage) img; - + // Find dimensions of translation Point2D origin = new Point2D.Double(bImg.getMinX(), bImg.getMinY()); Point2D pt = new Point2D.Double(bImg.getWidth(), bImg.getHeight()); @@ -195,10 +195,10 @@ public class VolatileImageGraphics extends ComponentGraphics origin = xform.transform(origin, origin); pt = xform.transform(pt, pt); } - + // Create buffer and draw image createBuffer(); - + Graphics2D g2d = (Graphics2D)buffer.getGraphics(); g2d.setRenderingHints(this.getRenderingHints()); g2d.drawImage(img, xform, obs); @@ -211,31 +211,31 @@ public class VolatileImageGraphics extends ComponentGraphics obs); } } - + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { if (img instanceof GtkVolatileImage && (comp == null || comp instanceof AlphaComposite)) { - owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, + owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, x, y, - ((GtkVolatileImage)img).width, + ((GtkVolatileImage)img).width, ((GtkVolatileImage)img).height ); return true; - } + } return super.drawImage( img, x, y, observer ); } - + public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { if ((img instanceof GtkVolatileImage) && (comp == null || comp instanceof AlphaComposite)) { - owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, + owner.drawVolatile( ((GtkVolatileImage)img).nativePointer, x, y, width, height ); return true; - } + } return super.drawImage( img, x, y, width, height, observer ); } @@ -243,31 +243,31 @@ public class VolatileImageGraphics extends ComponentGraphics { return new Rectangle2D.Double(0, 0, owner.width, owner.height); } - + private boolean drawComposite(Rectangle2D bounds, ImageObserver observer) { // Clip source to visible areas that need updating Rectangle2D clip = this.getClipBounds(); Rectangle2D.intersect(bounds, clip, bounds); - + BufferedImage buffer2 = buffer; if (!bounds.equals(buffer2.getRaster().getBounds())) buffer2 = buffer2.getSubimage((int)bounds.getX(), (int)bounds.getY(), (int)bounds.getWidth(), (int)bounds.getHeight()); - + // Get current on-screen pixels (destination) and clip to bounds BufferedImage current = owner.getSnapshot(); double[] points = new double[] {bounds.getX(), bounds.getY(), bounds.getMaxX(), bounds.getMaxY()}; transform.transform(points, 0, points, 0, 2); - + Rectangle2D deviceBounds = new Rectangle2D.Double(points[0], points[1], points[2] - points[0], points[3] - points[1]); Rectangle2D.intersect(deviceBounds, this.getClipInDevSpace(), deviceBounds); - + current = current.getSubimage((int)deviceBounds.getX(), (int)deviceBounds.getY(), (int)deviceBounds.getWidth(), @@ -276,7 +276,7 @@ public class VolatileImageGraphics extends ComponentGraphics // Perform actual composite operation compCtx.compose(buffer2.getRaster(), current.getRaster(), buffer2.getRaster()); - + // This MUST call directly into the "action" method in CairoGraphics2D, // not one of the wrappers, to ensure that the composite isn't processed // more than once! @@ -290,7 +290,7 @@ public class VolatileImageGraphics extends ComponentGraphics return rv; } - + private void createBuffer() { if (buffer == null) @@ -299,7 +299,7 @@ public class VolatileImageGraphics extends ComponentGraphics rst = Raster.createWritableRaster(GtkVolatileImage.createGdkSampleModel(owner.width, owner.height), new Point(0,0)); - + buffer = new BufferedImage(GtkVolatileImage.gdkColorModel, rst, GtkVolatileImage.gdkColorModel.isAlphaPremultiplied(), new Hashtable()); @@ -307,12 +307,12 @@ public class VolatileImageGraphics extends ComponentGraphics else { Graphics2D g2d = ((Graphics2D)buffer.getGraphics()); - + g2d.setBackground(new Color(0,0,0,0)); g2d.clearRect(0, 0, buffer.getWidth(), buffer.getHeight()); } } - + protected ColorModel getNativeCM() { // We should really return GtkVolatileImage.gdkColorModel , @@ -323,4 +323,3 @@ public class VolatileImageGraphics extends ComponentGraphics return CairoSurface.cairoCM_pre; } } - diff --git a/libjava/classpath/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java index b3eeb1b..401b895 100644 --- a/libjava/classpath/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java +++ b/libjava/classpath/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java @@ -1,4 +1,4 @@ -/* HeadlessGraphicsEnvironment.java -- A graphics environment for headless mode +/* HeadlessGraphicsEnvironment.java -- A graphics environment for headless mode Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/gnu/java/awt/peer/qt/MainQtThread.java b/libjava/classpath/gnu/java/awt/peer/qt/MainQtThread.java index fdd6da0..bee979a 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/MainQtThread.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/MainQtThread.java @@ -81,6 +81,4 @@ public class MainQtThread extends Thread exec(QApplicationPointer); } -} - - +} diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QMatrix.java b/libjava/classpath/gnu/java/awt/peer/qt/QMatrix.java index 428cda1..ca4d55b 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QMatrix.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QMatrix.java @@ -53,8 +53,8 @@ public class QMatrix extends NativeWrapper init( matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ); } - private native void init(double m00, double m10, double m01, double m11, - double m02, double m12 ); + private native void init(double m00, double m10, double m01, double m11, + double m02, double m12 ); private native double[] getMatrix(); @@ -64,10 +64,9 @@ public class QMatrix extends NativeWrapper } public native void dispose(); - + public void finalize() { dispose(); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QPainterPath.java b/libjava/classpath/gnu/java/awt/peer/qt/QPainterPath.java index 8d176a1..848b104 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QPainterPath.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QPainterPath.java @@ -61,31 +61,31 @@ public class QPainterPath extends NativeWrapper while( !pi.isDone() ) { - switch( pi.currentSegment(coords) ) - { - case PathIterator.SEG_MOVETO: - moveTo( coords[0], coords[1] ); - break; - - case PathIterator.SEG_CLOSE: - close(); - break; - - case PathIterator.SEG_LINETO: - lineTo( coords[0], coords[1] ); - break; - - case PathIterator.SEG_QUADTO: - quadTo( coords[0], coords[1], coords[2], coords[3] ); - break; - - case PathIterator.SEG_CUBICTO: - cubicTo( coords[0], coords[1], - coords[2], coords[3], - coords[4], coords[5] ); - break; - } - pi.next(); + switch( pi.currentSegment(coords) ) + { + case PathIterator.SEG_MOVETO: + moveTo( coords[0], coords[1] ); + break; + + case PathIterator.SEG_CLOSE: + close(); + break; + + case PathIterator.SEG_LINETO: + lineTo( coords[0], coords[1] ); + break; + + case PathIterator.SEG_QUADTO: + quadTo( coords[0], coords[1], coords[2], coords[3] ); + break; + + case PathIterator.SEG_CUBICTO: + cubicTo( coords[0], coords[1], + coords[2], coords[3], + coords[4], coords[5] ); + break; + } + pi.next(); } } @@ -129,13 +129,12 @@ public class QPainterPath extends NativeWrapper private native void quadTo(double x1, double y1, double x2, double y2); private native void cubicTo(double x1, double y1, double x2, double y2, - double x3, double y3); + double x3, double y3); public native void dispose(); - + public void finalize() { dispose(); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QPen.java b/libjava/classpath/gnu/java/awt/peer/qt/QPen.java index ec41015..aee308c 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QPen.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QPen.java @@ -62,10 +62,9 @@ public class QPen extends NativeWrapper private native void init(double width, int cap, int join, double miterlimit); public native void dispose(); - + public void finalize() { dispose(); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtAudioClip.java b/libjava/classpath/gnu/java/awt/peer/qt/QtAudioClip.java index 43387ac..ae2e350 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtAudioClip.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtAudioClip.java @@ -57,9 +57,9 @@ public class QtAudioClip extends NativeWrapper implements AudioClip File f = new File(filename); try { - String fn = f.getCanonicalPath(); - loadClip( fn ); - } + String fn = f.getCanonicalPath(); + loadClip( fn ); + } catch(IOException e) { } @@ -67,7 +67,7 @@ public class QtAudioClip extends NativeWrapper implements AudioClip public QtAudioClip(URL url) { - + } private native void loadClip(String filename); @@ -78,7 +78,7 @@ public class QtAudioClip extends NativeWrapper implements AudioClip /** * Checks that Qt and sound is available. - */ + */ private void checkForQt() { if( t == null ) diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtButtonPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtButtonPeer.java index 629f459..6722eb2 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtButtonPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtButtonPeer.java @@ -62,18 +62,14 @@ public class QtButtonPeer extends QtComponentPeer implements ButtonPeer void fireClick(int modifiers) { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((Button)owner).getActionCommand(), - System.currentTimeMillis(), - modifiers); + ActionEvent.ACTION_PERFORMED, + ((Button)owner).getActionCommand(), + System.currentTimeMillis(), + modifiers); QtToolkit.eventQueue.postEvent(e); } // ************ Public methods ********************* - + public native void setLabel( String label ); } - - - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtCheckboxPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtCheckboxPeer.java index acac5e4..37fb51c 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtCheckboxPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtCheckboxPeer.java @@ -50,18 +50,18 @@ public class QtCheckboxPeer extends QtComponentPeer implements CheckboxPeer // Map QButtonGroup<->CheckboxGroup private static WeakHashMap groupMap; - static + static { groupMap = new WeakHashMap(); } - + public QtCheckboxPeer( QtToolkit kit, Checkbox owner ) { super( kit, owner ); } - + protected native void init(); - + protected void setup() { super.setup(); @@ -73,32 +73,32 @@ public class QtCheckboxPeer extends QtComponentPeer implements CheckboxPeer private void fireToggle(boolean checked) { if (group == null) - ((Checkbox)owner).setState( checked ); + ((Checkbox)owner).setState( checked ); else if ( checked ) - group.setSelectedCheckbox((Checkbox)owner); + group.setSelectedCheckbox((Checkbox)owner); int sel = checked ? ItemEvent.SELECTED : ItemEvent.DESELECTED; - ItemEvent e = new ItemEvent((Checkbox)owner, - ItemEvent.ITEM_STATE_CHANGED, - ((Checkbox)owner).getLabel(), - sel); + ItemEvent e = new ItemEvent((Checkbox)owner, + ItemEvent.ITEM_STATE_CHANGED, + ((Checkbox)owner).getLabel(), + sel); QtToolkit.eventQueue.postEvent(e); } - + // ************ Public methods ********************* - + public void setCheckboxGroup( CheckboxGroup group ) - { - if(this.group == group) + { + if(this.group == group) return; // if we change from a checkbox to a radio button or vice versa if((this.group == null) != (group == null)) { - this.group = group; - callInit(); - setup(); + this.group = group; + callInit(); + setup(); } this.group = group; @@ -109,5 +109,3 @@ public class QtCheckboxPeer extends QtComponentPeer implements CheckboxPeer public native void setState( boolean state ); } - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtChoicePeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtChoicePeer.java index 30674b3..d279468 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtChoicePeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtChoicePeer.java @@ -47,16 +47,16 @@ public class QtChoicePeer extends QtComponentPeer implements ChoicePeer { super( kit, owner ); } - + protected native void init(); protected void setup() { super.setup(); - + Choice c = (Choice) owner; int n = c.getItemCount(); - for ( int i = 0; i < n ; i++ ) + for ( int i = 0; i < n ; i++ ) add( c.getItem( i ), i ); select( c.getSelectedIndex() ); } @@ -64,10 +64,10 @@ public class QtChoicePeer extends QtComponentPeer implements ChoicePeer private void fireChoice( int index ) { ((Choice)owner).select( index ); - ItemEvent e = new ItemEvent((Choice)owner, - ItemEvent.ITEM_STATE_CHANGED, - ((Choice)owner).getItem(index), - ItemEvent.SELECTED); + ItemEvent e = new ItemEvent((Choice)owner, + ItemEvent.ITEM_STATE_CHANGED, + ((Choice)owner).getItem(index), + ItemEvent.SELECTED); QtToolkit.eventQueue.postEvent(e); } @@ -91,5 +91,3 @@ public class QtChoicePeer extends QtComponentPeer implements ChoicePeer public native void select( int index ); } - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtComponentGraphics.java b/libjava/classpath/gnu/java/awt/peer/qt/QtComponentGraphics.java index c5c839e..27e12e6 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtComponentGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtComponentGraphics.java @@ -43,8 +43,8 @@ import java.awt.Graphics; import java.awt.Rectangle; /** - * QtComponentPainter is a Graphics2D context for painting directly to AWT - * components. They require an existing QPainter object (the one passed into + * QtComponentPainter is a Graphics2D context for painting directly to AWT + * components. They require an existing QPainter object (the one passed into * the native paint method), and are created there (ONLY). * * Since this context does direct on-screen drawing it is NOT thread-safe, @@ -63,15 +63,15 @@ public class QtComponentGraphics extends QtGraphics * * @param ptr the pointer to the QPainter object. */ - public QtComponentGraphics(long ptr, QtComponentPeer component, - int x, int y, int w, int h) + public QtComponentGraphics(long ptr, QtComponentPeer component, + int x, int y, int w, int h) { nativeObject = ptr; peer = component; Rectangle r = new Rectangle(x, y, w, h); initialClip = r; - + setAlpha( 1.0 ); Color c = component.owner.getBackground(); if(c == null) @@ -103,11 +103,11 @@ public class QtComponentGraphics extends QtGraphics /** * This is a tricky one - */ - public void copyArea(int x, int y, int width, int height, - int dx, int dy) + */ + public void copyArea(int x, int y, int width, int height, + int dx, int dy) { - // FIXME + // FIXME } /** @@ -117,6 +117,4 @@ public class QtComponentGraphics extends QtGraphics { return peer.getGraphicsConfiguration(); } -} - - +} diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtComponentPeer.java index 334f590..16149b2 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtComponentPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtComponentPeer.java @@ -66,7 +66,7 @@ import java.awt.event.ComponentEvent; // 100% import java.awt.event.FocusEvent; // 100% import java.awt.event.InputEvent; // (abstract) import java.awt.event.KeyEvent; // 2/3 -import java.awt.event.MouseEvent; // 70%? +import java.awt.event.MouseEvent; // 70%? import java.awt.event.PaintEvent; // Yup. import java.awt.event.WindowEvent; // 2/ 12 import java.util.Timer; @@ -117,16 +117,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer this.toolkit = kit; qtApp = QtToolkit.guiThread.QApplicationPointer; nativeObject = 0; - synchronized(this) + synchronized(this) { - callInit(); // Calls the init method FROM THE MAIN THREAD. - try - { - wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + callInit(); // Calls the init method FROM THE MAIN THREAD. + try + { + wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } setup(); hasMotionListeners = false; @@ -147,30 +147,30 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer settingUp = true; if (owner != null) { - if (owner instanceof javax.swing.JComponent) - setBackground(owner.getBackground()); - else - owner.setBackground(getNativeBackground()); - - if (owner.getForeground() != null) - setForeground(owner.getForeground()); - else - setForeground( Color.black ); - - if (owner.getCursor() != null) - if (owner.getCursor().getType() != Cursor.DEFAULT_CURSOR) - setCursor(owner.getCursor()); - - if (owner.getFont() != null) - setFont(owner.getFont()); - - setEnabled( owner.isEnabled() ); - - backBuffer = null; - updateBounds(); - - setVisible( owner.isVisible() ); - QtToolkit.repaintThread.queueComponent(this); + if (owner instanceof javax.swing.JComponent) + setBackground(owner.getBackground()); + else + owner.setBackground(getNativeBackground()); + + if (owner.getForeground() != null) + setForeground(owner.getForeground()); + else + setForeground( Color.black ); + + if (owner.getCursor() != null) + if (owner.getCursor().getType() != Cursor.DEFAULT_CURSOR) + setCursor(owner.getCursor()); + + if (owner.getFont() != null) + setFont(owner.getFont()); + + setEnabled( owner.isEnabled() ); + + backBuffer = null; + updateBounds(); + + setVisible( owner.isVisible() ); + QtToolkit.repaintThread.queueComponent(this); } settingUp = false; } @@ -189,9 +189,9 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer private boolean drawableComponent() { - return ((this instanceof QtContainerPeer && - !(this instanceof QtScrollPanePeer)) || - (this instanceof QtCanvasPeer)); + return ((this instanceof QtContainerPeer && + !(this instanceof QtScrollPanePeer)) || + (this instanceof QtCanvasPeer)); } void updateBounds() @@ -204,19 +204,19 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if(width <= 0 || height <= 0) return; - + if( !drawableComponent() && backBuffer == null) return; if( backBuffer != null ) { - if( width < backBuffer.width && height < backBuffer.height ) - return; - backBuffer.dispose(); + if( width < backBuffer.width && height < backBuffer.height ) + return; + backBuffer.dispose(); } backBuffer = new QtImage(width, height); } - + // ************ Event methods ********************* @@ -227,18 +227,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if (owner instanceof Window) { - WindowEvent e = new WindowEvent((Window)owner, - WindowEvent.WINDOW_CLOSING); - QtToolkit.eventQueue.postEvent(e); + WindowEvent e = new WindowEvent((Window)owner, + WindowEvent.WINDOW_CLOSING); + QtToolkit.eventQueue.postEvent(e); } } protected void enterEvent(int modifiers, int x, int y, int dummy) { - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_ENTERED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, 0, false); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_ENTERED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, 0, false); QtToolkit.eventQueue.postEvent(e); } @@ -257,31 +257,31 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer protected void keyPressEvent(int modifiers, int code, int unicode, int dummy) { KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); - KeyEvent e = new KeyEvent(owner, - KeyEvent.KEY_PRESSED, - System.currentTimeMillis(), - modifiers, code, (char)(unicode & 0xFFFF), - KeyEvent.KEY_LOCATION_UNKNOWN); + KeyEvent e = new KeyEvent(owner, + KeyEvent.KEY_PRESSED, + System.currentTimeMillis(), + modifiers, code, (char)(unicode & 0xFFFF), + KeyEvent.KEY_LOCATION_UNKNOWN); if (!manager.dispatchEvent (e)) QtToolkit.eventQueue.postEvent(e); } protected void keyReleaseEvent(int modifiers, int code, int unicode, int dummy) { - KeyEvent e = new KeyEvent(owner, - KeyEvent.KEY_RELEASED, - System.currentTimeMillis(), - modifiers, code, (char)(unicode & 0xFFFF), - KeyEvent.KEY_LOCATION_UNKNOWN); + KeyEvent e = new KeyEvent(owner, + KeyEvent.KEY_RELEASED, + System.currentTimeMillis(), + modifiers, code, (char)(unicode & 0xFFFF), + KeyEvent.KEY_LOCATION_UNKNOWN); QtToolkit.eventQueue.postEvent(e); } protected void leaveEvent(int modifiers, int x, int y, int dummy) { - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_EXITED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, 0, false); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_EXITED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, 0, false); QtToolkit.eventQueue.postEvent(e); } @@ -291,17 +291,17 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer if( (eventMask & AWTEvent.MOUSE_EVENT_MASK) == 0 ) return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) button = 3; - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_CLICKED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - false, button); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_CLICKED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + false, button); QtToolkit.eventQueue.postEvent(e); } @@ -311,21 +311,21 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == - InputEvent.BUTTON3_DOWN_MASK) button = 3; + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + InputEvent.BUTTON3_DOWN_MASK) button = 3; - int type = (button != 0) ? + int type = (button != 0) ? MouseEvent.MOUSE_DRAGGED :MouseEvent.MOUSE_MOVED; - - MouseEvent e = new MouseEvent(owner, - type, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - false, button); + + MouseEvent e = new MouseEvent(owner, + type, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + false, button); QtToolkit.eventQueue.postEvent(e); } @@ -334,18 +334,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer if( (eventMask & AWTEvent.MOUSE_EVENT_MASK) == 0 ) return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) button = 3; - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_PRESSED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - ( button == POPUP_TRIGGER ), - button); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_PRESSED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + ( button == POPUP_TRIGGER ), + button); QtToolkit.eventQueue.postEvent(e); } @@ -354,18 +354,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer if( (eventMask & AWTEvent.MOUSE_EVENT_MASK) == 0 ) return; int button = 0; - if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) button = 1; - if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON2_DOWN_MASK) == InputEvent.BUTTON2_DOWN_MASK) button = 2; - if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == + if((modifiers & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK) button = 3; - MouseEvent e = new MouseEvent(owner, - MouseEvent.MOUSE_RELEASED, - System.currentTimeMillis(), - (modifiers & 0x2FF), x, y, clickCount, - false, button); + MouseEvent e = new MouseEvent(owner, + MouseEvent.MOUSE_RELEASED, + System.currentTimeMillis(), + (modifiers & 0x2FF), x, y, clickCount, + false, button); QtToolkit.eventQueue.postEvent(e); } @@ -373,16 +373,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if( !ignoreResize ) { - // Since Component.setLocation calls back to setBounds, - // we need to ignore that. - ignoreResize = true; - owner.setLocation( x, y ); - ignoreResize = false; + // Since Component.setLocation calls back to setBounds, + // we need to ignore that. + ignoreResize = true; + owner.setLocation( x, y ); + ignoreResize = false; } } - protected void resizeEvent(int oldWidth, int oldHeight, - int width, int height) + protected void resizeEvent(int oldWidth, int oldHeight, + int width, int height) { if(!(owner instanceof Window)) return; @@ -390,8 +390,8 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer ignoreResize = true; owner.setSize(width, height); ignoreResize = false; - ComponentEvent e = new ComponentEvent(owner, - ComponentEvent.COMPONENT_RESIZED); + ComponentEvent e = new ComponentEvent(owner, + ComponentEvent.COMPONENT_RESIZED); QtToolkit.eventQueue.postEvent(e); QtToolkit.repaintThread.queueComponent(this); } @@ -400,22 +400,22 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { if (owner instanceof Window) { - WindowEvent e = new WindowEvent((Window)owner, - WindowEvent.WINDOW_OPENED); - QtToolkit.eventQueue.postEvent(e); + WindowEvent e = new WindowEvent((Window)owner, + WindowEvent.WINDOW_OPENED); + QtToolkit.eventQueue.postEvent(e); } - else + else { - ComponentEvent e = new ComponentEvent(owner, - ComponentEvent.COMPONENT_SHOWN); - QtToolkit.eventQueue.postEvent(e); + ComponentEvent e = new ComponentEvent(owner, + ComponentEvent.COMPONENT_SHOWN); + QtToolkit.eventQueue.postEvent(e); } } protected void hideEvent() { - ComponentEvent e = new ComponentEvent(owner, - ComponentEvent.COMPONENT_HIDDEN); + ComponentEvent e = new ComponentEvent(owner, + ComponentEvent.COMPONENT_HIDDEN); QtToolkit.eventQueue.postEvent(e); } @@ -431,18 +431,18 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public boolean canDetermineObscurity() { return true; - } + } public int checkImage(Image img, - int w, - int h, - ImageObserver o) + int w, + int h, + ImageObserver o) { return toolkit.checkImage(img, w, h, o); } public void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException + throws AWTException { // FIXME } @@ -516,9 +516,9 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public Graphics getGraphics() { if( backBuffer == null ) - { - Rectangle r = owner.getBounds(); - backBuffer = new QtImage( r.width, r.height ); + { + Rectangle r = owner.getBounds(); + backBuffer = new QtImage( r.width, r.height ); } return backBuffer.getDirectGraphics( this ); } @@ -533,16 +533,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public Point getLocationOnScreen() { Point p = new Point(); - synchronized( p ) + synchronized( p ) { - getLocationOnScreenNative( p ); - try - { - p.wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + getLocationOnScreenNative( p ); + try + { + p.wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } return p; } @@ -552,16 +552,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer private Dimension getSize(boolean preferred) { Dimension d = new Dimension(); - synchronized( d ) + synchronized( d ) { - getSizeNative(d, preferred); - try - { - d.wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + getSizeNative(d, preferred); + try + { + d.wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } return d; } @@ -570,7 +570,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer { return getSize( false ); } - + public Dimension getPreferredSize() { return getSize( true ); @@ -582,7 +582,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer } public native boolean handlesWheelScrolling(); - + public void hide() { setVisible(false); @@ -610,17 +610,17 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public native void requestFocus(); - public boolean requestFocus (Component source, boolean bool1, - boolean bool2, long x) + public boolean requestFocus (Component source, boolean bool1, + boolean bool2, long x) { // FIXME return true; } public void reshape(int x, - int y, - int width, - int height) + int y, + int width, + int height) { setBounds( x, y, width, height ); } @@ -662,7 +662,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer return; setGround(c.getRed(), c.getGreen(), c.getBlue(), true); } - + public native void setVisible(boolean b); public void show() @@ -678,71 +678,71 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer switch (eventID) { case ComponentEvent.COMPONENT_SHOWN: - QtToolkit.repaintThread.queueComponent(this); + QtToolkit.repaintThread.queueComponent(this); break; case PaintEvent.PAINT: - case PaintEvent.UPDATE: - r = ((PaintEvent)e).getUpdateRect(); - QtToolkit.repaintThread.queueComponent(this, r.x, r.y, - r.width, r.height); + case PaintEvent.UPDATE: + r = ((PaintEvent)e).getUpdateRect(); + QtToolkit.repaintThread.queueComponent(this, r.x, r.y, + r.width, r.height); break; case KeyEvent.KEY_PRESSED: - break; + break; case KeyEvent.KEY_RELEASED: - break; + break; } } /** * paint() is called back from the native side in response to a native * repaint event. - */ + */ public void paint(Graphics g) { Rectangle r = g.getClipBounds(); if (backBuffer != null) - backBuffer.drawPixelsScaledFlipped ((QtGraphics) g, - 0, 0, 0, /* bg colors */ - false, false, /* no flipping */ - r.x, r.y, r.width, r.height, - r.x, r.y, r.width, r.height, - false ); /* no compositing */ + backBuffer.drawPixelsScaledFlipped ((QtGraphics) g, + 0, 0, 0, /* bg colors */ + false, false, /* no flipping */ + r.x, r.y, r.width, r.height, + r.x, r.y, r.width, r.height, + false ); /* no compositing */ } public void paintBackBuffer() throws InterruptedException { if( backBuffer != null ) { - backBuffer.clear(); - Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); - owner.paint(bbg); - bbg.dispose(); + backBuffer.clear(); + Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); + owner.paint(bbg); + bbg.dispose(); } } - public void paintBackBuffer(int x, int y, int w, int h) + public void paintBackBuffer(int x, int y, int w, int h) throws InterruptedException { if( backBuffer != null ) { - Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); - bbg.setBackground( getNativeBackground() ); - bbg.clearRect(x, y, w, h); - bbg.setClip(x, y, w, h); - owner.paint(bbg); - bbg.dispose(); + Graphics2D bbg = (Graphics2D)backBuffer.getGraphics(); + bbg.setBackground( getNativeBackground() ); + bbg.clearRect(x, y, w, h); + bbg.setClip(x, y, w, h); + owner.paint(bbg); + bbg.dispose(); } } public boolean prepareImage(Image img, - int w, - int h, - ImageObserver o) + int w, + int h, + ImageObserver o) { return toolkit.prepareImage(img, w, h, o); } - + public void print(Graphics g) { // FIXME @@ -752,16 +752,16 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer * Schedules a timed repaint. */ public void repaint(long tm, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { if( tm <= 0 ) { - QtToolkit.repaintThread.queueComponent(this, x, y, w, h); - return; - } + QtToolkit.repaintThread.queueComponent(this, x, y, w, h); + return; + } Timer t = new Timer(); t.schedule(new RepaintTimerTask(this, x, y, w, h), tm); } @@ -778,20 +778,20 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer /** * Timed repainter */ - private class RepaintTimerTask extends TimerTask - { + private class RepaintTimerTask extends TimerTask + { private int x, y, w, h; private QtComponentPeer peer; RepaintTimerTask(QtComponentPeer peer, int x, int y, int w, int h) - { + { this.x=x; this.y=y; this.w=w; - this.h=h; + this.h=h; this.peer=peer; } public void run() - { + { QtToolkit.repaintThread.queueComponent(peer, x, y, w, h); } } @@ -808,7 +808,7 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer public void setBounds(int x, int y, int width, int height, int z) { // TODO Auto-generated method stub - + } public boolean isReparentSupported() diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtContainerPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtContainerPeer.java index ec04b05..ee28737 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtContainerPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtContainerPeer.java @@ -60,13 +60,13 @@ public class QtContainerPeer extends QtComponentPeer implements ContainerPeer // ************ Public methods ********************* public void beginLayout() { - // FIXME + // FIXME } public void beginValidate() { } - + public void endLayout() { QtUpdate(); @@ -75,7 +75,7 @@ public class QtContainerPeer extends QtComponentPeer implements ContainerPeer public void endValidate() { } - + public Insets getInsets() { return new Insets(0, 0, 0, 0); @@ -101,15 +101,12 @@ public class QtContainerPeer extends QtComponentPeer implements ContainerPeer public void cancelPendingPaint(int x, int y, int width, int height) { // TODO Auto-generated method stub - + } public void restack() { // TODO Auto-generated method stub - + } } - - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtDialogPeer.java index 23e5c06..2f2c255 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtDialogPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtDialogPeer.java @@ -68,6 +68,6 @@ public class QtDialogPeer extends QtWindowPeer implements DialogPeer public void setBounds(int x, int y, int width, int height) { setBoundsNative(x, y, width, height, - !((Dialog)owner).isResizable()); + !((Dialog)owner).isResizable()); } } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java index 0f859b7..de76cd1 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java @@ -40,7 +40,7 @@ package gnu.java.awt.peer.qt; import java.awt.Component; import gnu.java.awt.peer.EmbeddedWindowPeer; -/** +/** * Embedded window peer for applets. * FIXME: EmbeddedWindowPeer and this class should extend Window, NOT Frame. */ @@ -50,7 +50,7 @@ public class QtEmbeddedWindowPeer extends QtFramePeer implements EmbeddedWindowP { super( kit, owner ); } - + protected native void init(); protected void setup() diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtFileDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtFileDialogPeer.java index 4937031..06943d9 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtFileDialogPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtFileDialogPeer.java @@ -81,4 +81,3 @@ public class QtFileDialogPeer extends QtDialogPeer implements FileDialogPeer // FIXME } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtFontMetrics.java b/libjava/classpath/gnu/java/awt/peer/qt/QtFontMetrics.java index 3b182b5..1998339 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtFontMetrics.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtFontMetrics.java @@ -93,7 +93,7 @@ public class QtFontMetrics extends FontMetrics native Rectangle2D getStringBounds(String s); // ****************** Package private *************************** - + native boolean canDisplay( int c ); // ****************** Public methods **************************** diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtFontPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtFontPeer.java index bd16daf..03ed1d2 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtFontPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtFontPeer.java @@ -103,17 +103,17 @@ public class QtFontPeer extends ClasspathFontPeer return metrics.canDisplay( c ); } - public int canDisplayUpTo (Font font, CharacterIterator i, - int start, int limit) + public int canDisplayUpTo (Font font, CharacterIterator i, + int start, int limit) { int index = start; char c = i.setIndex( index ); while( index <= limit ) { - if(!canDisplay(font, c)) - return index; - index++; - c = i.next(); + if(!canDisplay(font, c)) + return index; + index++; + c = i.next(); } return -1; } @@ -149,23 +149,23 @@ public class QtFontPeer extends ClasspathFontPeer } public GlyphVector createGlyphVector (Font font, - FontRenderContext frc, - CharacterIterator ci) + FontRenderContext frc, + CharacterIterator ci) { throw new UnsupportedOperationException(); } - public GlyphVector createGlyphVector (Font font, - FontRenderContext ctx, - int[] glyphCodes) + public GlyphVector createGlyphVector (Font font, + FontRenderContext ctx, + int[] glyphCodes) { throw new UnsupportedOperationException(); } - public GlyphVector layoutGlyphVector (Font font, - FontRenderContext frc, - char[] chars, int start, - int limit, int flags) + public GlyphVector layoutGlyphVector (Font font, + FontRenderContext frc, + char[] chars, int start, + int limit, int flags) { throw new UnsupportedOperationException(); } @@ -180,16 +180,16 @@ public class QtFontPeer extends ClasspathFontPeer throw new UnsupportedOperationException(); } - public LineMetrics getLineMetrics (Font font, - CharacterIterator ci, - int begin, int limit, - FontRenderContext rc) + public LineMetrics getLineMetrics (Font font, + CharacterIterator ci, + int begin, int limit, + FontRenderContext rc) { throw new UnsupportedOperationException(); } - public Rectangle2D getMaxCharBounds (Font font, - FontRenderContext rc) + public Rectangle2D getMaxCharBounds (Font font, + FontRenderContext rc) { throw new UnsupportedOperationException(); } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtFramePeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtFramePeer.java index e3b5789..d516210 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtFramePeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtFramePeer.java @@ -75,7 +75,7 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer private native int menuBarHeight(); // ************ Public methods ********************* - + public void destroy() { dispose(); @@ -83,13 +83,13 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer public int getState() { - // FIXME + // FIXME return theState; } public Insets getInsets() { - int mbHeight = ( ((Frame)owner).getMenuBar() != null ) ? + int mbHeight = ( ((Frame)owner).getMenuBar() != null ) ? menuBarHeight() : 0; return new Insets(mbHeight, 0, 0, 0); } @@ -98,30 +98,30 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer { if (im instanceof QtImage) setIcon( (QtImage)im ); - else + else setIcon( new QtImage( im.getSource() ) ); } public void setMaximizedBounds(Rectangle rect) { // FIXME - } + } public void setMenuBar(MenuBar mb) { if( mb != null ) { - QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer(); - if( mbpeer == null ) - { - mb.addNotify(); - mbpeer = (QtMenuBarPeer)mb.getPeer(); - if( mbpeer == null ) - throw new IllegalStateException("No menu bar peer."); - } - mbpeer.addMenus(); - setMenu( mbpeer ); - } + QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer(); + if( mbpeer == null ) + { + mb.addNotify(); + mbpeer = (QtMenuBarPeer)mb.getPeer(); + if( mbpeer == null ) + throw new IllegalStateException("No menu bar peer."); + } + mbpeer.addMenus(); + setMenu( mbpeer ); + } else setMenu( null ); } @@ -140,13 +140,13 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer public void setBoundsPrivate(int x, int y, int width, int height) { // TODO Auto-generated method stub - + } public void updateAlwaysOnTop() { // TODO Auto-generated method stub - + } public boolean requestWindowFocus() diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtGraphics.java b/libjava/classpath/gnu/java/awt/peer/qt/QtGraphics.java index 5694e8d..f68cc0d 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtGraphics.java @@ -75,7 +75,7 @@ import java.util.Map; /** * QtGraphics is an abstract implementation of Graphics2D over a QPainter - * object. This is to be subclassed for different drawing contexts, + * object. This is to be subclassed for different drawing contexts, * which may have different requirements. */ public abstract class QtGraphics extends Graphics2D @@ -100,9 +100,9 @@ public abstract class QtGraphics extends Graphics2D protected Paint currentPaint; // current paint protected RenderingHints renderingHints; // the rendering hints. - /** + /** * Owner Graphics, used by subcontext created by create() - * to avoid GC of the original context. + * to avoid GC of the original context. */ Graphics parent; @@ -154,12 +154,12 @@ public abstract class QtGraphics extends Graphics2D { AffineTransform current = getTransform(); setTransform( identity ); - setClip( initialClip ); + setClip( initialClip ); setTransform( current ); } - protected native void initImage(QtImage image); - protected native void initVolatileImage(QtVolatileImage image); + protected native void initImage(QtImage image); + protected native void initVolatileImage(QtVolatileImage image); // Creates a new native QPainter object on the same context. private native void cloneNativeContext( QtGraphics parent ); @@ -174,10 +174,10 @@ public abstract class QtGraphics extends Graphics2D private native void setNativeStroke(QPen p); private native void setNativeComposite(int alphaMode); private native void drawStringNative(String string, double x, double y); - private native void setLinearGradient(int r1, int g1, int b1, - int r2, int g2, int b2, - double x1, double y1, - double x2, double y2, boolean cyclic); + private native void setLinearGradient(int r1, int g1, int b1, + int r2, int g2, int b2, + double x1, double y1, + double x2, double y2, boolean cyclic); private native void setAlphaNative(double alpha); private native void setFontNative(QtFontPeer font); private native QPainterPath getClipNative(); @@ -195,8 +195,8 @@ public abstract class QtGraphics extends Graphics2D */ public abstract Graphics create(); - public abstract void copyArea(int x, int y, int width, int height, - int dx, int dy); + public abstract void copyArea(int x, int y, int width, int height, + int dx, int dy); public abstract GraphicsConfiguration getDeviceConfiguration(); @@ -210,7 +210,7 @@ public abstract class QtGraphics extends Graphics2D { if( c == null ) c = Color.white; - this.color = c; + this.color = c; int alpha = (int)(c.getAlpha() * currentAlpha); setColor(c.getRed(), c.getGreen(), c.getBlue(), alpha); } @@ -238,15 +238,15 @@ public abstract class QtGraphics extends Graphics2D { if( onStroke ) { - Shape stroked = currentStroke.createStrokedShape( s ); - return stroked.intersects( (double)rect.x, (double)rect.y, - (double)rect.width, (double)rect.height ); + Shape stroked = currentStroke.createStrokedShape( s ); + return stroked.intersects( (double)rect.x, (double)rect.y, + (double)rect.width, (double)rect.height ); } - return s.intersects( (double)rect.x, (double)rect.y, - (double)rect.width, (double)rect.height ); + return s.intersects( (double)rect.x, (double)rect.y, + (double)rect.width, (double)rect.height ); } - // ******************* Font *********************** + // ******************* Font *********************** public Font getFont() { return font; @@ -287,7 +287,7 @@ public abstract class QtGraphics extends Graphics2D } public Shape getClip() - { + { return getClipNative().getPath(); } @@ -307,7 +307,7 @@ public abstract class QtGraphics extends Graphics2D // ***************** Drawing primitives ********************* public void draw(Shape s) - { + { if( nativeStroking ) drawNative( new QPainterPath(s) ); else @@ -330,14 +330,14 @@ public abstract class QtGraphics extends Graphics2D public void drawRect(int x, int y, int width, int height) { if( nativeStroking ) - drawNative( new QPainterPath((double)x, (double)y, - (double)width, (double)height) ); + drawNative( new QPainterPath((double)x, (double)y, + (double)width, (double)height) ); else fillNative( new QPainterPath - ( currentStroke.createStrokedShape - (new Rectangle2D.Double - ((double)x, (double)y, - (double)width, (double)height) ) ) ); + ( currentStroke.createStrokedShape + (new Rectangle2D.Double + ((double)x, (double)y, + (double)width, (double)height) ) ) ); } public void fillRect(int x, int y, int width, int height) @@ -353,24 +353,24 @@ public abstract class QtGraphics extends Graphics2D setColor( c ); } - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void drawRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { - draw( new RoundRectangle2D.Double(x, y, width, height, - arcWidth, arcHeight) ); + draw( new RoundRectangle2D.Double(x, y, width, height, + arcWidth, arcHeight) ); } - public void fillRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void fillRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { - fill( new RoundRectangle2D.Double(x, y, width, height, - arcWidth, arcHeight) ); + fill( new RoundRectangle2D.Double(x, y, width, height, + arcWidth, arcHeight) ); } public void drawOval(int x, int y, int width, int height) { - draw( new Ellipse2D.Double((double)x, (double)y, - (double)width, (double)height) ); + draw( new Ellipse2D.Double((double)x, (double)y, + (double)width, (double)height) ); } public void fillOval(int x, int y, int width, int height) @@ -378,18 +378,18 @@ public abstract class QtGraphics extends Graphics2D fill( new Ellipse2D.Double(x, y, width, height) ); } - public void drawArc(int x, int y, int width, int height, - int arcStart, int arcAngle) + public void drawArc(int x, int y, int width, int height, + int arcStart, int arcAngle) { - draw( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, - Arc2D.OPEN) ); + draw( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, + Arc2D.OPEN) ); } - public void fillArc(int x, int y, int width, int height, - int arcStart, int arcAngle) + public void fillArc(int x, int y, int width, int height, + int arcStart, int arcAngle) { - fill( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, - Arc2D.CHORD) ); + fill( new Arc2D.Double(x, y, width, height, arcStart, arcAngle, + Arc2D.CHORD) ); } public void drawPolyline(int xPoints[], int yPoints[], int npoints) @@ -428,17 +428,17 @@ public abstract class QtGraphics extends Graphics2D { // FIXME - to something more correct ? String s = ""; - for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) + for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) s += c; drawString(s, x, y); } - public void drawString(AttributedCharacterIterator ci, - float x, float y) + public void drawString(AttributedCharacterIterator ci, + float x, float y) { // FIXME - to something more correct ? String s = ""; - for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) + for(char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) s += c; drawString(s, x, y); } @@ -450,68 +450,68 @@ public abstract class QtGraphics extends Graphics2D // ******************* Image drawing ****************************** public boolean drawImage(Image image, - AffineTransform Tx, - ImageObserver obs) + AffineTransform Tx, + ImageObserver obs) { if (image instanceof QtImage) return ((QtImage)image).drawImage(this, new QMatrix( Tx ), obs); - return (new QtImage(image.getSource())).drawImage(this, - new QMatrix( Tx ), - obs); + return (new QtImage(image.getSource())).drawImage(this, + new QMatrix( Tx ), + obs); } - public boolean drawImage(Image image, int x, int y, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, Color bgcolor, + ImageObserver observer) { if (image instanceof QtImage) return ((QtImage)image).drawImage (this, x, y, bgcolor, observer); - return (new QtImage(image.getSource())).drawImage (this, x, y, - bgcolor, observer); + return (new QtImage(image.getSource())).drawImage (this, x, y, + bgcolor, observer); } - public boolean drawImage(Image image, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image image, + int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { if (image instanceof QtImage) - return ((QtImage)image).drawImage(this, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, bgcolor, observer); + return ((QtImage)image).drawImage(this, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, bgcolor, observer); - return (new QtImage(image.getSource())).drawImage(this, dx1, dy1, - dx2, dy2, - sx1, sy1, sx2, sy2, - bgcolor, observer); + return (new QtImage(image.getSource())).drawImage(this, dx1, dy1, + dx2, dy2, + sx1, sy1, sx2, sy2, + bgcolor, observer); } - public boolean drawImage(Image image, int x, int y, - int width, int height, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, + int width, int height, Color bgcolor, + ImageObserver observer) { if (image instanceof QtImage) - return ((QtImage)image).drawImage (this, x, y, width, height, - bgcolor, observer); - return (new QtImage(image.getSource())).drawImage (this, x, y, - width, height, - bgcolor, observer); + return ((QtImage)image).drawImage (this, x, y, width, height, + bgcolor, observer); + return (new QtImage(image.getSource())).drawImage (this, x, y, + width, height, + bgcolor, observer); } - - public boolean drawImage(Image image, int x, int y, int width, int height, - ImageObserver observer) + + public boolean drawImage(Image image, int x, int y, int width, int height, + ImageObserver observer) { return drawImage(image, x, y, width, height, null, observer); } - + public boolean drawImage(Image image, int x, int y, ImageObserver observer) { return drawImage(image, x, y, null, observer); } - + public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { - return drawImage(image, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, null, observer); + return drawImage(image, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, null, observer); } // *********************** Transform methods ************************* @@ -531,7 +531,7 @@ public abstract class QtGraphics extends Graphics2D xform.rotate( theta ); setQtTransform( new QMatrix( xform ) ); } - + public void rotate(double theta, double x, double y) { xform.rotate(theta, x, y); @@ -549,7 +549,7 @@ public abstract class QtGraphics extends Graphics2D xform.shear(shx, shy); setQtTransform( new QMatrix( xform ) ); } - + public void transform(AffineTransform Tx) { xform.concatenate( Tx ); @@ -572,14 +572,14 @@ public abstract class QtGraphics extends Graphics2D { try // ..to convert the stroke into a native one. { - QPen pen = new QPen( s ); - nativeStroking = true; - setNativeStroke( pen ); - setColor( color ); - } + QPen pen = new QPen( s ); + nativeStroking = true; + setNativeStroke( pen ); + setColor( color ); + } catch (IllegalArgumentException e) { - nativeStroking = false; + nativeStroking = false; } currentStroke = s; } @@ -593,27 +593,27 @@ public abstract class QtGraphics extends Graphics2D { if( comp == null) { - setNativeComposite( AlphaComposite.SRC_OVER ); - return; + setNativeComposite( AlphaComposite.SRC_OVER ); + return; } if( comp instanceof AlphaComposite ) { - if( ((AlphaComposite)comp).getRule() != AlphaComposite.XOR ) - setAlpha( ((AlphaComposite)comp).getAlpha() ); - setNativeComposite( ((AlphaComposite)comp).getRule() ); - composite = comp; + if( ((AlphaComposite)comp).getRule() != AlphaComposite.XOR ) + setAlpha( ((AlphaComposite)comp).getAlpha() ); + setNativeComposite( ((AlphaComposite)comp).getRule() ); + composite = comp; } else { - // FIXME: this check is only required "if this Graphics2D - // context is drawing to a Component on the display screen". - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkPermission(new AWTPermission("readDisplayPixels")); - - throw new UnsupportedOperationException("We don't support custom"+ - " composites yet."); + // FIXME: this check is only required "if this Graphics2D + // context is drawing to a Component on the display screen". + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new AWTPermission("readDisplayPixels")); + + throw new UnsupportedOperationException("We don't support custom"+ + " composites yet."); } } @@ -625,28 +625,28 @@ public abstract class QtGraphics extends Graphics2D public void setPaint(Paint p) { if( p == null ) - return; + return; // FIXME currentPaint = p; if( p instanceof GradientPaint ) { - GradientPaint lg = (GradientPaint)p; - setLinearGradient(lg.getColor1().getRed(), lg.getColor1().getGreen(), - lg.getColor1().getBlue(), lg.getColor2().getRed(), - lg.getColor2().getGreen(), lg.getColor2().getBlue(), - lg.getPoint1().getX(), lg.getPoint1().getY(), - lg.getPoint2().getX(), lg.getPoint2().getY(), - lg.isCyclic() ); - return; + GradientPaint lg = (GradientPaint)p; + setLinearGradient(lg.getColor1().getRed(), lg.getColor1().getGreen(), + lg.getColor1().getBlue(), lg.getColor2().getRed(), + lg.getColor2().getGreen(), lg.getColor2().getBlue(), + lg.getPoint1().getX(), lg.getPoint1().getY(), + lg.getPoint2().getX(), lg.getPoint2().getY(), + lg.isCyclic() ); + return; } if( p instanceof Color ) { - setColor((Color) p); - return; + setColor((Color) p); + return; } throw new UnsupportedOperationException("We don't support custom"+ - " paints yet."); + " paints yet."); } public Paint getPaint() @@ -671,7 +671,7 @@ public abstract class QtGraphics extends Graphics2D { return (RenderingHints) renderingHints.clone(); } - + public void setRenderingHints(Map<?,?> hints) { renderingHints = new RenderingHints( null ); @@ -711,5 +711,4 @@ public abstract class QtGraphics extends Graphics2D { throw new UnsupportedOperationException("Not implemented yet"); } -} - +} diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java index 15a0159..dec4db2 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtGraphicsEnvironment.java @@ -55,7 +55,7 @@ public class QtGraphicsEnvironment extends GraphicsEnvironment toolkit = tk; // Get the number of screens from Qt. int n = toolkit.numScreens(); - + /** * Create the screen device objects */ @@ -77,7 +77,7 @@ public class QtGraphicsEnvironment extends GraphicsEnvironment { return toolkit.getFontList(); } - + public String[] getAvailableFontFamilyNames(Locale l) { return getAvailableFontFamilyNames(); @@ -103,5 +103,3 @@ public class QtGraphicsEnvironment extends GraphicsEnvironment return toolkit; } } - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtImage.java b/libjava/classpath/gnu/java/awt/peer/qt/QtImage.java index b6fbb1d..b7e50ea 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtImage.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtImage.java @@ -95,11 +95,11 @@ public class QtImage extends Image /* * The 32-bit AARRGGBB format the uses. */ - static ColorModel nativeModel = new DirectColorModel(32, - 0x00FF0000, - 0x0000FF00, - 0x000000FF, - 0xFF000000); + static ColorModel nativeModel = new DirectColorModel(32, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0xFF000000); /** * HashMap of Graphics objects painting on this Image. */ @@ -126,7 +126,7 @@ public class QtImage extends Image private native void setPixels(int[] pixels); /** - * Loads an image + * Loads an image */ private native boolean loadImage(String name); @@ -153,35 +153,35 @@ public class QtImage extends Image /** * Draws the image optionally composited. */ - native void drawPixels (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, - boolean composite); + native void drawPixels (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, + boolean composite); /** * Draws the image, optionally scaled and composited. */ - private native void drawPixelsScaled (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, int width, int height, - boolean composite); + private native void drawPixelsScaled (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, int width, int height, + boolean composite); /** * Draws the image transformed. */ private native void drawPixelsTransformed (QtGraphics gc, QMatrix transform); - + /** * Draws the image scaled flipped and optionally composited. */ - native void drawPixelsScaledFlipped (QtGraphics gc, - int bg_red, int bg_green, - int bg_blue, - boolean flipX, boolean flipY, - int srcX, int srcY, - int srcWidth, int srcHeight, - int dstX, int dstY, - int dstWidth, int dstHeight, - boolean composite); + native void drawPixelsScaledFlipped (QtGraphics gc, + int bg_red, int bg_green, + int bg_blue, + boolean flipX, boolean flipY, + int srcX, int srcY, + int srcWidth, int srcHeight, + int dstX, int dstY, + int dstWidth, int dstHeight, + boolean composite); /** * Creates the image from an ImageProducer. May result in an error image. @@ -216,13 +216,13 @@ public class QtImage extends Image byte[] buf = new byte[5000]; int n = 0; - while ( (n = bis.read( buf )) != -1 ) - baos.write(buf, 0, n); + while ( (n = bis.read( buf )) != -1 ) + baos.write(buf, 0, n); bis.close(); } catch(IOException e) { - throw new IllegalArgumentException("Couldn't load image."); + throw new IllegalArgumentException("Couldn't load image."); } if ( loadImageFromData( baos.toByteArray() ) != true ) throw new IllegalArgumentException("Couldn't load image."); @@ -245,19 +245,19 @@ public class QtImage extends Image props = new Hashtable(); try { - String fn = f.getCanonicalPath(); - if (loadImage( fn ) != true) - { - errorLoading = true; - isLoaded = false; - return; - } - } + String fn = f.getCanonicalPath(); + if (loadImage( fn ) != true) + { + errorLoading = true; + isLoaded = false; + return; + } + } catch(IOException e) { - errorLoading = true; - isLoaded = false; - return; + errorLoading = true; + isLoaded = false; + return; } errorLoading = false; isLoaded = true; @@ -315,8 +315,8 @@ public class QtImage extends Image /** * Callback from the image consumer. */ - public void setImage(int width, int height, - int[] pixels, Hashtable properties) + public void setImage(int width, int height, + int[] pixels, Hashtable properties) { this.width = width; this.height = height; @@ -324,8 +324,8 @@ public class QtImage extends Image if (width <= 0 || height <= 0 || pixels == null) { - errorLoading = true; - return; + errorLoading = true; + return; } isLoaded = true; @@ -343,12 +343,12 @@ public class QtImage extends Image return width; } - + public int getHeight (ImageObserver observer) { if (addObserver(observer)) return -1; - + return height; } @@ -356,7 +356,7 @@ public class QtImage extends Image { if (addObserver(observer)) return UndefinedProperty; - + Object value = props.get (name); return (value == null) ? UndefinedProperty : value; } @@ -368,8 +368,8 @@ public class QtImage extends Image { if (!isLoaded) return null; - return new MemoryImageSource(width, height, nativeModel, getPixels(), - 0, width); + return new MemoryImageSource(width, height, nativeModel, getPixels(), + 0, width); } void putPainter(QtImageGraphics g) @@ -391,7 +391,7 @@ public class QtImage extends Image */ public Graphics getGraphics () { - if (!isLoaded || killFlag) + if (!isLoaded || killFlag) return null; return new QtImageGraphics(this); @@ -402,28 +402,28 @@ public class QtImage extends Image */ Graphics getDirectGraphics(QtComponentPeer peer) { - if (!isLoaded) + if (!isLoaded) return null; return new QtImageDirectGraphics(this, peer); } - + /** * Returns a scaled instance of this image. */ public Image getScaledInstance(int width, - int height, - int hints) + int height, + int hints) { if (width <= 0 || height <= 0) throw new IllegalArgumentException("Width and height of scaled bitmap"+ - "must be >= 0"); + "must be >= 0"); return new QtImage(this, width, height, hints); } /** - * If the image is loaded and comes from an ImageProducer, + * If the image is loaded and comes from an ImageProducer, * regenerate the image from there. * * I have no idea if this is ever actually used. Since QtImage can't be @@ -434,10 +434,10 @@ public class QtImage extends Image { if (isLoaded && source != null) { - observers = new Vector(); - isLoaded = false; - freeImage(); - source.startProduction(new QtImageConsumer(this, source)); + observers = new Vector(); + isLoaded = false; + freeImage(); + source.startProduction(new QtImageConsumer(this, source)); } } @@ -450,11 +450,11 @@ public class QtImage extends Image { if (isLoaded) { - if( painters == null || painters.isEmpty() ) - freeImage(); - else - killFlag = true; // can't destroy image yet. - // Do so when all painters are gone. + if( painters == null || painters.isEmpty() ) + freeImage(); + else + killFlag = true; // can't destroy image yet. + // Do so when all painters are gone. } } @@ -465,12 +465,12 @@ public class QtImage extends Image { if (addObserver(observer)) { - if (errorLoading == true) - return ImageObserver.ERROR; - else - return 0; + if (errorLoading == true) + return ImageObserver.ERROR; + else + return 0; } - + return ImageObserver.ALLBITS | ImageObserver.WIDTH | ImageObserver.HEIGHT; } @@ -480,7 +480,7 @@ public class QtImage extends Image * Draws an image with eventual scaling/transforming. */ public boolean drawImage (QtGraphics g, QMatrix matrix, - ImageObserver observer) + ImageObserver observer) { if (addObserver(observer)) return false; @@ -495,14 +495,14 @@ public class QtImage extends Image * compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if (addObserver(observer)) return false; if(bgcolor != null) - drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, true); + drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, true); else drawPixels(g, 0, 0, 0, x, y, false); @@ -510,18 +510,18 @@ public class QtImage extends Image } /** - * Draws an image to the QtGraphics context, at (x,y) scaled to + * Draws an image to the QtGraphics context, at (x,y) scaled to * width and height, with optional compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if (addObserver(observer)) return false; if(bgcolor != null) - drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, width, height, true); + drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, width, height, true); else drawPixelsScaled(g, 0, 0, 0, x, y, width, height, false); @@ -531,9 +531,9 @@ public class QtImage extends Image /** * Draws an image with eventual scaling/transforming. */ - public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { if (addObserver(observer)) return false; @@ -549,53 +549,53 @@ public class QtImage extends Image int dstX = (dx1 < dx2) ? dx1 : dx2; int dstY = (dy1 < dy2) ? dy1 : dy2; - // Clipping. This requires the dst to be scaled as well, + // Clipping. This requires the dst to be scaled as well, if (srcWidth > width) { - dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); + srcWidth = width - srcX; } - if (srcHeight > height) + if (srcHeight > height) { - dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); + srcHeight = height - srcY; } if (srcWidth + srcX > width) { - dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); + srcWidth = width - srcX; } if (srcHeight + srcY > height) { - dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); + srcHeight = height - srcY; } if ( srcWidth <= 0 || srcHeight <= 0 || dstWidth <= 0 || dstHeight <= 0) return true; if(bgcolor != null) - drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), - flipX, flipY, - srcX, srcY, - srcWidth, srcHeight, - dstX, dstY, - dstWidth, dstHeight, - true); + drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), + flipX, flipY, + srcX, srcY, + srcWidth, srcHeight, + dstX, dstY, + dstWidth, dstHeight, + true); else drawPixelsScaledFlipped (g, 0, 0, 0, flipX, flipY, - srcX, srcY, srcWidth, srcHeight, - dstX, dstY, dstWidth, dstHeight, - false); + srcX, srcY, srcWidth, srcHeight, + dstX, dstY, dstWidth, dstHeight, + false); return true; } - public native void copyArea(int x, int y, int width, int height, - int dx, int dy); + public native void copyArea(int x, int y, int width, int height, + int dx, int dy); // Private methods //////////////////////////////////////////////// @@ -604,19 +604,19 @@ public class QtImage extends Image */ private void deliver() { - int flags = ImageObserver.HEIGHT | + int flags = ImageObserver.HEIGHT | ImageObserver.WIDTH | ImageObserver.PROPERTIES | ImageObserver.ALLBITS; if (observers != null) for(int i=0; i < observers.size(); i++) - ((ImageObserver)observers.elementAt(i)). - imageUpdate(this, flags, 0, 0, width, height); + ((ImageObserver)observers.elementAt(i)). + imageUpdate(this, flags, 0, 0, width, height); observers = null; } - + /** * Adds an observer, if we need to. * @return true if an observer was added. @@ -625,10 +625,10 @@ public class QtImage extends Image { if (!isLoaded) { - if(observer != null) - if (!observers.contains (observer)) - observers.addElement (observer); - return true; + if(observer != null) + if (!observers.contains (observer)) + observers.addElement (observer); + return true; } return false; } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtImageConsumer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtImageConsumer.java index 7096c21..9883475 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtImageConsumer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtImageConsumer.java @@ -86,44 +86,44 @@ public class QtImageConsumer implements ImageConsumer public synchronized void setHints (int flags) { // This method informs us in which order the pixels are - // delivered, for progressive-loading support, etc. + // delivered, for progressive-loading support, etc. // Since we wait until it's all loaded, we can ignore the hints. } - public synchronized void setPixels (int x, int y, int width, int height, - ColorModel cm, byte[] pixels, - int offset, int scansize) + public synchronized void setPixels (int x, int y, int width, int height, + ColorModel cm, byte[] pixels, + int offset, int scansize) { setPixels (x, y, width, height, cm, convertPixels (pixels), offset, scansize); } - public synchronized void setPixels (int x, int y, int width, int height, - ColorModel cm, int[] pixels, - int offset, int scansize) + public synchronized void setPixels (int x, int y, int width, int height, + ColorModel cm, int[] pixels, + int offset, int scansize) { if (pixelCache == null) return; // Not sure this should ever happen. if (cm.equals(QtImage.nativeModel)) for (int i = 0; i < height; i++) - System.arraycopy (pixels, offset + (i * scansize), - pixelCache, (y + i) * this.width + x, - width); + System.arraycopy (pixels, offset + (i * scansize), + pixelCache, (y + i) * this.width + x, + width); else { - for (int i = 0; i < height; i++) - for (int j = 0; j < width; j++) - { - // get in AARRGGBB and convert to AABBGGRR - int pix = cm.getRGB(pixels[offset + (i * scansize) + x + j]); - byte b = (byte)(pix & 0xFF); - byte r = (byte)(((pix & 0x00FF0000) >> 16) & 0xFF); - pix &= 0xFF00FF00; - pix |= ((b & 0xFF) << 16); - pix |= (r & 0xFF); - pixelCache[(y + i) * this.width + x + j] = pix; - } + for (int i = 0; i < height; i++) + for (int j = 0; j < width; j++) + { + // get in AARRGGBB and convert to AABBGGRR + int pix = cm.getRGB(pixels[offset + (i * scansize) + x + j]); + byte b = (byte)(pix & 0xFF); + byte r = (byte)(((pix & 0x00FF0000) >> 16) & 0xFF); + pix &= 0xFF00FF00; + pix |= ((b & 0xFF) << 16); + pix |= (r & 0xFF); + pixelCache[(y + i) * this.width + x + j] = pix; + } } } @@ -136,7 +136,7 @@ public class QtImageConsumer implements ImageConsumer for (int i = 0; i < pixels.length; i++) ret[i] = pixels[i] & 0xFF; - + return ret; } @@ -145,5 +145,3 @@ public class QtImageConsumer implements ImageConsumer this.properties = props; } } - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtImageDirectGraphics.java b/libjava/classpath/gnu/java/awt/peer/qt/QtImageDirectGraphics.java index d49084a..daa174a 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtImageDirectGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtImageDirectGraphics.java @@ -75,7 +75,7 @@ public class QtImageDirectGraphics extends QtImageGraphics } public void draw(Shape s) - { + { super.draw(s); scheduleUpdate(); } @@ -105,43 +105,41 @@ public class QtImageDirectGraphics extends QtImageGraphics } public boolean drawImage(Image image, - AffineTransform Tx, - ImageObserver obs) + AffineTransform Tx, + ImageObserver obs) { boolean r = super.drawImage(image, Tx, obs); scheduleUpdate(); return r; } - public boolean drawImage(Image image, int x, int y, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, Color bgcolor, + ImageObserver observer) { boolean r = super.drawImage(image, x, y, bgcolor, observer); scheduleUpdate(); return r; } - public boolean drawImage(Image image, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image image, + int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { - boolean r = super.drawImage( image, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, - bgcolor, observer); + boolean r = super.drawImage( image, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, + bgcolor, observer); scheduleUpdate(); return r; } - public boolean drawImage(Image image, int x, int y, - int width, int height, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image image, int x, int y, + int width, int height, Color bgcolor, + ImageObserver observer) { - boolean r = super.drawImage(image, x, y, width, height, bgcolor, - observer); + boolean r = super.drawImage(image, x, y, width, height, bgcolor, + observer); scheduleUpdate(); return r; } -} - - +} diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtImageGraphics.java b/libjava/classpath/gnu/java/awt/peer/qt/QtImageGraphics.java index 1224d69..bba25e0 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtImageGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtImageGraphics.java @@ -65,17 +65,17 @@ public class QtImageGraphics extends QtGraphics int w, h; if(image instanceof QtImage) { - w = ((QtImage)image).width; - h = ((QtImage)image).height; - initImage((QtImage) image ); - ((QtImage)image).putPainter( this ); - } + w = ((QtImage)image).width; + h = ((QtImage)image).height; + initImage((QtImage) image ); + ((QtImage)image).putPainter( this ); + } else { - w = ((QtVolatileImage)image).width; - h = ((QtVolatileImage)image).height; - initVolatileImage((QtVolatileImage) image ); - ((QtVolatileImage)image).putPainter( this ); + w = ((QtVolatileImage)image).width; + h = ((QtVolatileImage)image).height; + initVolatileImage((QtVolatileImage) image ); + ((QtVolatileImage)image).putPainter( this ); } parentImage = image; @@ -92,7 +92,7 @@ public class QtImageGraphics extends QtGraphics */ QtImageGraphics( QtImageGraphics g ) { - super( g ); + super( g ); parentImage = g.parentImage; if(parentImage instanceof QtImage) ((QtImage)parentImage).putPainter( this ); @@ -119,9 +119,9 @@ public class QtImageGraphics extends QtGraphics /** * Copy an area. - */ - public void copyArea(int x, int y, int width, int height, - int dx, int dy) + */ + public void copyArea(int x, int y, int width, int height, + int dx, int dy) { if(parentImage instanceof QtImage) ((QtImage)parentImage).copyArea(x, y, width, height, dx, dy); @@ -136,6 +136,4 @@ public class QtImageGraphics extends QtGraphics { throw new UnsupportedOperationException("Not implemented yet"); } -} - - +} diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtLabelPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtLabelPeer.java index 449c9b3..80acd49 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtLabelPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtLabelPeer.java @@ -46,9 +46,9 @@ public class QtLabelPeer extends QtComponentPeer implements LabelPeer { super( kit, owner ); } - + protected native void init(); - + protected void setup() { super.setup(); diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtListPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtListPeer.java index 9df250a..14ae2a0 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtListPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtListPeer.java @@ -84,26 +84,26 @@ public class QtListPeer extends QtComponentPeer implements ListPeer if( index == -1) ((List)owner).deselect( ((List)owner).getSelectedIndex() ); else - { - ((List)owner).select( index ); - ItemEvent e = new ItemEvent((List)owner, - ItemEvent.ITEM_STATE_CHANGED, - ""+index, - ItemEvent.SELECTED); - QtToolkit.eventQueue.postEvent(e); - } + { + ((List)owner).select( index ); + ItemEvent e = new ItemEvent((List)owner, + ItemEvent.ITEM_STATE_CHANGED, + ""+index, + ItemEvent.SELECTED); + QtToolkit.eventQueue.postEvent(e); + } } /** * Called back when an item is double-clicked. - */ + */ private void itemDoubleClicked( int index, int modifiers ) { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((List)owner).getItem( index ), - System.currentTimeMillis(), - modifiers); + ActionEvent.ACTION_PERFORMED, + ((List)owner).getItem( index ), + System.currentTimeMillis(), + modifiers); QtToolkit.eventQueue.postEvent(e); } @@ -129,10 +129,10 @@ public class QtListPeer extends QtComponentPeer implements ListPeer public native void delItems(int start_index, int end_index); public void deselect(int index) - { + { if( ignoreNextSelect == true ) ignoreNextSelect = false; - else + else select(index, false); } @@ -159,7 +159,7 @@ public class QtListPeer extends QtComponentPeer implements ListPeer { if( ignoreNextSelect == true ) ignoreNextSelect = false; - else + else select(index, true); } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuBarPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuBarPeer.java index c91b37f..962d76d 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuBarPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuBarPeer.java @@ -47,15 +47,15 @@ public class QtMenuBarPeer extends QtMenuComponentPeer implements MenuBarPeer { super( kit, owner ); } - + protected native void init(); - + protected void setup() { } - /** - * Recurses the menubar adding menus (and menu items), + /** + * Recurses the menubar adding menus (and menu items), * called from the Frame peer. */ void addMenus() @@ -99,4 +99,3 @@ public class QtMenuBarPeer extends QtMenuComponentPeer implements MenuBarPeer delMenu( (QtMenuPeer)m.getPeer() ); } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuComponentPeer.java index 7e292d0..2050bef 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuComponentPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuComponentPeer.java @@ -41,27 +41,27 @@ import java.awt.Font; import java.awt.MenuComponent; import java.awt.peer.MenuComponentPeer; -public class QtMenuComponentPeer extends NativeWrapper +public class QtMenuComponentPeer extends NativeWrapper implements MenuComponentPeer { protected QtToolkit toolkit; protected MenuComponent owner; - + public QtMenuComponentPeer( QtToolkit kit, MenuComponent owner ) { this.toolkit = kit; this.owner = owner; nativeObject = 0; - synchronized(this) + synchronized(this) { - callInit(); // Calls the init method FROM THE MAIN THREAD. - try - { - wait(); // Wait for the thing to be created. - } - catch(InterruptedException e) - { - } + callInit(); // Calls the init method FROM THE MAIN THREAD. + try + { + wait(); // Wait for the thing to be created. + } + catch(InterruptedException e) + { + } } setup(); } @@ -80,7 +80,7 @@ public class QtMenuComponentPeer extends NativeWrapper { dispose(); } - + // ************ Public methods ********************* public native void dispose(); @@ -88,7 +88,7 @@ public class QtMenuComponentPeer extends NativeWrapper public void setFont(Font font) { // TODO Auto-generated method stub - + } } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuItemPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuItemPeer.java index 7658ff0..2b77540 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuItemPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuItemPeer.java @@ -43,7 +43,7 @@ import java.awt.event.ActionEvent; import java.awt.peer.MenuItemPeer; import java.awt.peer.CheckboxMenuItemPeer; -public class QtMenuItemPeer extends QtMenuComponentPeer +public class QtMenuItemPeer extends QtMenuComponentPeer implements MenuItemPeer, CheckboxMenuItemPeer { public QtMenuItemPeer( QtToolkit toolkit, MenuItem owner ) @@ -73,15 +73,15 @@ public class QtMenuItemPeer extends QtMenuComponentPeer private void fireClick(int modifiers) { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((MenuItem)owner).getActionCommand(), - System.currentTimeMillis(), - (modifiers & 0x2FF)); + ActionEvent.ACTION_PERFORMED, + ((MenuItem)owner).getActionCommand(), + System.currentTimeMillis(), + (modifiers & 0x2FF)); QtToolkit.eventQueue.postEvent(e); } // ************ Public methods ********************* - + public void disable() { setEnabled(false); @@ -98,10 +98,3 @@ public class QtMenuItemPeer extends QtMenuComponentPeer public native void setState(boolean state); } - - - - - - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java index 87324c7..0f65fec 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java @@ -56,7 +56,7 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer } protected native void init(); - + protected void setup() { items = new Vector(); @@ -65,29 +65,29 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer allowTearOff(); } - // Recurse the menu tree adding items, + // Recurse the menu tree adding items, // called from the MenuBar addMenus() method, called from the Frame peer. void addItems() { if(!itemsAdded) { - Menu o = (Menu)owner; - for( int i=0; i < o.getItemCount(); i++ ) - { - MenuItem ci = o.getItem(i); - if (ci instanceof Menu && ci.getPeer() != null) - ((QtMenuPeer)ci.getPeer()).addItems(); - addItem( ci ); - } - itemsAdded = true; + Menu o = (Menu)owner; + for( int i=0; i < o.getItemCount(); i++ ) + { + MenuItem ci = o.getItem(i); + if (ci instanceof Menu && ci.getPeer() != null) + ((QtMenuPeer)ci.getPeer()).addItems(); + addItem( ci ); + } + itemsAdded = true; } } private void fireClick() { ActionEvent e = new ActionEvent(owner, - ActionEvent.ACTION_PERFORMED, - ((Menu)owner).getActionCommand()); + ActionEvent.ACTION_PERFORMED, + ((Menu)owner).getActionCommand()); QtToolkit.eventQueue.postEvent(e); } @@ -112,13 +112,13 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer { if( item instanceof Menu || item instanceof PopupMenu) insertMenu((QtMenuPeer)item.getPeer()); - else + else { - QtMenuItemPeer p = (QtMenuItemPeer)item.getPeer(); - insertItem(p); + QtMenuItemPeer p = (QtMenuItemPeer)item.getPeer(); + insertItem(p); } } - + public void addSeparator() { insertSeperator(); @@ -147,6 +147,3 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer public native void setLabel(String text); } - - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtPanelPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtPanelPeer.java index 9e43523..1ac0ca9 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtPanelPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtPanelPeer.java @@ -46,7 +46,7 @@ public class QtPanelPeer extends QtContainerPeer implements PanelPeer { super( kit, owner ); } - + protected native void init(); protected void setup() diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtPopupMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtPopupMenuPeer.java index b96c5c5..eb4dae4 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtPopupMenuPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtPopupMenuPeer.java @@ -74,6 +74,3 @@ public class QtPopupMenuPeer extends QtMenuPeer implements PopupMenuPeer show((Component)e.target, e.x, e.y); } } - - - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtRepaintThread.java b/libjava/classpath/gnu/java/awt/peer/qt/QtRepaintThread.java index 405505e..6861be8 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtRepaintThread.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtRepaintThread.java @@ -42,13 +42,13 @@ package gnu.java.awt.peer.qt; * do this directly from the paint callback in QtComponentPeer, because that * is executed from the main thread. Thus, if a call is made at the same time * which requires execution by the main thread, and this is sharing a lock with - * paint(), then a deadlock will occur, which must be avoided. In general, + * paint(), then a deadlock will occur, which must be avoided. In general, * the main Qt thread should avoid calling into java code as far as possible. * */ -public class QtRepaintThread extends Thread +public class QtRepaintThread extends Thread { - static class RepaintComponent + static class RepaintComponent { public QtComponentPeer curr; public RepaintComponent next; @@ -72,7 +72,7 @@ public class QtRepaintThread extends Thread this.h = h; } } - + RepaintComponent component; boolean busy; @@ -85,39 +85,39 @@ public class QtRepaintThread extends Thread { while( true ) { - try - { - busy = false; - // Wait for a repaint - sleep(100); - busy = true; - } - catch (InterruptedException ie) - { - while( component != null ) - { - try - { - if( component.paintAll ) - { - // update the back-buffer. - component.curr.paintBackBuffer(); - component.curr.QtUpdate(); // trigger a native repaint event - } - else - { - component.curr.paintBackBuffer(component.x, component.y, - component.w, component.h); - component.curr.QtUpdateArea(component.x, component.y, - component.w, component.h); - } - } - catch (InterruptedException e) - { - } - component = component.next; - } - } + try + { + busy = false; + // Wait for a repaint + sleep(100); + busy = true; + } + catch (InterruptedException ie) + { + while( component != null ) + { + try + { + if( component.paintAll ) + { + // update the back-buffer. + component.curr.paintBackBuffer(); + component.curr.QtUpdate(); // trigger a native repaint event + } + else + { + component.curr.paintBackBuffer(component.x, component.y, + component.w, component.h); + component.curr.QtUpdateArea(component.x, component.y, + component.w, component.h); + } + } + catch (InterruptedException e) + { + } + component = component.next; + } + } } } @@ -130,9 +130,9 @@ public class QtRepaintThread extends Thread component = new RepaintComponent(p); else { - RepaintComponent r = component; - while( r.next != null ) r = r.next; - r.next = new RepaintComponent(p); + RepaintComponent r = component; + while( r.next != null ) r = r.next; + r.next = new RepaintComponent(p); } interrupt(); } @@ -140,16 +140,16 @@ public class QtRepaintThread extends Thread /** * Enqueue a component for repainting. */ - public synchronized void queueComponent(QtComponentPeer p, int x, int y, - int w, int h) + public synchronized void queueComponent(QtComponentPeer p, int x, int y, + int w, int h) { if( component == null ) component = new RepaintComponent(p, x, y, w, h); else { - RepaintComponent r = component; - while( r.next != null ) r = r.next; - r.next = new RepaintComponent(p, x, y, w, h); + RepaintComponent r = component; + while( r.next != null ) r = r.next; + r.next = new RepaintComponent(p, x, y, w, h); } interrupt(); } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDevice.java b/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDevice.java index c2d73ae..c7d8a47 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDevice.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDevice.java @@ -113,4 +113,3 @@ public class QtScreenDevice extends GraphicsDevice { } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java b/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java index c67b55b..34de36c 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java @@ -47,7 +47,7 @@ import java.awt.image.VolatileImage; import java.awt.geom.AffineTransform; public class QtScreenDeviceConfiguration extends GraphicsConfiguration { - + private QtScreenDevice owner; private Rectangle bounds; private double dpiX, dpiY; @@ -67,21 +67,21 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { switch( depth ) { case 24: - return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); + return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); case 16: - return new BufferedImage(width, height, - BufferedImage.TYPE_USHORT_565_RGB); + return new BufferedImage(width, height, + BufferedImage.TYPE_USHORT_565_RGB); case 8: - return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED); + return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED); default: case 32: - return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); } } public BufferedImage createCompatibleImage(int width, int height, int transparency) { - // FIXME: Take the transpareny flag into account? + // FIXME: Take the transpareny flag into account? // For now, ignore it and just use an alpha channel. if(depth == 32) return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); @@ -92,9 +92,9 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { { return new QtVolatileImage( width, height ); } - - public VolatileImage createCompatibleVolatileImage(int width, int height, - ImageCapabilities caps) + + public VolatileImage createCompatibleVolatileImage(int width, int height, + ImageCapabilities caps) { return createCompatibleVolatileImage( width, height ); } @@ -121,7 +121,7 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { return new AffineTransform(); } - public GraphicsDevice getDevice() + public GraphicsDevice getDevice() { return owner; } @@ -137,8 +137,8 @@ public class QtScreenDeviceConfiguration extends GraphicsConfiguration { return nTrans; } - public VolatileImage createCompatibleVolatileImage(int width, int height, - int transparency) + public VolatileImage createCompatibleVolatileImage(int width, int height, + int transparency) { return createCompatibleVolatileImage(width, height); } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtScrollPanePeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtScrollPanePeer.java index c3731cb..079d06d 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtScrollPanePeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtScrollPanePeer.java @@ -48,7 +48,7 @@ public class QtScrollPanePeer extends QtContainerPeer implements ScrollPanePeer { super( kit, owner ); } - + protected native void init(); protected void setup() @@ -73,9 +73,9 @@ public class QtScrollPanePeer extends QtContainerPeer implements ScrollPanePeer { // FIXME : more accurate? return new Insets(5 + getHScrollbarHeight(), // Top - 5 + getVScrollbarWidth(), // Left - 5, // Bottom - 5); // Right + 5 + getVScrollbarWidth(), // Left + 5, // Bottom + 5); // Right } public void setUnitIncrement(Adjustable item, int inc) diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtScrollbarPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtScrollbarPeer.java index 838cca6..6942871 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtScrollbarPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtScrollbarPeer.java @@ -65,13 +65,13 @@ public class QtScrollbarPeer extends QtComponentPeer implements ScrollbarPeer private void fireMoved(int type, int value) { AdjustmentEvent e = new AdjustmentEvent((Scrollbar)owner, - AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, - type, value); + AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, + type, value); QtToolkit.eventQueue.postEvent(e); } - + // ************ Public methods ********************* - + public native void setLineIncrement(int inc); public native void setPageIncrement(int inc); diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtTextAreaPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtTextAreaPeer.java index f37b953..a5aff58 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtTextAreaPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtTextAreaPeer.java @@ -69,7 +69,7 @@ public class QtTextAreaPeer extends QtComponentPeer implements TextAreaPeer * Called back on a text edit. */ private void textChanged() - { + { TextEvent e = new TextEvent(owner, TextEvent.TEXT_VALUE_CHANGED); QtToolkit.eventQueue.postEvent(e); } @@ -95,7 +95,7 @@ public class QtTextAreaPeer extends QtComponentPeer implements TextAreaPeer public native int getIndexAtPoint(int x, int y); // public void reshape(int x, int y, -// int width, int height) +// int width, int height) // { // if(width != 0 || height != 0) // super.reshape(x, y, width, height); @@ -177,4 +177,3 @@ public class QtTextAreaPeer extends QtComponentPeer implements TextAreaPeer return null; } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtTextFieldPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtTextFieldPeer.java index 0e3d5af..f929432 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtTextFieldPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtTextFieldPeer.java @@ -80,7 +80,7 @@ public class QtTextFieldPeer extends QtComponentPeer implements TextFieldPeer // ************ Public methods ********************* - public long filterEvents(long e) + public long filterEvents(long e) { return e; } @@ -91,7 +91,7 @@ public class QtTextFieldPeer extends QtComponentPeer implements TextFieldPeer { return new Rectangle(0,0,0,0); } - + public int getIndexAtPoint(int x, int y) { // FIXME @@ -157,4 +157,3 @@ public class QtTextFieldPeer extends QtComponentPeer implements TextFieldPeer return null; } } - diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java b/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java index 4cea976..9f8a691 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java @@ -111,7 +111,7 @@ import java.util.Properties; public class QtToolkit extends ClasspathToolkit { public static EventQueue eventQueue = null; // the native event queue - public static QtRepaintThread repaintThread = null; + public static QtRepaintThread repaintThread = null; public static MainQtThread guiThread = null; public static QtGraphicsEnvironment graphicsEnv = null; @@ -122,12 +122,12 @@ public class QtToolkit extends ClasspathToolkit System.loadLibrary("qtpeer"); String theme = null; - try + try { - String style = System.getProperty("qtoptions.style"); - if(style != null) - theme = style; - } + String style = System.getProperty("qtoptions.style"); + if(style != null) + theme = style; + } catch(SecurityException e) { } @@ -136,12 +136,12 @@ public class QtToolkit extends ClasspathToolkit } boolean doublebuffer = true; - try + try { - String style = System.getProperty("qtoptions.nodoublebuffer"); - if(style != null) - doublebuffer = false; - } + String style = System.getProperty("qtoptions.nodoublebuffer"); + if(style != null) + doublebuffer = false; + } catch(SecurityException e) { } @@ -171,7 +171,7 @@ public class QtToolkit extends ClasspathToolkit } native String[] nativeFontFamilies(); - + native int numScreens(); native int defaultScreen(); @@ -213,7 +213,7 @@ public class QtToolkit extends ClasspathToolkit return new QtMenuItemPeer( this, target ); } - public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) + public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) { throw new RuntimeException("Not implemented"); } @@ -232,16 +232,16 @@ public class QtToolkit extends ClasspathToolkit { return new QtImage( producer ); } - + public Image createImage(byte[] imageData, - int imageOffset, - int imageLength) + int imageOffset, + int imageLength) { byte[] dataCopy = new byte[imageLength]; System.arraycopy(imageData, imageOffset, dataCopy, 0, imageLength); return new QtImage( dataCopy ); } - + public Image createImage(String filename) { return new QtImage( filename ); @@ -256,7 +256,7 @@ public class QtToolkit extends ClasspathToolkit { return new QtTextFieldPeer(this,target); } - + protected LabelPeer createLabel(Label target) { return new QtLabelPeer( this, target ); @@ -335,11 +335,11 @@ public class QtToolkit extends ClasspathToolkit public ColorModel getColorModel() { - return new DirectColorModel(32, - 0x00FF0000, - 0x0000FF00, - 0x000000FF, - 0xFF000000); + return new DirectColorModel(32, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0xFF000000); } /** @@ -347,11 +347,11 @@ public class QtToolkit extends ClasspathToolkit */ public String[] getFontList() { - String[] builtIn = new String[] { "Dialog", - "DialogInput", - "Monospaced", - "Serif", - "SansSerif" }; + String[] builtIn = new String[] { "Dialog", + "DialogInput", + "Monospaced", + "Serif", + "SansSerif" }; String[] nat = nativeFontFamilies(); String[] allFonts = new String[ nat.length + 5 ]; System.arraycopy(builtIn, 0, allFonts, 0, 5); @@ -365,7 +365,7 @@ public class QtToolkit extends ClasspathToolkit } protected FontPeer getFontPeer(String name, - int style) + int style) { Map attrs = new HashMap (); ClasspathFontPeer.copyStyleToAttrs(style, attrs); @@ -384,14 +384,14 @@ public class QtToolkit extends ClasspathToolkit } public PrintJob getPrintJob(Frame frame, - String jobtitle, - Properties props) + String jobtitle, + Properties props) { SecurityManager sm; sm = System.getSecurityManager(); if (sm != null) sm.checkPrintJobAccess(); - + throw new RuntimeException("Not implemented"); } @@ -412,8 +412,8 @@ public class QtToolkit extends ClasspathToolkit public Map mapInputMethodHighlight(InputMethodHighlight highlight) { return null; // FIXME - } - + } + public boolean prepareImage(Image image, int w, int h, ImageObserver observer) { if(image instanceof QtImage) @@ -431,7 +431,7 @@ public class QtToolkit extends ClasspathToolkit } public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs) - { + { return new QtFontPeer (name, attrs); } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java b/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java index c81bb2a..a203de0 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java @@ -74,11 +74,11 @@ public class QtVolatileImage extends VolatileImage /* * The 32-bit AARRGGBB format the uses. */ - static ColorModel nativeModel = new DirectColorModel(32, - 0x00FF0000, - 0x0000FF00, - 0x000000FF, - 0xFF000000); + static ColorModel nativeModel = new DirectColorModel(32, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0xFF000000); /** * Clears the image to RGBA 0 @@ -111,7 +111,7 @@ public class QtVolatileImage extends VolatileImage private native void freeImage(); /** - * Blit a QImage + * Blit a QImage */ public native void blit(QtImage i); public native void blit(QtImage i, int x, int y, int w, int h); @@ -124,35 +124,35 @@ public class QtVolatileImage extends VolatileImage /** * Draws the image optionally composited. */ - private native void drawPixels (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, - boolean composite); + private native void drawPixels (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, + boolean composite); /** * Draws the image, optionally scaled and composited. */ - private native void drawPixelsScaled (QtGraphics gc, - int bg_red, int bg_green, int bg_blue, - int x, int y, int width, int height, - boolean composite); + private native void drawPixelsScaled (QtGraphics gc, + int bg_red, int bg_green, int bg_blue, + int x, int y, int width, int height, + boolean composite); /** * Draws the image transformed. */ private native void drawPixelsTransformed (QtGraphics gc, QMatrix transform); - + /** * Draws the image scaled flipped and optionally composited. */ - native void drawPixelsScaledFlipped (QtGraphics gc, - int bg_red, int bg_green, - int bg_blue, - boolean flipX, boolean flipY, - int srcX, int srcY, - int srcWidth, int srcHeight, - int dstX, int dstY, - int dstWidth, int dstHeight, - boolean composite); + native void drawPixelsScaledFlipped (QtGraphics gc, + int bg_red, int bg_green, + int bg_blue, + boolean flipX, boolean flipY, + int srcX, int srcY, + int srcWidth, int srcHeight, + int dstX, int dstY, + int dstWidth, int dstHeight, + boolean composite); /** * Constructs an empty QtVolatileImage. @@ -169,8 +169,8 @@ public class QtVolatileImage extends VolatileImage /** * Constructs a scaled version of the src bitmap, using Qt */ - private QtVolatileImage (QtVolatileImage src, int width, int height, - int hints) + private QtVolatileImage (QtVolatileImage src, int width, int height, + int hints) { this.width = width; this.height = height; @@ -190,7 +190,7 @@ public class QtVolatileImage extends VolatileImage if( painters == null || painters.isEmpty() ) freeImage(); else - killFlag = true; // can't destroy image yet. + killFlag = true; // can't destroy image yet. // Do so when all painters are gone. } @@ -200,7 +200,7 @@ public class QtVolatileImage extends VolatileImage { return getWidth(); } - + public int getHeight (ImageObserver observer) { return getHeight(); @@ -217,8 +217,8 @@ public class QtVolatileImage extends VolatileImage */ public ImageProducer getSource () { - return new MemoryImageSource(width, height, nativeModel, getPixels(), - 0, width); + return new MemoryImageSource(width, height, nativeModel, getPixels(), + 0, width); } void putPainter(QtImageGraphics g) @@ -244,17 +244,17 @@ public class QtVolatileImage extends VolatileImage putPainter( g ); return g; } - + /** * Returns a scaled instance of this image. */ public Image getScaledInstance(int width, - int height, - int hints) + int height, + int hints) { if (width <= 0 || height <= 0) throw new IllegalArgumentException("Width and height of scaled bitmap"+ - "must be >= 0"); + "must be >= 0"); return new QtVolatileImage(this, width, height, hints); } @@ -280,7 +280,7 @@ public class QtVolatileImage extends VolatileImage * Draws an image with eventual scaling/transforming. */ public boolean drawImage (QtGraphics g, QMatrix matrix, - ImageObserver observer) + ImageObserver observer) { drawPixelsTransformed (g, matrix); return true; @@ -291,11 +291,11 @@ public class QtVolatileImage extends VolatileImage * compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if(bgcolor != null) - drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, true); + drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, true); else drawPixels(g, 0, 0, 0, x, y, false); @@ -303,27 +303,27 @@ public class QtVolatileImage extends VolatileImage } /** - * Draws an image to the QtGraphics context, at (x,y) scaled to + * Draws an image to the QtGraphics context, at (x,y) scaled to * width and height, with optional compositing with a background color. */ public boolean drawImage (QtGraphics g, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { if(bgcolor != null) - drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), x, y, width, height, true); + drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), x, y, width, height, true); else drawPixelsScaled(g, 0, 0, 0, x, y, width, height, false); - + return true; } /** * Draws an image with eventual scaling/transforming. */ - public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, ImageObserver observer) + public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + Color bgcolor, ImageObserver observer) { boolean flipX = (dx1 > dx2)^(sx1 > sx2); boolean flipY = (dy1 > dy2)^(sy1 > sy2); @@ -336,53 +336,53 @@ public class QtVolatileImage extends VolatileImage int dstX = (dx1 < dx2) ? dx1 : dx2; int dstY = (dy1 < dy2) ? dy1 : dy2; - // Clipping. This requires the dst to be scaled as well, + // Clipping. This requires the dst to be scaled as well, if (srcWidth > width) { - dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); + srcWidth = width - srcX; } - if (srcHeight > height) + if (srcHeight > height) { - dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); + srcHeight = height - srcY; } if (srcWidth + srcX > width) { - dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); - srcWidth = width - srcX; + dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); + srcWidth = width - srcX; } if (srcHeight + srcY > height) { - dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); - srcHeight = height - srcY; + dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); + srcHeight = height - srcY; } if ( srcWidth <= 0 || srcHeight <= 0 || dstWidth <= 0 || dstHeight <= 0) return true; if(bgcolor != null) - drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), - bgcolor.getBlue (), - flipX, flipY, - srcX, srcY, - srcWidth, srcHeight, - dstX, dstY, - dstWidth, dstHeight, - true); + drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), + bgcolor.getBlue (), + flipX, flipY, + srcX, srcY, + srcWidth, srcHeight, + dstX, dstY, + dstWidth, dstHeight, + true); else drawPixelsScaledFlipped (g, 0, 0, 0, flipX, flipY, - srcX, srcY, srcWidth, srcHeight, - dstX, dstY, dstWidth, dstHeight, - false); + srcX, srcY, srcWidth, srcHeight, + dstX, dstY, dstWidth, dstHeight, + false); return true; } - - public native void copyArea(int x, int y, int width, int height, - int dx, int dy); + + public native void copyArea(int x, int y, int width, int height, + int dx, int dy); //******************** VolatileImage stuff ******************** @@ -402,10 +402,10 @@ public class QtVolatileImage extends VolatileImage { return new ImageCapabilities(false) { - public boolean isTrueVolatile() - { - return false; - } + public boolean isTrueVolatile() + { + return false; + } }; } @@ -416,8 +416,8 @@ public class QtVolatileImage extends VolatileImage public BufferedImage getSnapshot() { - BufferedImage bi = new BufferedImage(width, height, - BufferedImage.TYPE_INT_ARGB_PRE); + BufferedImage bi = new BufferedImage(width, height, + BufferedImage.TYPE_INT_ARGB_PRE); bi.setRGB( 0, 0, width, height, getPixels(), 0, width); return bi; } diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java index e0a9e8c..2dfe2ec 100644 --- a/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java @@ -53,7 +53,7 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer { super.setup(); } - + // ************ Public methods ********************* public native void toBack(); @@ -68,7 +68,7 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer public void updateAlwaysOnTop() { // TODO Auto-generated method stub - + } public boolean requestWindowFocus() diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java index 192d612..1a42fc9 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java @@ -185,7 +185,7 @@ public class SwingButtonPeer par = button.getParent(); return par; } - + /** * Handles focus events by forwarding it to * <code>processFocusEvent()</code>. @@ -232,7 +232,7 @@ public class SwingButtonPeer for (int i = 0; i < l.length; ++i) l[i].actionPerformed(ev); } - + } /** diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java index 03d6388..7080831 100755 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java @@ -62,7 +62,7 @@ public class SwingCheckboxPeer extends SwingComponentPeer implements /** * A spezialized Swing checkbox used to paint the checkbox for the - * AWT checkbox. + * AWT checkbox. */ private class SwingCheckbox extends JCheckBox @@ -211,7 +211,7 @@ public class SwingCheckboxPeer extends SwingComponentPeer implements * Receives notification when an action was performend on the button. * * @param event the action event - */ + */ public void itemStateChanged(ItemEvent event) { awtCheckbox.setState(event.getStateChange()==ItemEvent.SELECTED); @@ -224,7 +224,7 @@ public class SwingCheckboxPeer extends SwingComponentPeer implements l[i].itemStateChanged(ev); } } - + /** * Creates a new SwingCheckboxPeer instance. */ diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java index d22f55d..ca42fb7 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java @@ -87,7 +87,7 @@ public interface SwingComponent * @param ev the key event */ void handleKeyEvent(KeyEvent ev); - + /** * Handles a focus event. This is usually forwarded to * {@link Component#processFocusEvent(FocusEvent)} of the swing diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java index 71a7bac..8be95dc 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java @@ -195,7 +195,7 @@ public class SwingComponentPeer public Image createImage(ImageProducer prod) { Image image = Toolkit.getDefaultToolkit().createImage(prod); - return image; + return image; } /** @@ -379,7 +379,7 @@ public class SwingComponentPeer /** * Handles the given event. This is called from - * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to + * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to * react to events for the component. * * @param e the event @@ -458,7 +458,7 @@ public class SwingComponentPeer /** * Returns <code>true</code> if the component can receive keyboard input * focus. This is called from {@link Component#isFocusTraversable()}. - * + * * This is implemented to return isFocusable() from the Swing component. * * @specnote Part of the earlier 1.1 API, replaced by isFocusable(). @@ -591,10 +591,10 @@ public class SwingComponentPeer /** * Requests that this component receives the focus. This is called from * {@link Component#requestFocus()}. - * + * * This calls requestFocus() on the Swing component. * - * @specnote Part of the earlier 1.1 API, apparently replaced by argument + * @specnote Part of the earlier 1.1 API, apparently replaced by argument * form of the same method. */ public void requestFocus() @@ -762,7 +762,7 @@ public class SwingComponentPeer swingComponent.getJComponent().setVisible(true); } - /** + /** * Get the graphics configuration of the component. The color model * of the component can be derived from the configuration. * @@ -845,7 +845,7 @@ public class SwingComponentPeer * Returns true, if this component can handle wheel scrolling, * <code>false</code> otherwise. * - * This is not yet implemented and returns <code>false</code>. + * This is not yet implemented and returns <code>false</code>. * * @return true, if this component can handle wheel scrolling, * <code>false</code> otherwise @@ -979,7 +979,7 @@ public class SwingComponentPeer /** * Reparent this component under another container. - * + * * @param parent * @since 1.5 */ @@ -1009,7 +1009,7 @@ public class SwingComponentPeer /** * Check if this component supports being reparented. - * + * * @return true if this component can be reparented, * false otherwise. * @since 1.5 @@ -1051,13 +1051,13 @@ public class SwingComponentPeer } finally { userGraphics.dispose(); } - + } /** * Paints the actual 'heavyweight' swing component, if there is one * associated to this peer. - * + * * @param g the graphics to paint the component with */ protected void peerPaintComponent(Graphics g) @@ -1115,7 +1115,7 @@ public class SwingComponentPeer swingComponent.handleFocusEvent(e); } - + /** * Returns the AWT component for this peer. * diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java index 2d5d97f..ca3adc4 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java @@ -340,7 +340,7 @@ public class SwingContainerPeer } } } - + /** * Handles key events on the component. This is usually forwarded to the * SwingComponent's processKeyEvent() method. @@ -352,12 +352,12 @@ public class SwingContainerPeer Component owner = getFocusOwner(); if(owner != null) owner.getPeer().handleEvent(e); - else + else super.handleKeyEvent(e); } private Component focusOwner = null; - + private Component getFocusOwner() { if(focusOwner == null) @@ -369,10 +369,10 @@ public class SwingContainerPeer { focusOwner = child; break; - } + } } } return focusOwner; } - + } diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java index 55c394e..5c979d6 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java @@ -62,7 +62,7 @@ public class SwingLabelPeer { /** - * A spezialized Swing label used to paint the label for the AWT Label. + * A spezialized Swing label used to paint the label for the AWT Label. * * @author Roman Kennke (kennke@aicas.com) */ @@ -71,13 +71,13 @@ public class SwingLabelPeer implements SwingComponent { Label label; - - + + SwingLabel(Label label) { this.label = label; } - + /** * Returns this label. * diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingListPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingListPeer.java index 22a6052..cf766fd 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingListPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingListPeer.java @@ -63,7 +63,7 @@ public class SwingListPeer { /** - * A spezialized Swing scroller used to hold the list. + * A spezialized Swing scroller used to hold the list. * * @author Roman Kennke (kennke@aicas.com) */ @@ -139,7 +139,7 @@ public class SwingListPeer processFocusEvent(ev); } - + /** * Overridden so that this method returns the correct value even without a * peer. @@ -356,7 +356,7 @@ public class SwingListPeer super.peerPaint(g, update); jList.doLayout(); jList.list(); - + Rectangle r = getBounds(); g.setColor(Color.RED); g.drawRect(r.x, r.y, r.width, r.height); diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java index 8b9d47e..721b334 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java @@ -83,7 +83,7 @@ public class SwingMenuItemPeer event.setSource(awtMenuItem); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); } - + } /** diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java index ecb54a5..afe2061 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java @@ -140,7 +140,7 @@ public class SwingMenuPeer { MenuItem item = awtMenu.getItem(i); item.addNotify(); - SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer(); + SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer(); menu.add(peer.menuItem); } } diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java index 5be82f6..d56e950 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java @@ -66,7 +66,7 @@ public class SwingTextAreaPeer { /** - * A spezialized Swing scroller used to hold the textarea. + * A spezialized Swing scroller used to hold the textarea. * * @author Roman Kennke (kennke@aicas.com) */ @@ -112,7 +112,7 @@ public class SwingTextAreaPeer else { ev.setSource(this); - this.dispatchEvent(ev); + this.dispatchEvent(ev); } } @@ -208,7 +208,7 @@ public class SwingTextAreaPeer par = SwingTextAreaPeer.this.awtComponent.getParent(); return par; } - + public void requestFocus() { SwingTextAreaPeer.this.requestFocus(awtComponent, false, true, 0); } @@ -311,7 +311,7 @@ public class SwingTextAreaPeer true, 0); } } - + /** * The actual JTextArea. */ @@ -349,7 +349,7 @@ public class SwingTextAreaPeer rows = 5; textArea.setRows(rows); } - + jTextArea.setColumns(columns); jTextArea.setRows(rows); } diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java index 28dc5f3..9750c9b 100644 --- a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java @@ -76,7 +76,7 @@ public class SwingTextFieldPeer SwingTextField(TextField textField) { - this.textField = textField; + this.textField = textField; } /** @@ -173,7 +173,7 @@ public class SwingTextFieldPeer processFocusEvent(ev); } - + public Container getParent() { Container par = null; @@ -186,7 +186,7 @@ public class SwingTextFieldPeer { return SwingTextFieldPeer.this.getGraphics(); } - + public void requestFocus() { SwingTextFieldPeer.this.requestFocus(awtComponent, false, true, 0); } diff --git a/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java b/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java index dde5b91..3cf3797 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java +++ b/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java @@ -72,7 +72,7 @@ public class GLGraphics extends AbstractGraphics2D public void setBackground(Color b) { super.setBackground(b); - + gl.clearColor(b.getRed() / 255.F, b.getGreen() / 255.F, b.getBlue() / 255.F, b.getAlpha() / 255.F); } @@ -128,7 +128,7 @@ public class GLGraphics extends AbstractGraphics2D { // FIXME: not sure it's correct return new Rectangle(0, 0, - gl.display.default_screen.width, + gl.display.default_screen.width, gl.display.default_screen.height); } } diff --git a/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java b/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java index 8cda31d..c982a30 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java +++ b/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java @@ -54,7 +54,7 @@ final class KeyboardMapping /** * Maps X keycodes to AWT keycodes. - * + * * @param xInput the X input event * @param xKeyCode the X keycode to map * @param xMods the X modifiers diff --git a/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java b/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java index 37983919..8e80b97 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java @@ -178,7 +178,7 @@ public class XEventPump { target = awtWindow; } - + MouseEvent mp = new MouseEvent(target, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), KeyboardMapping.mapModifiers(event.getState()) @@ -187,26 +187,26 @@ public class XEventPump 1, false, button); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp); } - + private void handleButtonRelease(ButtonRelease event) { Integer key = new Integer(event.getEventWindowID()); Window awtWindow = (Window) windows.get(key); int button = event.detail(); - + // AWT cannot handle more than 3 buttons and expects 0 instead. if (button >= gnu.x11.Input.BUTTON3) button = 0; drag = -1; - + Component target = findMouseEventTarget(awtWindow, event.getEventX(), event.getEventY()); if(target == null) { target = awtWindow; } - + MouseEvent mr = new MouseEvent(target, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), KeyboardMapping.mapModifiers(event.getState()) @@ -215,15 +215,15 @@ public class XEventPump 1, false, button); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr); } - - + + private void handleMotionNotify(MotionNotify event) { Integer key = new Integer(event.getEventWindowID()); Window awtWindow = (Window) windows.get(key); int button = event.detail(); - + // AWT cannot handle more than 3 buttons and expects 0 instead. if (button >= gnu.x11.Input.BUTTON3) button = 0; @@ -250,26 +250,26 @@ public class XEventPump } Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm); } - + // FIME: refactor and make faster, maybe caching the event and handle // and/or check timing (timing is generated for PropertyChange)? private void handleExpose(Expose event) { Integer key = new Integer(event.window_id); Window awtWindow = (Window) windows.get(key); - + if (XToolkit.DEBUG) System.err.println("expose request for window id: " + key); - + Rectangle r = new Rectangle(event.x(), event.y(), event.width(), event.height()); // We need to clear the background of the exposed rectangle. assert awtWindow != null : "awtWindow == null for window ID: " + key; - + Graphics g = awtWindow.getGraphics(); g.clearRect(r.x, r.y, r.width, r.height); g.dispose(); - + XWindowPeer xwindow = (XWindowPeer) awtWindow.getPeer(); Insets i = xwindow.insets(); if (event.width() != awtWindow.getWidth() - i.left - i.right @@ -279,75 +279,75 @@ public class XEventPump int h = event.height(); int x = xwindow.xwindow.x; int y = xwindow.xwindow.y; - + if (XToolkit.DEBUG) System.err.println("Setting size on AWT window: " + w + ", " + h + ", " + awtWindow.getWidth() + ", " + awtWindow.getHeight()); - + // new width and height xwindow.xwindow.width = w; xwindow.xwindow.height = h; - + // reshape the window ComponentReshapeEvent cre = new ComponentReshapeEvent(awtWindow, x, y, w, h); awtWindow.dispatchEvent(cre); } - + ComponentEvent ce = new ComponentEvent(awtWindow, ComponentEvent.COMPONENT_RESIZED); awtWindow.dispatchEvent(ce); - + PaintEvent pev = new PaintEvent(awtWindow, PaintEvent.UPDATE, r); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(pev); } - + private void handleDestroyNotify(DestroyNotify destroyNotify) { if (XToolkit.DEBUG) System.err.println("DestroyNotify event: " + destroyNotify); - + Integer key = new Integer(destroyNotify.event_window_id); Window awtWindow = (Window) windows.get(key); - + AWTEvent event = new WindowEvent(awtWindow, WindowEvent.WINDOW_CLOSED); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); } - + private void handleClientMessage(ClientMessage clientMessage) { if (XToolkit.DEBUG) System.err.println("ClientMessage event: " + clientMessage); - + if (clientMessage.delete_window()) { if (XToolkit.DEBUG) System.err.println("ClientMessage is a delete_window event"); - + Integer key = new Integer(clientMessage.window_id); Window awtWindow = (Window) windows.get(key); - + AWTEvent event = new WindowEvent(awtWindow, WindowEvent.WINDOW_CLOSING); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); } } - + private void handleEvent(Event xEvent) { if (XToolkit.DEBUG) System.err.println("fetched event: " + xEvent); - + switch (xEvent.code() & 0x7f) { case ButtonPress.CODE: this.handleButtonPress((ButtonPress) xEvent); break; case ButtonRelease.CODE: - this.handleButtonRelease((ButtonRelease) xEvent); + this.handleButtonRelease((ButtonRelease) xEvent); break; case MotionNotify.CODE: - this.handleMotionNotify((MotionNotify) xEvent); + this.handleMotionNotify((MotionNotify) xEvent); break; case Expose.CODE: this.handleExpose((Expose) xEvent); @@ -410,7 +410,7 @@ public class XEventPump keyChar); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke); } - + } else { @@ -438,9 +438,9 @@ public class XEventPump return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK; } - return 0; + return 0; } - + /** * Finds the heavyweight mouse event target. * diff --git a/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java b/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java index 4372c965..1902090 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java @@ -98,12 +98,12 @@ public class XFontPeer { /** * The ascent of the font. - */ + */ int ascent; /** * The descent of the font. - */ + */ int descent; /** @@ -253,7 +253,7 @@ public class XFontPeer * * @param c the char buffer holding the string * @param offset the starting offset of the string in the buffer - * @param length the number of characters in the string buffer + * @param length the number of characters in the string buffer * * @return the overall width of the specified string */ @@ -393,7 +393,7 @@ public class XFontPeer { return 1.F; // TODO: Provided by X?? } - + } /** @@ -410,7 +410,7 @@ public class XFontPeer /** * The font metrics for this font. */ - XFontMetrics fontMetrics; + XFontMetrics fontMetrics; /** * Creates a new XFontPeer for the specified font name, style and size. @@ -694,7 +694,7 @@ public class XFontPeer case Font.PLAIN: default: key.append("plain"); - + } String protoType = fontProperties.getProperty(key.toString()); diff --git a/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java b/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java index a355c68..cde6777 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java @@ -107,10 +107,10 @@ public class XFramePeer // TODO: Implement this. throw new UnsupportedOperationException("Not yet implemented."); } - + /** * Check if this frame peer supports being restacked. - * + * * @return true if this frame peer can be restacked, * false otherwise * @since 1.5 @@ -120,10 +120,10 @@ public class XFramePeer // TODO: Implement this. throw new UnsupportedOperationException("Not yet implemented."); } - + /** * Sets the bounds of this frame peer. - * + * * @param x the new x co-ordinate * @param y the new y co-ordinate * @param width the new width diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java index 0339a42..1fce2dc 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java @@ -325,7 +325,7 @@ public class XGraphics2D colorMap.put(c, col); }*/ //xgc.set_foreground(col); - + xgc.set_foreground(c.getRGB()); foreground = c; } @@ -394,19 +394,19 @@ public class XGraphics2D xdrawable.put_image(xgc, zpixmap, x, y); imageCache.put(image, zpixmap); } else { - + // TODO optimize reusing the rectangles Rectangle source = new Rectangle(0, 0, xdrawable.width, xdrawable.height); Rectangle target = new Rectangle(x, y, w, h); - - Rectangle destination = source.intersection(target); - + + Rectangle destination = source.intersection(target); + x = destination.x; y = destination.y; w = destination.width; h = destination.height; - + ZPixmap zpixmap = (ZPixmap) xdrawable.image(x, y, w, h, 0xffffffff, @@ -506,4 +506,3 @@ public class XGraphics2D } } - diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java index becb92a..aed11a3 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java @@ -127,7 +127,7 @@ public class XGraphicsConfiguration throw new UnsupportedOperationException("Not yet implemented"); default: throw new IllegalArgumentException("Unknown transparency type: " - + transparency); + + transparency); } return im; } @@ -159,8 +159,8 @@ public class XGraphicsConfiguration { Display d = device.getDisplay(); Screen screen = d.default_screen; - - return new Rectangle(0, 0, screen.width, screen.height); + + return new Rectangle(0, 0, screen.width, screen.height); } /** diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java index ca37f3a..6b65e14 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java @@ -136,7 +136,7 @@ public class XGraphicsDevice } catch (EscherServerConnectionException e) { - throw new RuntimeException(e.getCause()); + throw new RuntimeException(e.getCause()); } } } @@ -155,7 +155,7 @@ public class XGraphicsDevice throw new RuntimeException(e.getCause()); } } - + eventPump = new XEventPump(display); } return display; @@ -167,7 +167,7 @@ public class XGraphicsDevice } /** - * Tries to load the LocalSocket class and initiate a connection to the + * Tries to load the LocalSocket class and initiate a connection to the * local X server. */ private Socket createLocalSocket() diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java index 8ec8d57..7b1d82f 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java @@ -130,7 +130,7 @@ public class XGraphicsEnvironment defaultDevice = initDefaultDevice(); devices = new XGraphicsDevice[]{ defaultDevice }; } - + } /** diff --git a/libjava/classpath/gnu/java/awt/peer/x/XImage.java b/libjava/classpath/gnu/java/awt/peer/x/XImage.java index fa94d00..f3df89f 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XImage.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XImage.java @@ -81,7 +81,7 @@ public class XImage public ImageProducer getSource() { - return new XImageProducer(); + return new XImageProducer(); } /** @@ -113,11 +113,11 @@ public class XImage { pixmap.free(); } - + protected class XImageProducer implements ImageProducer { private Vector<ImageConsumer> consumers = new Vector<ImageConsumer>(); - + public void addConsumer(ImageConsumer ic) { if (ic != null && !isConsumer(ic)) @@ -148,30 +148,30 @@ public class XImage { int width = XImage.this.getWidth(null); int height = XImage.this.getHeight(null); - + XGraphics2D graphics = (XGraphics2D) getGraphics(); ColorModel model = graphics.getColorModel(); graphics.dispose(); - + ZPixmap zpixmap = (ZPixmap) XImage.this.pixmap.image(0, 0, width, height, 0xffffffff, gnu.x11.image.Image.Format.ZPIXMAP); - + int size = zpixmap.get_data_length(); System.out.println("size: " + size + ", w = " + width + ", h = " + height); - + int [] pixel = new int[size]; for (int i = 0; i < size; i++) pixel[i] = zpixmap.get_data_element(i); consumer.setHints(ImageConsumer.SINGLEPASS); - + consumer.setDimensions(width, height); consumer.setPixels(0, 0, width, height, model, pixel, 0, width); consumer.imageComplete(ImageConsumer.STATICIMAGEDONE); } - + System.out.println("done!"); } } diff --git a/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java b/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java index af12574..a3eeb0f 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java @@ -239,23 +239,23 @@ public class XToolkit protected ButtonPeer createButton(Button target) { checkHeadLess("No ButtonPeer can be created in an headless" + - "graphics environment."); - + "graphics environment."); + return new SwingButtonPeer(target); } protected TextFieldPeer createTextField(TextField target) { checkHeadLess("No TextFieldPeer can be created in an headless " + - "graphics environment."); - + "graphics environment."); + return new SwingTextFieldPeer(target); } protected LabelPeer createLabel(Label target) { checkHeadLess("No LabelPeer can be created in an headless graphics " + - "environment."); + "environment."); return new SwingLabelPeer(target); } @@ -269,7 +269,7 @@ public class XToolkit { checkHeadLess("No CheckboxPeer can be created in an headless graphics " + "environment."); - + return new SwingCheckboxPeer(target); } @@ -288,8 +288,8 @@ public class XToolkit protected TextAreaPeer createTextArea(TextArea target) { checkHeadLess("No TextAreaPeer can be created in an headless graphics " + - "environment."); - + "environment."); + return new SwingTextAreaPeer(target); } @@ -518,7 +518,7 @@ public class XToolkit /** * Creates an image that is returned when calls to createImage() yields an * error. - * + * * @return an image that is returned when calls to createImage() yields an * error */ @@ -660,7 +660,7 @@ public class XToolkit { if(message == null) message = "This method cannot be called in headless mode."; - + throw new HeadlessException(message); } } diff --git a/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java index 930247d..541eb74 100644 --- a/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java +++ b/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java @@ -80,7 +80,7 @@ public class XWindowPeer | Event.KEY_RELEASE_MASK //| Event.VISIBILITY_CHANGE_MASK // ; - + /** * The X window. */ @@ -105,10 +105,10 @@ public class XWindowPeer int h = Math.max(window.getHeight(), 1); xwindow = new Window(dev.getDisplay().default_root, x, y, w, h, 0, atts); xwindow.select_input(standardSelect); - + dev.getEventPump().registerWindow(xwindow, window); xwindow.set_wm_delete_window(); - + boolean undecorated; if (awtComponent instanceof Frame) { @@ -178,11 +178,11 @@ public class XWindowPeer */ public Graphics getGraphics() { - XGraphics2D xg2d = new XGraphics2D(xwindow); - xg2d.setColor(awtComponent.getForeground()); - xg2d.setBackground(awtComponent.getBackground()); - xg2d.setFont(awtComponent.getFont()); - return xg2d; + XGraphics2D xg2d = new XGraphics2D(xwindow); + xg2d.setColor(awtComponent.getForeground()); + xg2d.setBackground(awtComponent.getBackground()); + xg2d.setFont(awtComponent.getFont()); + return xg2d; } public Image createImage(int w, int h) @@ -226,7 +226,7 @@ public class XWindowPeer // // Reset input selection. // atts.set_override_redirect(false); // xwindow.change_attributes(atts); - + // Determine the frame insets. Atom atom = (Atom) Atom.intern(dev.getDisplay(), "_NET_FRAME_EXTENTS"); Window.Property p = xwindow.get_property(false, atom, Atom.CARDINAL, 0, @@ -295,7 +295,7 @@ public class XWindowPeer XGraphicsDevice dev = XToolkit.getDefaultDevice(); dev.getEventPump().unregisterWindow(xwindow); } - + public Window getXwindow() { return xwindow; diff --git a/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java b/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java index b86eea5..64d197c 100644 --- a/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java +++ b/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java @@ -107,47 +107,47 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics * If Pageable is non-null, it will print that, otherwise it will use * the supplied printable and pageFormat. */ - public SpooledDocument spoolPostScript(Printable printable, - PageFormat pageFormat, - Pageable pageable) + public SpooledDocument spoolPostScript(Printable printable, + PageFormat pageFormat, + Pageable pageable) throws PrinterException { - try + try { - // spool to a temporary file - File temp = File.createTempFile("cpspool", ".ps"); - temp.deleteOnExit(); - - PrintWriter out = new PrintWriter - (new BufferedWriter - (new OutputStreamWriter - (new FileOutputStream(temp), "ISO8859_1"), 1000000)); - - writePSHeader(out); - - if(pageable != null) - { - for(int index = 0; index < pageable.getNumberOfPages(); index++) - spoolPage(out, pageable.getPrintable(index), - pageable.getPageFormat(index), index); - } - else - { - int index = 0; - while(spoolPage(out, printable, pageFormat, index++) == - Printable.PAGE_EXISTS) + // spool to a temporary file + File temp = File.createTempFile("cpspool", ".ps"); + temp.deleteOnExit(); + + PrintWriter out = new PrintWriter + (new BufferedWriter + (new OutputStreamWriter + (new FileOutputStream(temp), "ISO8859_1"), 1000000)); + + writePSHeader(out); + + if(pageable != null) + { + for(int index = 0; index < pageable.getNumberOfPages(); index++) + spoolPage(out, pageable.getPrintable(index), + pageable.getPageFormat(index), index); + } + else + { + int index = 0; + while(spoolPage(out, printable, pageFormat, index++) == + Printable.PAGE_EXISTS) ; - } - out.println("%%Trailer"); - out.println("%%EOF"); - out.close(); - return new SpooledDocument( temp ); - } - catch (IOException e) + } + out.println("%%Trailer"); + out.println("%%EOF"); + out.close(); + return new SpooledDocument( temp ); + } + catch (IOException e) { - PrinterException pe = new PrinterException(); - pe.initCause(e); - throw pe; + PrinterException pe = new PrinterException(); + pe.initCause(e); + throw pe; } } @@ -156,9 +156,9 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics * PAGE_EXISTS if it was. */ public int spoolPage(PrintWriter out, - Printable printable, - PageFormat pageFormat, - int index) throws IOException, PrinterException + Printable printable, + PageFormat pageFormat, + int index) throws IOException, PrinterException { initImage( pageFormat ); if(printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE) @@ -168,22 +168,22 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics writePage( out, pageFormat ); return Printable.PAGE_EXISTS; } - + private void initImage(PageFormat pageFormat) { // Create a really big image and draw to that. xSize = (int)(DPI*pageFormat.getWidth()/72.0); ySize = (int)(DPI*pageFormat.getHeight()/72.0); - + // Swap X and Y sizes if it's a Landscape page. if( pageFormat.getOrientation() != PageFormat.PORTRAIT ) { - int t = xSize; - xSize = ySize; - ySize = t; + int t = xSize; + xSize = ySize; + ySize = t; } - // FIXME: This should at least be BufferedImage. + // FIXME: This should at least be BufferedImage. // Fix once we have a working B.I. // Graphics2D should also be supported of course. image = CairoSurface.getBufferedImage(xSize, ySize); @@ -196,7 +196,7 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics private void writePSHeader(PrintWriter out) { - out.println("%!PS-Adobe-3.0"); + out.println("%!PS-Adobe-3.0"); out.println("%%Title: "+printerJob.getJobName()); out.println("%%Creator: GNU Classpath "); out.println("%%DocumentData: Clean8Bit"); @@ -204,19 +204,19 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier"); // out.println("%%Pages: "+); // FIXME # pages. out.println("%%EndComments"); - + out.println("%%BeginProlog"); out.println("%%EndProlog"); out.println("%%BeginSetup"); - + // FIXME: Paper name // E.g. "A4" "Letter" // out.println("%%BeginFeature: *PageSize A4"); - + out.println("%%EndFeature"); out.println("%%EndSetup"); - + // out.println("%%Page: 1 1"); } @@ -232,14 +232,14 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics out.println( "%%Orientation: Portrait" ); else { - out.println( "%%Orientation: Landscape" ); - double t = pWidth; - pWidth = pHeight; - pHeight = t; + out.println( "%%Orientation: Landscape" ); + double t = pWidth; + pWidth = pHeight; + pHeight = t; } - + out.println("gsave % first save"); - + // 595x842; 612x792 respectively out.println("<< /PageSize [" +pWidth + " "+pHeight+ "] >> setpagedevice"); @@ -247,8 +247,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics AffineTransform pageTransform = new AffineTransform(); if( pageFormat.getOrientation() == PageFormat.REVERSE_LANDSCAPE ) { - pageTransform.translate(pWidth, pHeight); - pageTransform.scale(-1.0, -1.0); + pageTransform.translate(pWidth, pHeight); + pageTransform.scale(-1.0, -1.0); } concatCTM(out, pageTransform); out.println("%%EndPageSetup"); @@ -257,7 +257,7 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics // Draw the image - out.println(xSize+" "+ySize+" 8 [1 0 0 -1 0 "+ySize+" ]"); + out.println(xSize+" "+ySize+" 8 [1 0 0 -1 0 "+ySize+" ]"); out.println("{currentfile 3 string readhexstring pop} bind"); out.println("false 3 colorimage"); int[] pixels = new int[xSize * ySize]; @@ -272,19 +272,19 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics int n = 0; for (int j = 0; j < ySize; j++) { for (int i = 0; i < xSize; i++) { - out.print( colorTripleHex(pixels[j * xSize + i]) ); - if(((++n)%11) == 0) out.println(); + out.print( colorTripleHex(pixels[j * xSize + i]) ); + if(((++n)%11) == 0) out.println(); } } - + out.println(); out.println("%%EOF"); out.println("grestore"); out.println("showpage"); } - + /** - * Get a nonsperated hex RGB triple, e.g. FFFFFF = white + * Get a nonsperated hex RGB triple, e.g. FFFFFF = white */ private String colorTripleHex(int num){ String s = ""; @@ -292,10 +292,10 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics try { s = Integer.toHexString( ( num & 0x00FFFFFF ) ); if( s.length() < 6 ) - { - s = "000000"+s; - return s.substring(s.length()-6); - } + { + s = "000000"+s; + return s.substring(s.length()-6); + } } catch (Exception e){ s = "FFFFFF"; } @@ -306,7 +306,7 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics private void concatCTM(PrintWriter out, AffineTransform Tx){ double[] matrixElements = new double[6]; Tx.getMatrix(matrixElements); - + out.print("[ "); for(int i=0;i<6;i++) out.print(matrixElements[i]+" "); @@ -349,14 +349,14 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics { } - public void drawArc(int x, int y, int width, int height, int startAngle, - int arcAngle) + public void drawArc(int x, int y, int width, int height, int startAngle, + int arcAngle) { g.drawArc(x, y, width, height, startAngle, arcAngle); } - public boolean drawImage(Image img, int x, int y, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image img, int x, int y, Color bgcolor, + ImageObserver observer) { return g.drawImage(img, x, y, bgcolor, observer); } @@ -366,31 +366,31 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics return g.drawImage(img, x, y, observer); } - public boolean drawImage(Image img, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image img, int x, int y, int width, int height, + Color bgcolor, ImageObserver observer) { return g.drawImage(img, x, y, width, height, bgcolor, observer); } - public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) + public boolean drawImage(Image img, int x, int y, int width, int height, + ImageObserver observer) { return g.drawImage(img, x, y, width, height, observer); } - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, Color bgcolor, - ImageObserver observer) + public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, Color bgcolor, + ImageObserver observer) { - return g.drawImage(img, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, bgcolor, observer); + return g.drawImage(img, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, bgcolor, observer); } - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, ImageObserver observer) + public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { - return g.drawImage(img, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, observer); + return g.drawImage(img, dx1, dy1, dx2, dy2, + sx1, sy1, sx2, sy2, observer); } public void drawLine(int x1, int y1, int x2, int y2) @@ -413,8 +413,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.drawPolyline(xPoints, yPoints, nPoints); } - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void drawRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { g.drawRoundRect(x, y, width, height, arcWidth, arcHeight); } @@ -429,8 +429,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.drawString(str, x, y); } - public void fillArc(int x, int y, int width, int height, - int startAngle, int arcAngle) + public void fillArc(int x, int y, int width, int height, + int startAngle, int arcAngle) { g.fillArc(x, y, width, height, startAngle, arcAngle); } @@ -450,8 +450,8 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.fillRect(x, y, width, height); } - public void fillRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) + public void fillRoundRect(int x, int y, int width, int height, + int arcWidth, int arcHeight) { g.fillRoundRect(x, y, width, height, arcWidth, arcHeight); } @@ -516,4 +516,3 @@ public class JavaPrinterGraphics extends Graphics implements PrinterGraphics g.translate(x, y); } } - diff --git a/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java b/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java index adeeba0..295d231 100644 --- a/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java +++ b/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java @@ -113,15 +113,15 @@ public class JavaPrinterJob extends PrinterJob { // lookup all services without any constraints services = PrintServiceLookup.lookupPrintServices - (DocFlavor.INPUT_STREAM.POSTSCRIPT, null); + (DocFlavor.INPUT_STREAM.POSTSCRIPT, null); } private static final Class copyClass = (new Copies(1)).getClass(); private static final Class jobNameClass = (new JobName("", null)).getClass(); private static final Class userNameClass = (new RequestingUserName("", null)).getClass(); - + /** - * Initializes a new instance of <code>PrinterJob</code>. + * Initializes a new instance of <code>PrinterJob</code>. */ public JavaPrinterJob() { @@ -143,7 +143,7 @@ public class JavaPrinterJob extends PrinterJob else if( orientation.equals(OrientationRequested.LANDSCAPE) ) pageFormat.setOrientation(PageFormat.LANDSCAPE); else if( orientation.equals(OrientationRequested.REVERSE_LANDSCAPE) ) - pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); + pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); } /** @@ -203,11 +203,11 @@ public class JavaPrinterJob extends PrinterJob { try { - if(printJob != null && (printJob instanceof CancelablePrintJob)) - { - ((CancelablePrintJob)printJob).cancel(); - cancelled = true; - } + if(printJob != null && (printJob instanceof CancelablePrintJob)) + { + ((CancelablePrintJob)printJob).cancel(); + cancelled = true; + } } catch(PrintException pe) { @@ -261,20 +261,20 @@ public class JavaPrinterJob extends PrinterJob return; PostScriptGraphics2D pg = new PostScriptGraphics2D( this ); - SpooledDocument doc = pg.spoolPostScript( printable, pageFormat, - pageable ); + SpooledDocument doc = pg.spoolPostScript( printable, pageFormat, + pageable ); cancelled = false; printJob = printer.createPrintJob(); try { - printJob.print(doc, attributes); + printJob.print(doc, attributes); } - catch (PrintException pe) + catch (PrintException pe) { - PrinterException p = new PrinterException(); - p.initCause(pe); - throw p; + PrinterException p = new PrinterException(); + p.initCause(pe); + throw p; } // no printjob active. printJob = null; @@ -313,22 +313,22 @@ public class JavaPrinterJob extends PrinterJob throws HeadlessException { PrintService chosenPrinter = ServiceUI.printDialog - (null, 50, 50, services, null, + (null, 50, 50, services, null, DocFlavor.INPUT_STREAM.POSTSCRIPT, attributes); getPageAttributes(); if( chosenPrinter != null ) { - try - { - setPrintService( chosenPrinter ); - } - catch(PrinterException pe) - { - // Should not happen. - } - return true; + try + { + setPrintService( chosenPrinter ); + } + catch(PrinterException pe) + { + // Should not happen. + } + return true; } return false; } diff --git a/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java b/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java index 01894e5..10fc25c 100644 --- a/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java +++ b/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java @@ -126,7 +126,7 @@ class PostScriptGraphics2D extends Graphics2D private double Y = pageY; private boolean gradientOn = false; - /** + /** * Constructor * */ @@ -162,74 +162,74 @@ class PostScriptGraphics2D extends Graphics2D * If Pageable is non-null, it will print that, otherwise it will use * the supplied printable and pageFormat. */ - public SpooledDocument spoolPostScript(Printable printable, - PageFormat pageFormat, - Pageable pageable) + public SpooledDocument spoolPostScript(Printable printable, + PageFormat pageFormat, + Pageable pageable) throws PrinterException { - try + try { - // spool to a temporary file - File temp = File.createTempFile("cpspool", ".ps"); - temp.deleteOnExit(); - - out = new PrintWriter(new BufferedWriter - (new OutputStreamWriter - (new FileOutputStream(temp), - "ISO8859_1"), 1000000)); - - writePSHeader(); - - if(pageable != null) - { - for(int index = 0; index < pageable.getNumberOfPages(); index++) - spoolPage(out, pageable.getPrintable(index), - pageable.getPageFormat(index), index); - } - else - { - int index = 0; - while(spoolPage(out, printable, pageFormat, index++) == - Printable.PAGE_EXISTS) + // spool to a temporary file + File temp = File.createTempFile("cpspool", ".ps"); + temp.deleteOnExit(); + + out = new PrintWriter(new BufferedWriter + (new OutputStreamWriter + (new FileOutputStream(temp), + "ISO8859_1"), 1000000)); + + writePSHeader(); + + if(pageable != null) + { + for(int index = 0; index < pageable.getNumberOfPages(); index++) + spoolPage(out, pageable.getPrintable(index), + pageable.getPageFormat(index), index); + } + else + { + int index = 0; + while(spoolPage(out, printable, pageFormat, index++) == + Printable.PAGE_EXISTS) ; - } - out.println("%%Trailer"); - out.println("%%EOF"); - out.close(); - return new SpooledDocument( temp ); - } - catch (IOException e) + } + out.println("%%Trailer"); + out.println("%%EOF"); + out.close(); + return new SpooledDocument( temp ); + } + catch (IOException e) { - PrinterException pe = new PrinterException(); - pe.initCause(e); - throw pe; + PrinterException pe = new PrinterException(); + pe.initCause(e); + throw pe; } } //-------------------------------------------------------------------------- - /** + /** * Write the postscript file header, - * setup the page format and transforms. + * setup the page format and transforms. */ private void writePSHeader() { - out.println("%!PS-Adobe-3.0"); + out.println("%!PS-Adobe-3.0"); out.println("%%Title: "+printerJob.getJobName()); out.println("%%Creator: GNU Classpath "); out.println("%%DocumentData: Clean8Bit"); out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier"); out.println("%%EndComments"); - + out.println("%%BeginProlog"); out.println("%%EndProlog"); out.println("%%BeginSetup"); - + out.println("%%EndFeature"); setupFonts(); out.println("%%EndSetup"); - + // set default fonts and colors setFont( new Font("Dialog", Font.PLAIN, 12) ); currentColor = Color.white; @@ -268,9 +268,9 @@ class PostScriptGraphics2D extends Graphics2D * PAGE_EXISTS if it was. */ public int spoolPage(PrintWriter out, - Printable printable, - PageFormat pageFormat, - int index) throws IOException, PrinterException + Printable printable, + PageFormat pageFormat, + int index) throws IOException, PrinterException { out.println("%%BeginPageSetup"); @@ -282,23 +282,23 @@ class PostScriptGraphics2D extends Graphics2D out.println( "%%Orientation: Portrait" ); else { - out.println( "%%Orientation: Landscape" ); - double t = pageX; - pageX = pageY; - pageY = t; + out.println( "%%Orientation: Landscape" ); + double t = pageX; + pageX = pageY; + pageY = t; } - + setClip(0, 0, (int)pageX, (int)pageY); out.println("gsave % first save"); - + // 595x842; 612x792 respectively out.println("<< /PageSize [" +pageX + " "+pageY+ "] >> setpagedevice"); if( pageFormat.getOrientation() != PageFormat.LANDSCAPE ) { - pageTransform.translate(pageX, 0); - pageTransform.scale(-1.0, 1.0); + pageTransform.translate(pageX, 0); + pageTransform.scale(-1.0, 1.0); } // save the original CTM @@ -312,7 +312,7 @@ class PostScriptGraphics2D extends Graphics2D if( printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE ) return Printable.NO_SUCH_PAGE; - + out.println("grestore"); out.println("showpage"); @@ -417,7 +417,7 @@ class PostScriptGraphics2D extends Graphics2D setStroke(currentStroke); } - //--------------- Image drawing ------------------------------------------ + //--------------- Image drawing ------------------------------------------ public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) { @@ -425,7 +425,7 @@ class PostScriptGraphics2D extends Graphics2D int h = img.getHeight(null); return drawImage(img, x, y, x + w, y + h, 0, 0, w - 1, h - 1, bgcolor, - observer); + observer); } public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, @@ -439,31 +439,31 @@ class PostScriptGraphics2D extends Graphics2D // swap X and Y's if (sx1 > sx2) { - n = sx1; - sx1 = sx2; - sx2 = n; - flipx = ! flipx; + n = sx1; + sx1 = sx2; + sx2 = n; + flipx = ! flipx; } if (sy1 > sy2) { - n = sy1; - sy1 = sy2; - sy2 = n; - flipy = ! flipy; + n = sy1; + sy1 = sy2; + sy2 = n; + flipy = ! flipy; } if (dx1 > dx2) { - n = dx1; - dx1 = dx2; - dx2 = n; - flipx = ! flipx; + n = dx1; + dx1 = dx2; + dx2 = n; + flipx = ! flipx; } if (dy1 > dy2) { - n = dy1; - dy1 = dy2; - dy2 = n; - flipy = ! flipy; + n = dy1; + dy1 = dy2; + dy2 = n; + flipy = ! flipy; } n = 0; int sw = sx2 - sx1; // source width @@ -487,28 +487,28 @@ class PostScriptGraphics2D extends Graphics2D PixelGrabber pg = new PixelGrabber(img, sx1, sy1, sw, sh, pixels, 0, sw); try { - pg.grabPixels(); + pg.grabPixels(); } catch (InterruptedException e) { - System.err.println("interrupted waiting for pixels!"); - return (false); + System.err.println("interrupted waiting for pixels!"); + return (false); } if ((pg.getStatus() & ImageObserver.ABORT) != 0) { - System.err.println("image fetch aborted or errored"); - return (false); + System.err.println("image fetch aborted or errored"); + return (false); } for (int j = 0; j < sh; j++) { - for (int i = 0; i < sw; i++) - { - out.print(colorTripleHex(new Color(pixels[j * sw + i]))); - if (((++n) % 11) == 0) - out.println(); - } + for (int i = 0; i < sw; i++) + { + out.print(colorTripleHex(new Color(pixels[j * sw + i]))); + if (((++n) % 11) == 0) + out.println(); + } } out.println(); @@ -522,7 +522,7 @@ class PostScriptGraphics2D extends Graphics2D ImageObserver observer) { return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, - observer); + observer); } public boolean drawImage(Image img, int x, int y, ImageObserver observer) @@ -531,18 +531,18 @@ class PostScriptGraphics2D extends Graphics2D } public boolean drawImage(Image img, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + Color bgcolor, ImageObserver observer) { int sw = img.getWidth(null); int sh = img.getHeight(null); return drawImage(img, x, y, x + width, y + height, /* destination */ - 0, 0, sw - 1, sh - 1, /* source */ - bgcolor, observer); + 0, 0, sw - 1, sh - 1, /* source */ + bgcolor, observer); // correct? } public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) + ImageObserver observer) { return drawImage(img, x, y, width, height, null, observer); } @@ -602,8 +602,8 @@ class PostScriptGraphics2D extends Graphics2D if( currentFontIsPS ) { - drawStringPSFont(str, x, y); - return; + drawStringPSFont(str, x, y); + return; } TextLayout text = new TextLayout(str, currentFont, getFontRenderContext()); @@ -626,22 +626,22 @@ class PostScriptGraphics2D extends Graphics2D popCTM(); pushCTM(); - double[] test = + double[] test = { - pageTransform.getScaleX(), pageTransform.getShearY(), - pageTransform.getShearX(), pageTransform.getScaleY(), - pageTransform.getTranslateX(), - -pageTransform.getTranslateY() + pageY + pageTransform.getScaleX(), pageTransform.getShearY(), + pageTransform.getShearX(), pageTransform.getScaleY(), + pageTransform.getTranslateX(), + -pageTransform.getTranslateY() + pageY }; - double[] test2 = + double[] test2 = { - currentTransform.getScaleX(), - currentTransform.getShearY(), - -currentTransform.getShearX(), - -currentTransform.getScaleY(), - currentTransform.getTranslateX(), - currentTransform.getTranslateY() + currentTransform.getScaleX(), + currentTransform.getShearY(), + -currentTransform.getShearX(), + -currentTransform.getScaleY(), + currentTransform.getTranslateX(), + currentTransform.getTranslateY() }; AffineTransform total = new AffineTransform(test); @@ -673,43 +673,43 @@ class PostScriptGraphics2D extends Graphics2D while (! pi.isDone()) { - switch (pi.currentSegment(coords)) - { - case PathIterator.SEG_MOVETO: - out.println((coords[0]) + " " + (Y - coords[1]) + " moveto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_LINETO: - out.println((coords[0]) + " " + (Y - coords[1]) + " lineto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_QUADTO: - // convert to cubic bezier points - float x1 = (cx + 2 * coords[0]) / 3; - float y1 = (cy + 2 * coords[1]) / 3; - float x2 = (2 * coords[2] + coords[0]) / 3; - float y2 = (2 * coords[3] + coords[1]) / 3; - - out.print((x1) + " " + (Y - y1) + " "); - out.print((x2) + " " + (Y - y2) + " "); - out.println((coords[2]) + " " + (Y - coords[3]) + " curveto"); - cx = coords[2]; - cy = coords[3]; - break; - case PathIterator.SEG_CUBICTO: - out.print((coords[0]) + " " + (Y - coords[1]) + " "); - out.print((coords[2]) + " " + (Y - coords[3]) + " "); - out.println((coords[4]) + " " + (Y - coords[5]) + " curveto"); - cx = coords[4]; - cy = coords[5]; - break; - case PathIterator.SEG_CLOSE: - out.println("closepath"); - break; - } - pi.next(); + switch (pi.currentSegment(coords)) + { + case PathIterator.SEG_MOVETO: + out.println((coords[0]) + " " + (Y - coords[1]) + " moveto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + out.println((coords[0]) + " " + (Y - coords[1]) + " lineto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_QUADTO: + // convert to cubic bezier points + float x1 = (cx + 2 * coords[0]) / 3; + float y1 = (cy + 2 * coords[1]) / 3; + float x2 = (2 * coords[2] + coords[0]) / 3; + float y2 = (2 * coords[3] + coords[1]) / 3; + + out.print((x1) + " " + (Y - y1) + " "); + out.print((x2) + " " + (Y - y2) + " "); + out.println((coords[2]) + " " + (Y - coords[3]) + " curveto"); + cx = coords[2]; + cy = coords[3]; + break; + case PathIterator.SEG_CUBICTO: + out.print((coords[0]) + " " + (Y - coords[1]) + " "); + out.print((coords[2]) + " " + (Y - coords[3]) + " "); + out.println((coords[4]) + " " + (Y - coords[5]) + " curveto"); + cx = coords[4]; + cy = coords[5]; + break; + case PathIterator.SEG_CLOSE: + out.println("closepath"); + break; + } + pi.next(); } out.println("fill"); @@ -851,7 +851,7 @@ class PostScriptGraphics2D extends Graphics2D try { - out.close(); + out.close(); } catch (Exception e) { @@ -877,43 +877,43 @@ class PostScriptGraphics2D extends Graphics2D while (! pi.isDone()) { - switch (pi.currentSegment(coords)) - { - case PathIterator.SEG_MOVETO: - out.println(coords[0] + " " + (coords[1]) + " moveto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_LINETO: - out.println(coords[0] + " " + (coords[1]) + " lineto"); - cx = coords[0]; - cy = coords[1]; - break; - case PathIterator.SEG_QUADTO: - // convert to cubic bezier points - float x1 = (cx + 2 * coords[0]) / 3; - float y1 = (cy + 2 * coords[1]) / 3; - float x2 = (2 * coords[2] + coords[0]) / 3; - float y2 = (2 * coords[3] + coords[1]) / 3; - - out.print(x1 + " " + (Y - y1) + " "); - out.print(x2 + " " + (Y - y2) + " "); - out.println(coords[2] + " " + (Y - coords[3]) + " curveto"); - cx = coords[2]; - cy = coords[3]; - break; - case PathIterator.SEG_CUBICTO: - out.print(coords[0] + " " + coords[1] + " "); - out.print(coords[2] + " " + coords[3] + " "); - out.println(coords[4] + " " + coords[5] + " curveto"); - cx = coords[4]; - cy = coords[5]; - break; - case PathIterator.SEG_CLOSE: - out.println("closepath"); - break; - } - pi.next(); + switch (pi.currentSegment(coords)) + { + case PathIterator.SEG_MOVETO: + out.println(coords[0] + " " + (coords[1]) + " moveto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + out.println(coords[0] + " " + (coords[1]) + " lineto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_QUADTO: + // convert to cubic bezier points + float x1 = (cx + 2 * coords[0]) / 3; + float y1 = (cy + 2 * coords[1]) / 3; + float x2 = (2 * coords[2] + coords[0]) / 3; + float y2 = (2 * coords[3] + coords[1]) / 3; + + out.print(x1 + " " + (Y - y1) + " "); + out.print(x2 + " " + (Y - y2) + " "); + out.println(coords[2] + " " + (Y - coords[3]) + " curveto"); + cx = coords[2]; + cy = coords[3]; + break; + case PathIterator.SEG_CUBICTO: + out.print(coords[0] + " " + coords[1] + " "); + out.print(coords[2] + " " + coords[3] + " "); + out.println(coords[4] + " " + coords[5] + " curveto"); + cx = coords[4]; + cy = coords[5]; + break; + case PathIterator.SEG_CLOSE: + out.println("closepath"); + break; + } + pi.next(); } } @@ -923,8 +923,8 @@ class PostScriptGraphics2D extends Graphics2D { clipShape = s; out.println("% clip INACTIVE"); - // writeShape(s); - // out.println("clip"); + // writeShape(s); + // out.println("clip"); } /** Strokes the outline of a Shape using the @@ -946,7 +946,7 @@ class PostScriptGraphics2D extends Graphics2D out.println("% drawGlyphVector"); Shape s = gv.getOutline(); drawStringShape(AffineTransform.getTranslateInstance(x, y) - .createTransformedShape(s)); + .createTransformedShape(s)); } /** Renders the text of the specified iterator, @@ -971,17 +971,17 @@ class PostScriptGraphics2D extends Graphics2D out.println("% fill"); if (! gradientOn) { - writeShape(s); - out.println("fill"); + writeShape(s); + out.println("fill"); } else { - out.println("gsave"); - writeShape(s); - out.println("clip"); - writeGradient(); - out.println("shfill"); - out.println("grestore"); + out.println("gsave"); + writeShape(s); + out.println("clip"); + writeGradient(); + out.println("shfill"); + out.println("grestore"); } } @@ -1011,10 +1011,10 @@ class PostScriptGraphics2D extends Graphics2D { out.println("% getFontRenderContext()"); - double[] scaling = + double[] scaling = { - pageTransform.getScaleX(), 0, 0, - -pageTransform.getScaleY(), 0, 0 + pageTransform.getScaleX(), 0, 0, + -pageTransform.getScaleY(), 0, 0 }; return (new FontRenderContext(new AffineTransform(scaling), false, true)); @@ -1050,15 +1050,15 @@ class PostScriptGraphics2D extends Graphics2D return currentTransform; } - /** - * Checks whether or not the specified Shape intersects - * the specified Rectangle, which is in device space. + /** + * Checks whether or not the specified Shape intersects + * the specified Rectangle, which is in device space. */ public boolean hit(Rectangle rect, Shape s, boolean onStroke) { Rectangle2D.Double r = new Rectangle2D.Double(rect.getX(), rect.getY(), - rect.getWidth(), - rect.getHeight()); + rect.getWidth(), + rect.getHeight()); return s.intersects(r); } @@ -1082,13 +1082,13 @@ class PostScriptGraphics2D extends Graphics2D gradientOn = false; if (paint instanceof Color) { - setColor((Color) paint); - return; + setColor((Color) paint); + return; } if (paint instanceof GradientPaint) { - gradientOn = true; - return; + gradientOn = true; + return; } } @@ -1096,13 +1096,13 @@ class PostScriptGraphics2D extends Graphics2D private String colorTriple(Color c) { return (((double) c.getRed() / 255.0) + " " - + ((double) c.getGreen() / 255.0) + " " - + ((double) c.getBlue() / 255.0)); + + ((double) c.getGreen() / 255.0) + " " + + ((double) c.getBlue() / 255.0)); } /** * Get a nonsperated hex RGB triple, eg FFFFFF = white - * used by writeGradient and drawImage + * used by writeGradient and drawImage */ private String colorTripleHex(Color c) { @@ -1135,11 +1135,11 @@ class PostScriptGraphics2D extends Graphics2D // get number of repetitions while (x + n * dx < pageY && y + n * dy < pageX && x + n * dx > 0 - && y + n * dy > 0) + && y + n * dy > 0) n++; out.println("<<"); // start - out.println("/ShadingType 2"); // gradient fill + out.println("/ShadingType 2"); // gradient fill out.println("/ColorSpace [ /DeviceRGB ]"); // RGB colors out.print("/Coords ["); out.print(x + " " + y + " " + (x + n * dx) + " " + (y + n * dy) + " "); @@ -1152,17 +1152,17 @@ class PostScriptGraphics2D extends Graphics2D out.println("/BitsPerSample 8"); out.println("/Size [ " + (1 + n) + " ]"); out.print("/DataSource < " + colorTripleHex(paint.getColor1()) + " " - + colorTripleHex(paint.getColor2()) + " "); + + colorTripleHex(paint.getColor2()) + " "); for (; n > 1; n--) if (paint.isCyclic()) - { - if ((n % 2) == 1) - out.print(colorTripleHex(paint.getColor1()) + " "); - else - out.print(colorTripleHex(paint.getColor2()) + " "); - } + { + if ((n % 2) == 1) + out.print(colorTripleHex(paint.getColor1()) + " "); + else + out.print(colorTripleHex(paint.getColor2()) + " "); + } else - out.print(colorTripleHex(paint.getColor2()) + " "); + out.print(colorTripleHex(paint.getColor2()) + " "); out.println(">"); out.println(">>"); out.println(">>"); @@ -1181,7 +1181,7 @@ class PostScriptGraphics2D extends Graphics2D /* we don't allow the changing of rendering hints. */ } - /** + /** * Sets the Stroke for the Graphics2D context. BasicStroke fully implemented. */ public void setStroke(Stroke s) @@ -1195,53 +1195,53 @@ class PostScriptGraphics2D extends Graphics2D out.println("% setStroke()"); try { - // set the line width - out.println(bs.getLineWidth() + " setlinewidth"); - - // set the line dash - float[] dashArray = bs.getDashArray(); - if (dashArray != null) - { - out.print("[ "); - for (int i = 0; i < dashArray.length; i++) - out.print(dashArray[i] + " "); - out.println("] " + bs.getDashPhase() + " setdash"); - } - else - out.println("[] 0 setdash"); // set solid - - // set the line cap - switch (bs.getEndCap()) - { - case BasicStroke.CAP_BUTT: - out.println("0 setlinecap"); - break; - case BasicStroke.CAP_ROUND: - out.println("1 setlinecap"); - break; - case BasicStroke.CAP_SQUARE: - out.println("2 setlinecap"); - break; - } - - // set the line join - switch (bs.getLineJoin()) - { - case BasicStroke.JOIN_BEVEL: - out.println("2 setlinejoin"); - break; - case BasicStroke.JOIN_MITER: - out.println("0 setlinejoin"); - out.println(bs.getMiterLimit() + " setmiterlimit"); - break; - case BasicStroke.JOIN_ROUND: - out.println("1 setlinejoin"); - break; - } + // set the line width + out.println(bs.getLineWidth() + " setlinewidth"); + + // set the line dash + float[] dashArray = bs.getDashArray(); + if (dashArray != null) + { + out.print("[ "); + for (int i = 0; i < dashArray.length; i++) + out.print(dashArray[i] + " "); + out.println("] " + bs.getDashPhase() + " setdash"); + } + else + out.println("[] 0 setdash"); // set solid + + // set the line cap + switch (bs.getEndCap()) + { + case BasicStroke.CAP_BUTT: + out.println("0 setlinecap"); + break; + case BasicStroke.CAP_ROUND: + out.println("1 setlinecap"); + break; + case BasicStroke.CAP_SQUARE: + out.println("2 setlinecap"); + break; + } + + // set the line join + switch (bs.getLineJoin()) + { + case BasicStroke.JOIN_BEVEL: + out.println("2 setlinejoin"); + break; + case BasicStroke.JOIN_MITER: + out.println("0 setlinejoin"); + out.println(bs.getMiterLimit() + " setmiterlimit"); + break; + case BasicStroke.JOIN_ROUND: + out.println("1 setlinejoin"); + break; + } } catch (Exception e) { - out.println("% Exception in setStroke()"); + out.println("% Exception in setStroke()"); } } diff --git a/libjava/classpath/gnu/java/awt/print/SpooledDocument.java b/libjava/classpath/gnu/java/awt/print/SpooledDocument.java index 812906b..5481998 100644 --- a/libjava/classpath/gnu/java/awt/print/SpooledDocument.java +++ b/libjava/classpath/gnu/java/awt/print/SpooledDocument.java @@ -53,13 +53,13 @@ public class SpooledDocument implements Doc public SpooledDocument(File file) { - try + try { - fis = new FileInputStream(file); + fis = new FileInputStream(file); } - catch (FileNotFoundException ffne) + catch (FileNotFoundException ffne) { - // Shouldn't happen. + // Shouldn't happen. } } @@ -77,7 +77,7 @@ public class SpooledDocument implements Doc { return fis; } - + public Reader getReaderForText() { return new InputStreamReader(fis); |