Imported GNU Classpath 0.92

2006-08-14  Mark Wielaard  <mark@klomp.org>

       Imported GNU Classpath 0.92
       * HACKING: Add more importing hints. Update automake version
       requirement.

       * configure.ac (gconf-peer): New enable AC argument.
       Add --disable-gconf-peer and --enable-default-preferences-peer
       to classpath configure when gconf is disabled.
       * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
       gnu/java/awt/dnd/peer/gtk to bc. Classify
       gnu/java/security/Configuration.java as generated source file.

       * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
       gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
       gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
       gnu/java/lang/management/VMThreadMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryMXBeanImpl.java,
       gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
       classes.
       * java/lang/management/VMManagementFactory.java: Likewise.
       * java/net/VMURLConnection.java: Likewise.
       * gnu/java/nio/VMChannel.java: Likewise.

       * java/lang/Thread.java (getState): Add stub implementation.
       * java/lang/Class.java (isEnum): Likewise.
       * java/lang/Class.h (isEnum): Likewise.

       * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.

       * javax/naming/spi/NamingManager.java: New override for StackWalker
       functionality.

       * configure, sources.am, Makefile.in, gcj/Makefile.in,
       include/Makefile.in, testsuite/Makefile.in: Regenerated.

From-SVN: r116139
This commit is contained in:
Mark Wielaard 2006-08-14 23:12:35 +00:00
parent abab460491
commit ac1ed908de
1294 changed files with 99479 additions and 35933 deletions

View file

