Makefile.am: added gnu/awt/xlib/XOffScreenImage.java.

* Makefile.am: added gnu/awt/xlib/XOffScreenImage.java.
	* Makefile.in: re-generated.
	* gnu/awt/j2d/IntegerGraphicsState.java
	(ScreenCoupledImage): new interface.
	(drawImage): detect ScreenCoupledImage instances.
	* gnu/awt/xlib/XCanvasPeer.java (createImage) implemented.
	* gnu/awt/xlib/XEventLoop.java
	(createEvent): re-formatted, and rearranged to avoid null pointer.
	* gnu/awt/xlib/XGraphics.java
	(drawImage): added XOffScreenImage handling.
	* gnu/awt/xlib/XOffScreenImage.java: new file.
	* gnu/gcj/xlib/Drawable.java (getDepth): new native method.
	* gnu/gcj/xlib/GC.java (copyArea): new native method.
	* gnu/gcj/xlib/XAnyEvent.java
	(TYPE_KEY_PRESS): new constant.
	(TYPE_KEY_RELEASE): new constant.
	(TYPE_MOTION_NOTIFY): new constant.
	(TYPE_ENTER_NOTIFY): new constant.
	(TYPE_LEAVE_NOTIFY): new constant.
	(TYPE_FOCUS_IN): new constant.
	(TYPE_FOCUS_OUT): new constant.
	(TYPE_KEYMAP_NOTIFY): new constant.
	(TYPE_GRAPHICS_EXPOSE): new constant.
	(TYPE_NO_EXPOSE): new constant.
	(TYPE_VISIBILITY_NOTIFY): new constant.
	(TYPE_CREATE_NOTIFY): new constant.
	(TYPE_DESTROY_NOTIFY): new constant.
	(TYPE_MAP_REQUEST): new constant.
	(TYPE_CONFIGURE_REQUEST): new constant.
	(TYPE_GRAVITY_NOTIFY): new constant.
	(TYPE_RESIZE_REQUEST): new constant.
	(TYPE_CIRCULATE_NOTIFY): new constant.
	(TYPE_CIRCULATE_REQUEST): new constant.
	(TYPE_PROPERTY_NOTIFY): new constant.
	(TYPE_SELECTION_CLEAR): new constant.
	(TYPE_SELECTION_REQUEST): new constant.
	(TYPE_SELECTION_NOTIFY): new constant.
	(TYPE_COLORMAP_NOTIFY): new constant.
	(TYPE_MAPPING_NOTIFY): new constant.
	* gnu/gcj/xlib/natDrawable.cc (getDepth): new method.
	* gnu/gcj/xlib/natGC.cc (copyArea): new method
	* java/awt/Component.java (createImage): changed to use peer method.

From-SVN: r70776
This commit is contained in:
Scott Gilbertson 2003-08-25 19:02:29 +00:00 committed by Scott Gilbertson
parent 1281fe1103
commit 81f7282f97
14 changed files with 442 additions and 108 deletions

View file

@ -1,3 +1,47 @@
2003-08-25 Scott Gilbertson <scottg@mantatest.com>
* Makefile.am: added gnu/awt/xlib/XOffScreenImage.java.
* Makefile.in: re-generated.
* gnu/awt/j2d/IntegerGraphicsState.java
(ScreenCoupledImage): new interface.
(drawImage): detect ScreenCoupledImage instances.
* gnu/awt/xlib/XCanvasPeer.java (createImage) implemented.
* gnu/awt/xlib/XEventLoop.java
(createEvent): re-formatted, and rearranged to avoid null pointer.
* gnu/awt/xlib/XGraphics.java
(drawImage): added XOffScreenImage handling.
* gnu/awt/xlib/XOffScreenImage.java: new file.
* gnu/gcj/xlib/Drawable.java (getDepth): new native method.
* gnu/gcj/xlib/GC.java (copyArea): new native method.
* gnu/gcj/xlib/XAnyEvent.java
(TYPE_KEY_PRESS): new constant.
(TYPE_KEY_RELEASE): new constant.
(TYPE_MOTION_NOTIFY): new constant.
(TYPE_ENTER_NOTIFY): new constant.
(TYPE_LEAVE_NOTIFY): new constant.
(TYPE_FOCUS_IN): new constant.
(TYPE_FOCUS_OUT): new constant.
(TYPE_KEYMAP_NOTIFY): new constant.
(TYPE_GRAPHICS_EXPOSE): new constant.
(TYPE_NO_EXPOSE): new constant.
(TYPE_VISIBILITY_NOTIFY): new constant.
(TYPE_CREATE_NOTIFY): new constant.
(TYPE_DESTROY_NOTIFY): new constant.
(TYPE_MAP_REQUEST): new constant.
(TYPE_CONFIGURE_REQUEST): new constant.
(TYPE_GRAVITY_NOTIFY): new constant.
(TYPE_RESIZE_REQUEST): new constant.
(TYPE_CIRCULATE_NOTIFY): new constant.
(TYPE_CIRCULATE_REQUEST): new constant.
(TYPE_PROPERTY_NOTIFY): new constant.
(TYPE_SELECTION_CLEAR): new constant.
(TYPE_SELECTION_REQUEST): new constant.
(TYPE_SELECTION_NOTIFY): new constant.
(TYPE_COLORMAP_NOTIFY): new constant.
(TYPE_MAPPING_NOTIFY): new constant.
* gnu/gcj/xlib/natDrawable.cc (getDepth): new method.
* gnu/gcj/xlib/natGC.cc (copyArea): new method
* java/awt/Component.java (createImage): changed to use peer method.
2003-08-22 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GdkGraphics.java (drawString): Pass font

