[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] classpath native/jni/gtk-peergnu_java_awt_peer_...
From: |
Roman Kennke |
Subject: |
[commit-cp] classpath native/jni/gtk-peergnu_java_awt_peer_... |
Date: |
Mon, 19 Jun 2006 11:51:45 +0000 |
CVSROOT: /cvsroot/classpath
Module name: classpath
Changes by: Roman Kennke <rabbit78> 06/06/19 11:51:45
Modified files:
native/jni/gtk-peer: gnu_java_awt_peer_gtk_ComponentGraphics.c
include : gnu_java_awt_peer_gtk_ComponentGraphics.h
gnu/java/awt/peer/gtk: ComponentGraphics.java
. : ChangeLog
Log message:
2006-06-19 Roman Kennke <address@hidden>
* 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.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c?cvsroot=classpath&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h?cvsroot=classpath&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java?cvsroot=classpath&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7875&r2=1.7876
Patches:
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c 10 Jun
2006 10:33:17 -0000 1.16
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c 19 Jun
2006 11:51:43 -0000 1.17
@@ -279,12 +279,13 @@
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile
(JNIEnv *env, jobject obj __attribute__ ((unused)), jobject peer,
- jlong img, jint x, jint y, jint w, jint h)
+ jlong img, jint x, jint y, jint w, jint h, jint cx, jint cy, jint cw, jint ch)
{
GdkPixmap *pixmap;
GtkWidget *widget = NULL;
void *ptr = NULL;
GdkGC *gc;
+ GdkRectangle clip;
gdk_threads_enter();
ptr = NSA_GET_PTR (env, peer);
@@ -296,6 +297,13 @@
pixmap = JLONG_TO_PTR(GdkPixmap, img);
gc = gdk_gc_new(widget->window);
+
+ clip.x = cx;
+ clip.y = cy;
+ clip.width = cw;
+ clip.height = ch;
+ gdk_gc_set_clip_rectangle(gc, &clip);
+
gdk_draw_drawable(widget->window,
gc,
pixmap,
Index: include/gnu_java_awt_peer_gtk_ComponentGraphics.h
===================================================================
RCS file:
/cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- include/gnu_java_awt_peer_gtk_ComponentGraphics.h 10 Jun 2006 14:16:10
-0000 1.7
+++ include/gnu_java_awt_peer_gtk_ComponentGraphics.h 19 Jun 2006 11:51:43
-0000 1.8
@@ -17,7 +17,7 @@
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_end_1gdk_1drawing (JNIEnv *env,
jobject);
JNIEXPORT jboolean JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_hasXRender (JNIEnv *env, jclass);
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative (JNIEnv *env,
jobject, jobject, jint, jint, jint, jint, jint, jint);
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile (JNIEnv *env,
jobject, jobject, jlong, jint, jint, jint, jint);
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile (JNIEnv *env,
jobject, jobject, jlong, jint, jint, jint, jint, jint, jint, jint, jint);
#ifdef __cplusplus
}
Index: gnu/java/awt/peer/gtk/ComponentGraphics.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- gnu/java/awt/peer/gtk/ComponentGraphics.java 14 Jun 2006 17:23:07
-0000 1.17
+++ gnu/java/awt/peer/gtk/ComponentGraphics.java 19 Jun 2006 11:51:43
-0000 1.18
@@ -39,7 +39,6 @@
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.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 @@
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
@@ -286,18 +283,21 @@
{
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)
- {
+ 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);
+ 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
@@ -323,22 +323,26 @@
// 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)
- {
+ 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);
+ x, y, width, height,
+ (int) (r.getX() + transform.getTranslateX()),
+ (int) (r.getY() + transform.getTranslateY()),
+ (int) r.getWidth(),
+ (int) r.getHeight());
return true;
}
else
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.7875
retrieving revision 1.7876
diff -u -b -r1.7875 -r1.7876
--- ChangeLog 19 Jun 2006 10:13:50 -0000 1.7875
+++ ChangeLog 19 Jun 2006 11:51:43 -0000 1.7876
@@ -1,3 +1,13 @@
+2006-06-19 Roman Kennke <address@hidden>
+
+ * 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.
+
2006-06-19 Audrius Meskauskas <address@hidden>
PR 28035