@ -40,6 +40,7 @@ package gnu.java.awt.peer.gtk;
import gnu.java.awt.ClasspathToolkit;
import java.awt.AWTPermission;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
@ -52,11 +53,11 @@ import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.Polygon;
import java.awt.TexturePaint;
import java.awt.Toolkit;
import java.awt.font.FontRenderContext;
@ -65,8 +66,8 @@ import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
@ -322,6 +323,11 @@ public abstract class CairoGraphics2D extends Graphics2D
* Set the current transform matrix
*/
private native void cairoSetMatrix(long pointer, double[] m);
/**
* Scaling method
*/
private native void cairoScale(long pointer, double x, double y);
/**
* Set the compositing operator
@ -369,6 +375,18 @@ public abstract class CairoGraphics2D extends Graphics2D
*/
private native void cairoRectangle(long pointer, double x, double y,
double width, double height);
/**
* Appends an arc to the current path
*/
private native void cairoArc(long pointer, double x, double y,
double radius, double angle1, double angle2);
/**
* Save / restore a cairo path
*/
private native void cairoSave(long pointer);
private native void cairoRestore(long pointer);
/**
* New current path
@ -427,6 +445,46 @@ public abstract class CairoGraphics2D extends Graphics2D
*/
private native void cairoSurfaceSetFilter(long pointer, int filter);
/**
* Draws a line from (x1,y1) to (x2,y2).
*
* @param pointer the native pointer
*
* @param x1 the x coordinate of the starting point
* @param y1 the y coordinate of the starting point
* @param x2 the x coordinate of the end point
* @param y2 the y coordinate of the end point
*/
private native void cairoDrawLine(long pointer, double x1, double y1,
double x2, double y2);
/**
* Draws a rectangle at starting point (x,y) and with the specified width
* and height.
*
* @param pointer the native pointer
* @param x the x coordinate of the upper left corner
* @param y the y coordinate of the upper left corner
* @param w the width of the rectangle
* @param h the height of the rectangle
*/
private native void cairoDrawRect(long pointer, double x, double y, double w,
double h);
/**
* Fills a rectangle at starting point (x,y) and with the specified width
* and height.
*
* @param pointer the native pointer
* @param x the x coordinate of the upper left corner
* @param y the y coordinate of the upper left corner
* @param w the width of the rectangle
* @param h the height of the rectangle
*/
private native void cairoFillRect(long pointer, double x, double y, double w,
double h);
///////////////////////// TRANSFORMS ///////////////////////////////////
/**
* Set the current transform
@ -625,8 +683,8 @@ public abstract class CairoGraphics2D extends Graphics2D
int width = (int) tp.getAnchorRect().getWidth();
int height = (int) tp.getAnchorRect().getHeight();
double scaleX = (width+1) / (double) img.getWidth();
double scaleY = (height+1) / (double) img.getHeight();
double scaleX = width / (double) img.getWidth();
double scaleY = height / (double) img.getHeight();
AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, 0, 0);
AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
@ -737,7 +795,7 @@ public abstract class CairoGraphics2D extends Graphics2D
else
{
GeneralPath p = new GeneralPath();
PathIterator pi = clip.getPathIterator(new AffineTransform());
PathIterator pi = clip.getPathIterator(null);
p.append(pi, false);
return p;
}
@ -847,6 +905,12 @@ public abstract class CairoGraphics2D extends Graphics2D
}
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"));
// FIXME: implement general Composite support
throw new java.lang.UnsupportedOperationException();
}
@ -857,49 +921,21 @@ public abstract class CairoGraphics2D extends Graphics2D
public void draw(Shape s)
{
if ((stroke != null && ! (stroke instanceof BasicStroke))
|| (comp instanceof AlphaComposite
&& ((AlphaComposite) comp).getAlpha() != 1.0))
|| (comp instanceof AlphaComposite && ((AlphaComposite) comp).getAlpha() != 1.0))
{
// FIXME: This is a hack to work around BasicStrokes's current
// limitations wrt cubic curves.
// See CubicSegment.getDisplacedSegments().
if (stroke instanceof BasicStroke)
{
PathIterator flatten = s.getPathIterator(new AffineTransform(),
1.0);
GeneralPath p = new GeneralPath();
p.append(flatten, false);
s = p;
}
fill(stroke.createStrokedShape(s));
return;
// Cairo doesn't support stroking with alpha, so we create the stroked
// shape and fill with alpha instead
fill(stroke.createStrokedShape(s));
return;
}
cairoNewPath(nativePointer);
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D) s;
cairoRectangle(nativePointer, shifted(r.getX(), shiftDrawCalls),
shifted(r.getY(), shiftDrawCalls), r.getWidth(),
r.getHeight());
}
else
walkPath(s.getPathIterator(null), shiftDrawCalls);
createPath(s);
cairoStroke(nativePointer);
}
public void fill(Shape s)
{
cairoNewPath(nativePointer);
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D) s;
cairoRectangle(nativePointer, r.getX(), r.getY(), r.getWidth(),
r.getHeight());
}
else
walkPath(s.getPathIterator(null), false);
createPath(s);
double alpha = 1.0;
if (comp instanceof AlphaComposite)
@ -907,6 +943,59 @@ public abstract class CairoGraphics2D extends Graphics2D
cairoFill(nativePointer, alpha);
}
private void createPath(Shape s)
{
cairoNewPath(nativePointer);
// Optimize rectangles, since there is a direct Cairo function
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D) s;
cairoRectangle(nativePointer, shifted(r.getX(), shiftDrawCalls),
shifted(r.getY(), shiftDrawCalls), r.getWidth(),
r.getHeight());
}
// We can optimize ellipses too; however we don't bother optimizing arcs:
// the iterator is fast enough (an ellipse requires 5 steps using the
// iterator, while most arcs are only 2-3)
else if (s instanceof Ellipse2D)
{
Ellipse2D e = (Ellipse2D) s;
double radius = Math.min(e.getHeight(), e.getWidth()) / 2;
// Cairo only draws circular shapes, but we can use a stretch to make
// them into ellipses
double xscale = 1, yscale = 1;
if (e.getHeight() != e.getWidth())
{
cairoSave(nativePointer);
if (e.getHeight() < e.getWidth())
xscale = e.getWidth() / (radius * 2);
else
yscale = e.getHeight() / (radius * 2);
if (xscale != 1 || yscale != 1)
cairoScale(nativePointer, xscale, yscale);
}
cairoArc(nativePointer,
shifted(e.getCenterX() / xscale, shiftDrawCalls),
shifted(e.getCenterY() / yscale, shiftDrawCalls), radius, 0,
Math.PI * 2);
if (xscale != 1 || yscale != 1)
cairoRestore(nativePointer);
}
// All other shapes are broken down and drawn in steps using the
// PathIterator
else
walkPath(s.getPathIterator(null), shiftDrawCalls);
}
/**
* 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
@ -940,12 +1029,19 @@ public abstract class CairoGraphics2D extends Graphics2D
public void drawLine(int x1, int y1, int x2, int y2)
{
draw(new Line2D.Double(x1, y1, x2, y2));
// The coordinates being pairwise identical means one wants
// to draw a single pixel. This is emulated by drawing
// a one pixel sized rectangle.
if (x1 == x2 && y1 == y2)
cairoFillRect(nativePointer, x1, y1, 1, 1);
else
cairoDrawLine(nativePointer, x1 + 0.5, y1 + 0.5, x2 + 0.5, y2 + 0.5);
}
public void drawRect(int x, int y, int width, int height)
{
draw(new Rectangle(x, y, width, height));
cairoDrawRect(nativePointer, shifted(x, shiftDrawCalls),
shifted(y, shiftDrawCalls), width, height);
}
public void fillArc(int x, int y, int width, int height, int startAngle,
@ -958,7 +1054,7 @@ public abstract class CairoGraphics2D extends Graphics2D
public void fillRect(int x, int y, int width, int height)
{
fill(new Rectangle(x, y, width, height));
cairoFillRect(nativePointer, x, y, width, height);
}
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
@ -1137,6 +1233,9 @@ public abstract class CairoGraphics2D extends Graphics2D
if (img == null)
return false;
if (xform == null)
xform = new AffineTransform();
// 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
@ -1160,6 +1259,7 @@ public abstract class CairoGraphics2D extends Graphics2D
// Note - this can get us in trouble when the gdk lock is re-acquired.
// for example by VolatileImage. See ComponentGraphics for how we work
// around this.
if( !(img instanceof BufferedImage) )
{
ImageProducer source = img.getSource();
@ -1176,6 +1276,7 @@ public abstract class CairoGraphics2D extends Graphics2D
// If this BufferedImage has a BufferedImageGraphics object,
// use the cached CairoSurface that BIG is drawing onto
if( BufferedImageGraphics.bufferedImages.get( b ) != null )
db = (DataBuffer)BufferedImageGraphics.bufferedImages.get( b );
else
@ -1190,6 +1291,7 @@ public abstract class CairoGraphics2D extends Graphics2D
if(db instanceof CairoSurface)
{
((CairoSurface)db).drawSurface(nativePointer, i2u, alpha);
updateColor();
return true;
}
@ -1206,24 +1308,7 @@ public abstract class CairoGraphics2D extends Graphics2D
setPaint( oldPaint );
}
int[] pixels;
// Shortcut for easy color models.
if( b.getColorModel().equals(rgb32) )
{
pixels = ((DataBufferInt)db).getData();
for(int i = 0; i < pixels.length; i++)
pixels[i] |= 0xFF000000;
}
else if( b.getColorModel().equals(argb32) )
{
pixels = ((DataBufferInt)db).getData();
}
else
{
pixels = b.getRGB(0, 0, width, height,
null, 0, width);
}
int[] pixels = b.getRGB(0, 0, width, height, null, 0, width);
drawPixels(nativePointer, pixels, width, height, width, i2u, alpha);
@ -1249,7 +1334,9 @@ public abstract class CairoGraphics2D extends Graphics2D
public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y)
{
Image filtered = op.filter(image, null);
Image filtered = image;
if (op != null)
filtered = op.filter(image, null);
drawImage(filtered, new AffineTransform(1f, 0f, 0f, 1f, x, y), null, null);
}
@ -1317,7 +1404,7 @@ public abstract class CairoGraphics2D extends Graphics2D
else
{ cy = dy2; ch = dy1 - dy2; }
setClip( cx, cy, cw, ch );
clipRect( cx, cy, cw, ch );
AffineTransform tx = new AffineTransform();
tx.translate( dx1 - sx1*scaleX, dy1 - sy1*scaleY );
@ -1358,6 +1445,10 @@ public abstract class CairoGraphics2D extends Graphics2D
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
double alpha = 1.0;
if( gv.getNumGlyphs() <= 0 )
return;
if (comp instanceof AlphaComposite)
alpha = ((AlphaComposite) comp).getAlpha();
if (gv instanceof FreetypeGlyphVector && alpha == 1.0)
@ -1367,8 +1458,11 @@ public abstract class CairoGraphics2D extends Graphics2D
float[] positions = gv.getGlyphPositions (0, n, null);
setFont (gv.getFont ());
cairoDrawGlyphVector(nativePointer, (GdkFontPeer)getFont().getPeer(),
x, y, n, codes, positions);
synchronized( this.font )
{
cairoDrawGlyphVector(nativePointer, (GdkFontPeer)getFont().getPeer(),
x, y, n, codes, positions);
}
}
else
{