View file

@ -2651,6 +2651,7 @@ gnu/awt/xlib/XFontMetrics.java \
gnu/awt/xlib/XFramePeer.java \
gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \
gnu/awt/xlib/XToolkit.java

View file

@ -2416,6 +2416,7 @@ gnu/awt/xlib/XFontMetrics.java \
gnu/awt/xlib/XFramePeer.java \
gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \
gnu/awt/xlib/XToolkit.java
@ -2710,10 +2711,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/awt/xlib/XFontMetrics.P .deps/gnu/awt/xlib/XFramePeer.P \
.deps/gnu/awt/xlib/XGraphics.P \
.deps/gnu/awt/xlib/XGraphicsConfiguration.P \
.deps/gnu/awt/xlib/XPanelPeer.P .deps/gnu/awt/xlib/XToolkit.P \
.deps/gnu/classpath/Configuration.P .deps/gnu/gcj/Core.P \
.deps/gnu/gcj/RawData.P .deps/gnu/gcj/convert/BytesToUnicode.P \
.deps/gnu/gcj/convert/Convert.P .deps/gnu/gcj/convert/IOConverter.P \
.deps/gnu/awt/xlib/XOffScreenImage.P .deps/gnu/awt/xlib/XPanelPeer.P \
.deps/gnu/awt/xlib/XToolkit.P .deps/gnu/classpath/Configuration.P \
.deps/gnu/gcj/Core.P .deps/gnu/gcj/RawData.P \
.deps/gnu/gcj/convert/BytesToUnicode.P .deps/gnu/gcj/convert/Convert.P \
.deps/gnu/gcj/convert/IOConverter.P \
.deps/gnu/gcj/convert/Input_8859_1.P \
.deps/gnu/gcj/convert/Input_ASCII.P \
.deps/gnu/gcj/convert/Input_EUCJIS.P \

View file

