Imported GNU Classpath 0.20
Imported GNU Classpath 0.20 * Makefile.am (AM_CPPFLAGS): Add classpath/include. * java/nio/charset/spi/CharsetProvider.java: New override file. * java/security/Security.java: Likewise. * sources.am: Regenerated. * Makefile.in: Likewise. From-SVN: r109831
This commit is contained in:
parent
bcb36c3e02
commit
2127637945
444 changed files with 75778 additions and 30731 deletions
|
@ -48,7 +48,6 @@ import java.awt.Graphics;
|
|||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Shape;
|
||||
import java.awt.SystemColor;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
|
||||
|
@ -81,18 +80,23 @@ public class GdkGraphics extends Graphics
|
|||
native void initStateUnlocked (GtkComponentPeer component);
|
||||
native void initState (int width, int height);
|
||||
native void initFromImage (GtkImage image);
|
||||
native void copyState (GdkGraphics g);
|
||||
native void nativeCopyState (GdkGraphics g);
|
||||
|
||||
/**
|
||||
* A cached instance that is used by {@link #create} in order to avoid
|
||||
* massive allocation of graphics contexts.
|
||||
*/
|
||||
GdkGraphics cached = null;
|
||||
|
||||
/**
|
||||
* A link to the parent context. This is used in {@link #dispose} to put
|
||||
* this graphics context into the cache.
|
||||
*/
|
||||
GdkGraphics parent = null;
|
||||
|
||||
GdkGraphics (GdkGraphics g)
|
||||
{
|
||||
color = g.color;
|
||||
xorColor = g.xorColor;
|
||||
font = g.font;
|
||||
if (font == null)
|
||||
font = new Font ("Dialog", Font.PLAIN, 12);
|
||||
clip = new Rectangle (g.clip);
|
||||
component = g.component;
|
||||
|
||||
parent = g;
|
||||
copyState (g);
|
||||
}
|
||||
|
||||
|
@ -162,12 +166,54 @@ public class GdkGraphics extends Graphics
|
|||
public native void copyArea(int x, int y, int width, int height,
|
||||
int dx, int dy);
|
||||
|
||||
public Graphics create ()
|
||||
/**
|
||||
* Creates a copy of this GdkGraphics instance. This implementation can
|
||||
* reuse a cached instance to avoid massive instantiation of Graphics objects
|
||||
* during painting.
|
||||
*
|
||||
* @return a copy of this graphics context
|
||||
*/
|
||||
public Graphics create()
|
||||
{
|
||||
return new GdkGraphics (this);
|
||||
GdkGraphics copy = cached;
|
||||
if (copy == null)
|
||||
copy = new GdkGraphics(this);
|
||||
else
|
||||
{
|
||||
copy.copyState(this);
|
||||
cached = null;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
public native void dispose();
|
||||
public native void nativeDispose();
|
||||
|
||||
/**
|
||||
* Disposes this graphics object. This puts this graphics context into the
|
||||
* cache of its parent graphics if there is one.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
if (parent != null)
|
||||
{
|
||||
parent.cached = this;
|
||||
parent = null;
|
||||
}
|
||||
else
|
||||
nativeDispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when this object gets finalized by the garbage collector.
|
||||
* In addition to {@link Graphics#finalize()} this calls nativeDispose() to
|
||||
* make sure the native resources are freed before the graphics context is
|
||||
* thrown away.
|
||||
*/
|
||||
public void finalize()
|
||||
{
|
||||
super.finalize();
|
||||
nativeDispose();
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int x, int y,
|
||||
Color bgcolor, ImageObserver observer)
|
||||
|
@ -248,9 +294,8 @@ public class GdkGraphics extends Graphics
|
|||
public void drawString (String str, int x, int y)
|
||||
{
|
||||
drawString(getFontPeer(), str, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawString (AttributedCharacterIterator ci, int x, int y)
|
||||
{
|
||||
throw new Error ("not implemented");
|
||||
|
@ -419,4 +464,23 @@ public class GdkGraphics extends Graphics
|
|||
|
||||
translateNative (x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies over the state of another GdkGraphics to this instance. This is
|
||||
* used by the {@link #GdkGraphics(GdkGraphics)} constructor and the
|
||||
* {@link #create()} method.
|
||||
*
|
||||
* @param g the GdkGraphics object to copy the state from
|
||||
*/
|
||||
private void copyState(GdkGraphics g)
|
||||
{
|
||||
color = g.color;
|
||||
xorColor = g.xorColor;
|
||||
font = g.font;
|
||||
if (font == null)
|
||||
font = new Font ("Dialog", Font.PLAIN, 12);
|
||||
clip = new Rectangle (g.clip);
|
||||
component = g.component;
|
||||
nativeCopyState(g);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,11 +180,14 @@ public class GdkGraphics2D extends Graphics2D
|
|||
else
|
||||
fg = new Color(g.fg.getRGB());
|
||||
|
||||
if (g.bg.getAlpha() != -1)
|
||||
bg = new Color(g.bg.getRed(), g.bg.getGreen(), g.bg.getBlue(),
|
||||
g.bg.getAlpha());
|
||||
else
|
||||
bg = new Color(g.bg.getRGB());
|
||||
if (g.bg != null)
|
||||
{
|
||||
if (g.bg.getAlpha() != -1)
|
||||
bg = new Color(g.bg.getRed(), g.bg.getGreen(), g.bg.getBlue(),
|
||||
g.bg.getAlpha());
|
||||
else
|
||||
bg = new Color(g.bg.getRGB());
|
||||
}
|
||||
|
||||
if (g.clip == null)
|
||||
clip = null;
|
||||
|
@ -1088,6 +1091,8 @@ public class GdkGraphics2D extends Graphics2D
|
|||
|
||||
public void setBackground(Color c)
|
||||
{
|
||||
if (c == null)
|
||||
c = Color.WHITE;
|
||||
bg = c;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ import java.awt.image.ImageConsumer;
|
|||
import java.awt.image.ImageProducer;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -102,6 +103,11 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
|
|||
0x00ff0000,
|
||||
0x0000ff00,
|
||||
0x000000ff);
|
||||
public GdkPixbufDecoder (DataInput datainput)
|
||||
{
|
||||
super (datainput);
|
||||
}
|
||||
|
||||
public GdkPixbufDecoder (InputStream in)
|
||||
{
|
||||
super (in);
|
||||
|
@ -630,7 +636,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
|
|||
boolean ignoreMetadata)
|
||||
{
|
||||
super.setInput(input, seekForwardOnly, ignoreMetadata);
|
||||
dec = new GdkPixbufDecoder((InputStream) getInput());
|
||||
Object get = getInput();
|
||||
if (get instanceof InputStream)
|
||||
dec = new GdkPixbufDecoder((InputStream) get);
|
||||
else if (get instanceof DataInput)
|
||||
dec = new GdkPixbufDecoder((DataInput) get);
|
||||
else
|
||||
throw new IllegalArgumentException("input object not supported: "
|
||||
+ get);
|
||||
}
|
||||
|
||||
public BufferedImage read(int imageIndex, ImageReadParam param)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue