diff options
| author | Roman Kennke <roman@kennke.org> | 2006-06-19 11:51:43 +0000 |
|---|---|---|
| committer | Roman Kennke <roman@kennke.org> | 2006-06-19 11:51:43 +0000 |
| commit | d03583cce23b848353d271bc2e228deb2f8bc573 (patch) | |
| tree | b5f28a54f15d30056bcd1c20e038e22eef9a0420 /gnu/java/awt/peer/gtk/ComponentGraphics.java | |
| parent | 2c2ed2726d7a631bcc5ef9946fec5bdee96e0981 (diff) | |
| download | classpath-d03583cce23b848353d271bc2e228deb2f8bc573.tar.gz | |
2006-06-19 Roman Kennke <kennke@aicas.com>
* gnu/java/awt/peer/gtk/ComponentGraphics.java
(drawImage): Clip volatile image correctly.
(drawVolatileImage): Added arguments for clipping.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
(drawVolatileImage): Added arguments for clipping. Clip image
correctly.
* include/gnu_java_awt_peer_gtk_ComponentGraphics.h: Regenerated.
Diffstat (limited to 'gnu/java/awt/peer/gtk/ComponentGraphics.java')
| -rw-r--r-- | gnu/java/awt/peer/gtk/ComponentGraphics.java | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/gnu/java/awt/peer/gtk/ComponentGraphics.java b/gnu/java/awt/peer/gtk/ComponentGraphics.java index e49c95f01..cb8350265 100644 --- a/gnu/java/awt/peer/gtk/ComponentGraphics.java +++ b/gnu/java/awt/peer/gtk/ComponentGraphics.java @@ -39,7 +39,6 @@ exception statement from your version. */ package gnu.java.awt.peer.gtk; import java.awt.Color; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; @@ -47,15 +46,12 @@ import java.awt.Image; import java.awt.Rectangle; import java.awt.Shape; import java.awt.Toolkit; -import java.awt.Point; -import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; -import java.awt.image.ImagingOpException; import java.awt.image.RenderedImage; /** @@ -170,7 +166,8 @@ public class ComponentGraphics extends CairoGraphics2D private native void drawVolatile(GtkComponentPeer component, long vimg, int x, int y, - int width, int height); + int width, int height, int cx, int cy, + int cw, int ch); /** * Returns a Graphics2D object for a component, either an instance of this @@ -285,21 +282,24 @@ public class ComponentGraphics extends CairoGraphics2D if (img instanceof GtkVolatileImage) { GtkVolatileImage vimg = (GtkVolatileImage) img; - int type = transform.getType(); - if (type == AffineTransform.TYPE_IDENTITY) - { - drawVolatile(component, vimg.nativePointer, - x, y, vimg.width, vimg.height); - return true; - } - else if (type == AffineTransform.TYPE_TRANSLATION) - { - x += transform.getTranslateX(); - y += transform.getTranslateY(); - drawVolatile(component, vimg.nativePointer, - x, y, vimg.width, vimg.height); - return true; - } + int type = transform.getType(); + if ((type == AffineTransform.TYPE_IDENTITY + || type == AffineTransform.TYPE_TRANSLATION) + && (clip == null || clip instanceof Rectangle2D)) + { + Rectangle2D r = (Rectangle2D) clip; + if (r == null) + r = getRealBounds(); + x += transform.getTranslateX(); + y += transform.getTranslateY(); + drawVolatile(component, vimg.nativePointer, + x, y, vimg.width, vimg.height, + (int) (r.getX() + transform.getTranslateX()), + (int) (r.getY() + transform.getTranslateY()), + (int) r.getWidth(), + (int) r.getHeight()); + return true; + } else return super.drawImage(vimg.getSnapshot(), x, y, observer); } @@ -323,24 +323,28 @@ public class ComponentGraphics extends CairoGraphics2D // If it is a GtkVolatileImage with an "easy" transform then // draw directly. Always pass a BufferedImage to super to avoid // deadlock (see Note in CairoGraphics.drawImage()). - if (img instanceof GtkVolatileImage) + if (img instanceof GtkVolatileImage + && (clip == null || clip instanceof Rectangle2D)) { GtkVolatileImage vimg = (GtkVolatileImage) img; - int type = transform.getType(); - if (type == AffineTransform.TYPE_IDENTITY) - { - drawVolatile(component, vimg.nativePointer, - x, y, width, height); - return true; - } - else if (type == AffineTransform.TYPE_TRANSLATION) - { - x += transform.getTranslateX(); - y += transform.getTranslateY(); - drawVolatile(component, vimg.nativePointer, - x, y, width, height); - return true; - } + int type = transform.getType(); + if ((type == AffineTransform.TYPE_IDENTITY + || type == AffineTransform.TYPE_TRANSLATION) + && (clip == null || clip instanceof Rectangle2D)) + { + Rectangle2D r = (Rectangle2D) clip; + if (r == null) + r = getRealBounds(); + x += transform.getTranslateX(); + y += transform.getTranslateY(); + drawVolatile(component, vimg.nativePointer, + x, y, width, height, + (int) (r.getX() + transform.getTranslateX()), + (int) (r.getY() + transform.getTranslateY()), + (int) r.getWidth(), + (int) r.getHeight()); + return true; + } else return super.drawImage(vimg.getSnapshot(), x, y, width, height, observer); |