@ -44,6 +44,19 @@ public class IntegerGraphicsState extends AbstractGraphicsState
DirectRasterGraphics directGfx;
Shape clip;
/** Interface for images which are coupled to a GraphicsConfiguration,
* as is typically the case for an off-screen buffer used in
* double-buffering. Any image which implements this interface is
* rendered directly by DirectRasterGraphics (i.e. by directGfx.drawImage)
*/
public interface ScreenCoupledImage
{
/** Get the GraphicsConfiguration to which this image is coupled
* @return the GraphicsConfiguration
*/
GraphicsConfiguration getGraphicsConfiguration ();
}
public IntegerGraphicsState(DirectRasterGraphics directGfx)
{
this.directGfx = directGfx;
@ -245,66 +258,72 @@ public class IntegerGraphicsState extends AbstractGraphicsState
x += tx;
y += ty;
if (image instanceof ScreenCoupledImage)
{
GraphicsConfiguration config
= ((ScreenCoupledImage)image).getGraphicsConfiguration ();
if (config == frontend.config)
return directGfx.drawImage (image, x, y, observer);
}
if (image instanceof BufferedImage)
{
BufferedImage bImage = (BufferedImage) image;
// FIXME: eliminate? ScreenCoupledImage is probably more efficient
Object config = bImage.getProperty ("java.awt.GraphicsConfiguration");
if (config == frontend.config)
return directGfx.drawImage (image, x, y, observer);
int width = image.getWidth (null);
int height = image.getHeight (null);
Rectangle bounds = new Rectangle (x, y, width, height);
MappedRaster mr = directGfx.mapRaster (bounds);
// manipulate raster here...
ColorModel colorModel = mr.getColorModel ();
WritableRaster raster = mr.getRaster ();
int xEnd = x + width;
int yEnd = y + height;
// FIXME: Use the following code only as a fallback. It's SLOW!
Object rgbElem = null;
for (int yy=0; yy<height; yy++)
{
BufferedImage bImage = (BufferedImage) image;
Object config =
bImage.getProperty("java.awt.GraphicsConfiguration");
if (config == frontend.config)
return directGfx.drawImage(image, x, y, observer);
int width = image.getWidth(null);
int height = image.getHeight(null);
Rectangle bounds = new Rectangle(x, y, width, height);
MappedRaster mr = directGfx.mapRaster(bounds);
// manipulate raster here...
ColorModel colorModel = mr.getColorModel();
WritableRaster raster = mr.getRaster();
int xEnd = x + width;
int yEnd = y + height;
// FIXME: Use the following code only as a fallback. It's SLOW!
Object rgbElem = null;
for (int yy=0; yy<height; yy++)
{
for (int xx=0; xx<width; xx++)
{
int srgb = bImage.getRGB(xx, yy);
int sa = ((srgb >>> 24) & 0xff) + 1;
int sr = ((srgb >>> 16) & 0xff) + 1;
int sg = ((srgb >>> 8) & 0xff) + 1;
int sb = (srgb & 0xff) + 1;
rgbElem = raster.getDataElements(xx+x, yy+y, rgbElem);
int drgb = colorModel.getRGB(rgbElem);
int dr = ((drgb >>> 16) & 0xff) + 1;
int dg = ((drgb >>> 8) & 0xff) + 1;
int db = (drgb & 0xff) + 1;
int da = 256 - sa;
dr = ((sr*sa + dr*da) >>> 8) - 1;
dg = ((sg*sa + dg*da) >>> 8) - 1;
db = ((sb*sa + db*da) >>> 8) - 1;
drgb = (dr<<16) | (dg<<8) | db;
rgbElem = colorModel.getDataElements(drgb, rgbElem);
raster.setDataElements(xx+x, yy+y, rgbElem);
}
}
directGfx.unmapRaster(mr);
return true;
for (int xx=0; xx<width; xx++)
{
int srgb = bImage.getRGB (xx, yy);
int sa = ((srgb >>> 24) & 0xff) + 1;
int sr = ((srgb >>> 16) & 0xff) + 1;
int sg = ((srgb >>> 8) & 0xff) + 1;
int sb = (srgb & 0xff) + 1;
rgbElem = raster.getDataElements (xx+x, yy+y, rgbElem);
int drgb = colorModel.getRGB (rgbElem);
int dr = ((drgb >>> 16) & 0xff) + 1;
int dg = ((drgb >>> 8) & 0xff) + 1;
int db = (drgb & 0xff) + 1;
int da = 256 - sa;
dr = ((sr*sa + dr*da) >>> 8) - 1;
dg = ((sg*sa + dg*da) >>> 8) - 1;
db = ((sb*sa + db*da) >>> 8) - 1;
drgb = (dr<<16) | (dg<<8) | db;
rgbElem = colorModel.getDataElements (drgb, rgbElem);
raster.setDataElements (xx+x, yy+y, rgbElem);
}
}
throw new UnsupportedOperationException("drawing image " + image +
"not implemented");
directGfx.unmapRaster (mr);
return true;
}
throw new UnsupportedOperationException ("drawing image " + image +
"not implemented");
}

View file

@ -214,7 +214,7 @@ public class XCanvasPeer implements CanvasPeer
}
public Image createImage(int width, int height)
{
throw new UnsupportedOperationException("FIXME, not implemented");
return new XOffScreenImage (config, window, width, height);
}
public void dispose()
{

View file

@ -118,57 +118,66 @@ public class XEventLoop implements Runnable
* AWT event.
*/
AWTEvent createEvent()
AWTEvent createEvent ()
{
int type = anyEvent.getType ();
// Ignore some events without further processing
switch (type)
{
// ignore "no expose" events, which are generated whenever a pixmap
// is copied to copied to a window which is entirely unobscured
case XAnyEvent.TYPE_NO_EXPOSE:
case XAnyEvent.TYPE_UNMAP_NOTIFY: // ignore for now
case XAnyEvent.TYPE_MAP_NOTIFY: // ignore for now
case XAnyEvent.TYPE_REPARENT_NOTIFY: // ignore for now
return null;
default:
break; // continue processing events not in ignore list
}
/* avoid attempting to get client data before client data has
been set. */
Object peer;
synchronized (this)
{
peer = anyEvent.getWindow().getClientData();
}
{
peer = anyEvent.getWindow ().getClientData ();
}
Component source = null;
// Try to identify source component
if (peer instanceof XCanvasPeer)
{
source = ((XCanvasPeer) peer).getComponent();
}
{
source = ((XCanvasPeer) peer).getComponent ();
}
if (source == null)
{
String msg = "unable to locate source for event (" +
anyEvent + ")";
throw new RuntimeException(msg);
}
{
String msg = "unable to locate source for event (" +
anyEvent + "): peer=" + peer;
throw new RuntimeException (msg);
}
/* if a mapping from anyEvent to AWTEvent is possible, construct a
new AWTEvent and return it. */
int type = anyEvent.getType();
switch (type)
{
{
case XAnyEvent.TYPE_EXPOSE:
return createPaintEvent(source);
return createPaintEvent (source);
case XAnyEvent.TYPE_BUTTON_PRESS:
case XAnyEvent.TYPE_BUTTON_RELEASE:
return createMouseEvent(type, source);
case XAnyEvent.TYPE_UNMAP_NOTIFY:
case XAnyEvent.TYPE_MAP_NOTIFY:
case XAnyEvent.TYPE_REPARENT_NOTIFY:
return null; // ignore for now
return createMouseEvent (type, source);
case XAnyEvent.TYPE_CONFIGURE_NOTIFY:
configureNotify(peer);
return null;
configureNotify (peer);
return null;
default:
String msg = "Do no know how to handle event (" + anyEvent + ")";
throw new RuntimeException(msg);
}
String msg = "Do no know how to handle event (" + anyEvent + ")";
throw new RuntimeException (msg);
}
}
AWTEvent createPaintEvent(Component src)
{
XExposeEvent expose = new XExposeEvent(anyEvent);

View file

@ -20,6 +20,7 @@ import gnu.gcj.xlib.XImage;
import gnu.gcj.xlib.Drawable;
import gnu.gcj.xlib.Window;
import gnu.gcj.xlib.Drawable;
import gnu.gcj.xlib.Pixmap;
import gnu.gcj.xlib.Visual;
import gnu.awt.j2d.DirectRasterGraphics;
import gnu.awt.j2d.MappedRaster;
@ -199,6 +200,16 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
public boolean drawImage(Image img, int x, int y,
ImageObserver observer)
{
if (img instanceof XOffScreenImage)
{
// FIXME: have to enforce clip, or is it OK as-is?
XGraphicsConfiguration.XOffScreenImage offScreenImage
= ((XGraphicsConfiguration.XOffScreenImage)img);
Pixmap pixmap = offScreenImage.getPixmap ();
context.copyArea (pixmap, 0, 0, x, y,
offScreenImage.getWidth (), offScreenImage.getHeight ());
return true;
}
if (clipBounds == null)
return false; // ***FIXME***

View file

@ -0,0 +1,175 @@
/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.awt.xlib;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.util.Hashtable;
import gnu.awt.j2d.DirectRasterGraphics;
import gnu.awt.j2d.Graphics2DImpl;
import gnu.awt.j2d.IntegerGraphicsState;
import gnu.gcj.xlib.Drawable;
import gnu.gcj.xlib.Pixmap;
import gnu.gcj.xlib.Screen;
import gnu.gcj.xlib.Visual;
/** Image class for xlib off-screen buffers.
* The image is stored in a server-side pixmap for best performance.
* This class supports getGraphics, so you can draw on the pixmap, and is
* specially handled when doing drawImage, so that the image copy is done
* entirely in the X server.
* This class does not support rasterization, for which you'd need an XImage.
*
* @author scott gilbertson <scottg@mantatest.com> <sgilbertson@cogeco.ca>
*/
public class XOffScreenImage extends Image
implements IntegerGraphicsState.ScreenCoupledImage
{
private Pixmap pixmap;
private XGraphicsConfiguration config;
private int width;
private int height;
/** Create a new XOffScreenImage
* @param config Graphics configuration, to compare against on-screen
* components and to create the appropriate Graphics
* @param drawable The drawable with which the image is compatible
* @param width The width of the image
* @param height The height of the image
*/
XOffScreenImage (XGraphicsConfiguration config, Drawable drawable, int width, int height)
{
this.config = config;
this.width = width;
this.height = height;
pixmap = new Pixmap (drawable, width, height, drawable.getDepth ());
}
/** Get the pixmap which contains this image
* @return The pixmap
*/
public Pixmap getPixmap ()
{
return pixmap;
}
/** Flushes (that is, destroys) any resources used for this image. This
* includes the actual image data.
*/
public void flush ()
{
// FIXME: should dispose pixmap
pixmap = null;
}
/** Returns a graphics context object for drawing an off-screen object.
* This method is only valid for off-screen objects.
*
* @return a graphics context object for an off-screen object
* @see Graphics#createImage(int, int)
*/
public Graphics getGraphics ()
{
DirectRasterGraphics gfxDevice = new XGraphics (pixmap, config);
IntegerGraphicsState igState = new IntegerGraphicsState (gfxDevice);
Graphics2DImpl gfx2d = new Graphics2DImpl (config);
gfx2d.setState (igState);
return gfx2d;
}
/** Returns the height of the image, or -1 if it is unknown. If the
* image height is unknown, the observer object will be notified when
* the value is known.
*
* @param observer the image observer for this object
* @return the height in pixels
* @see #getWidth(ImageObserver)
*/
public int getHeight (ImageObserver observer)
{
return height;
}
/** Returns the height of the image, or -1 if it is unknown. If the
* image height is unknown, the observer object will be notified when
* the value is known.
*
* @return the height in pixels
* @see #getWidth()
*/
public int getHeight ()
{
return height;
}
/** Returns the image producer object for this object. The producer is the
* object which generates pixels for this image.
*
* @return the image producer for this object
*/
public ImageProducer getSource ()
{
throw new UnsupportedOperationException ("getSource not supported");
}
/** Returns the width of the image, or -1 if it is unknown. If the
* image width is unknown, the observer object will be notified when
* the value is known.
*
* @param observer the image observer for this object
* @return the width in pixels
* @see #getHeight(ImageObserver)
*/
public int getWidth (ImageObserver observer)
{
return width;
}
/** Returns the width of the image, or -1 if it is unknown. If the
* image width is unknown, the observer object will be notified when
* the value is known.
*
* @return the width in pixels
* @see #getHeight()
*/
public int getWidth ()
{
return width;
}
/** This method requests a named property for an object. The value of the
* property is returned. The value <code>UndefinedProperty</code> is
* returned if there is no property with the specified name. The value
* <code>null</code> is returned if the properties for the object are
* not yet known. In this case, the specified image observer is notified
* when the properties are known.
*
* @param name the requested property name
* @param observer the image observer for this object
* @return the named property, if available
* @see #UndefinedProperty
*/
public Object getProperty (String name, ImageObserver observer)
{
return null;
}
/** Get the GraphicsConfiguration to which this image is coupled
* @return the GraphicsConfiguration
*/
public GraphicsConfiguration getGraphicsConfiguration ()
{
return config;
}
}

View file

@ -79,6 +79,8 @@ public class Drawable extends XID
public native Rectangle getBounds(Rectangle rv);
public native int getDepth ();
private static final String MSG_XGETSUBIMAGE_FAILED =
"XGetSubImage() failed.";

View file

@ -138,6 +138,11 @@ public class GC implements Cloneable
int destX, int destY,
int width, int height);
public native void copyArea (Drawable source,
int srcX, int srcY,
int destX, int destY,
int width, int height);
public Drawable getDrawable()
{
return target;

View file

@ -19,14 +19,40 @@ import gnu.gcj.RawData;
public final class XAnyEvent
{
// Must match the definitions in X.h:
public static final int TYPE_BUTTON_PRESS = 4,
TYPE_BUTTON_RELEASE = 5,
TYPE_EXPOSE = 12,
TYPE_UNMAP_NOTIFY = 18,
TYPE_MAP_NOTIFY = 19,
TYPE_REPARENT_NOTIFY = 21,
TYPE_CONFIGURE_NOTIFY = 22,
TYPE_CLIENT_MESSAGE = 33;
public static final int
TYPE_KEY_PRESS = 2,
TYPE_KEY_RELEASE = 3,
TYPE_BUTTON_PRESS = 4,
TYPE_BUTTON_RELEASE = 5,
TYPE_MOTION_NOTIFY = 6,
TYPE_ENTER_NOTIFY = 7,
TYPE_LEAVE_NOTIFY = 8,
TYPE_FOCUS_IN = 9,
TYPE_FOCUS_OUT = 10,
TYPE_KEYMAP_NOTIFY = 11,
TYPE_EXPOSE = 12,
TYPE_GRAPHICS_EXPOSE = 13,
TYPE_NO_EXPOSE = 14,
TYPE_VISIBILITY_NOTIFY = 15,
TYPE_CREATE_NOTIFY = 16,
TYPE_DESTROY_NOTIFY = 17,
TYPE_UNMAP_NOTIFY = 18,
TYPE_MAP_NOTIFY = 19,
TYPE_MAP_REQUEST = 20,
TYPE_REPARENT_NOTIFY = 21,
TYPE_CONFIGURE_NOTIFY = 22,
TYPE_CONFIGURE_REQUEST = 23,
TYPE_GRAVITY_NOTIFY = 24,
TYPE_RESIZE_REQUEST = 25,
TYPE_CIRCULATE_NOTIFY = 26,
TYPE_CIRCULATE_REQUEST = 27,
TYPE_PROPERTY_NOTIFY = 28,
TYPE_SELECTION_CLEAR = 29,
TYPE_SELECTION_REQUEST = 30,
TYPE_SELECTION_NOTIFY = 31,
TYPE_COLORMAP_NOTIFY = 32,
TYPE_CLIENT_MESSAGE = 33,
TYPE_MAPPING_NOTIFY = 34;
// Must match the definitions in X.h:
public final static long MASK_SUBSTRUCTURE_NOTIFY = 1L<<19,

View file

@ -43,6 +43,26 @@ jboolean gnu::gcj::xlib::Drawable::copyIntoXImageImpl(XImage* image,
return true;
}
jint gnu::gcj::xlib::Drawable::getDepth ()
{
::Display* dpy = (::Display*) (getDisplay ()->display);
::Window root;
int x, y;
unsigned int w, h, bw, depth;
Status status = XGetGeometry (dpy, getXID(), &root,
&x, &y, &w, &h,
&bw, &depth);
switch (status)
{
case BadDrawable:
throw new XException (display, status);
default:
; // All OK, NOP.
}
return (jint)depth;
}
java::awt::Rectangle*
gnu::gcj::xlib::Drawable::getBounds(java::awt::Rectangle* rv)
{

View file

@ -237,3 +237,18 @@ void gnu::gcj::xlib::GC::updateClip()
ordering);
// no fast fail
}
void gnu::gcj::xlib::GC::copyArea (gnu::gcj::xlib::Drawable * source,
jint srcX, jint srcY,
jint destX, jint destY,
jint width, jint height)
{
Display* display = target->getDisplay ();
::Display* dpy = (::Display*) (display->display);
::Drawable drawableXID = target->getXID ();
::GC gc = (::GC) structure;
::Drawable srcXID = source->getXID ();
XCopyArea (dpy, srcXID, drawableXID, gc, srcX, srcY, width, height,
destX, destY);
}

View file

@ -1866,12 +1866,17 @@ public abstract class Component
* @param height the height of the image
* @return the requested image, or null if it is not supported
*/
public Image createImage(int width, int height)
public Image createImage (int width, int height)
{
if (GraphicsEnvironment.isHeadless())
return null;
GraphicsConfiguration config = getGraphicsConfiguration();
return config == null ? null : config.createCompatibleImage(width, height);
Image returnValue = null;
if (!GraphicsEnvironment.isHeadless ())
{
if (isLightweight () && parent != null)
returnValue = parent.createImage (width, height);
else if (peer != null)
returnValue = peer.createImage (width, height);
}
return returnValue;
}
/**