CVSROOT: /cvsroot/classpath Module name: classpath Changes by: Roman Kennke <rabbit78> 06/06/14 13:51:06
Modified files: native/jni/gtk-peer: gnu_java_awt_peer_gtk_CairoGraphics2D.c gnu/java/awt/peer/gtk: CairoGraphics2D.java include : gnu_java_awt_peer_gtk_CairoGraphics2D.h . : ChangeLog Log message: 2006-06-14 Roman Kennke <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/CairoGraphics2D.java (cairoDrawLine): New native method. (cairoDrawRect): New native method. (cairoFillRect): New native method. (drawLine): Use special native method. (drawRect): Use special native method. (fillRect): Use special native method. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c (cairoDrawLine): New native method. (cairoDrawRect): New native method. (cairoFillRect): New native method. * include/gnu_java_awt_peer_gtk_CairoGraphics2D.h: Regenerated. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c?cvsroot=classpath&r1=1.10&r2=1.11 http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java?cvsroot=classpath&r1=1.22&r2=1.23 http://cvs.savannah.gnu.org/viewcvs/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h?cvsroot=classpath&r1=1.6&r2=1.7 http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7809&r2=1.7810 Patches: Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -b -r1.10 -r1.11 --- native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c 12 Jun 2006 10:32:44 -0000 1.10 +++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c 14 Jun 2006 13:51:04 -0000 1.11 @@ -665,6 +665,46 @@ } } +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawLine +(JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)), + jlong pointer, jdouble x1, jdouble y1, jdouble x2, jdouble y2) +{ + struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer); + g_assert (gr != NULL); + + cairo_new_path(gr->cr); + cairo_move_to(gr->cr, x1, y1); + cairo_line_to(gr->cr, x2, y2); + cairo_stroke(gr->cr); +} + +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawRect +(JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)), + jlong pointer, jdouble x, jdouble y, jdouble w, jdouble h) +{ + struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer); + g_assert (gr != NULL); + + cairo_new_path(gr->cr); + cairo_rectangle(gr->cr, x, y, w, h); + cairo_stroke(gr->cr); +} + +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFillRect +(JNIEnv *env __attribute__ ((unused)), jobject obj __attribute__ ((unused)), + jlong pointer, jdouble x, jdouble y, jdouble w, jdouble h) +{ + struct cairographics2d *gr = JLONG_TO_PTR(struct cairographics2d, pointer); + g_assert (gr != NULL); + + cairo_new_path(gr->cr); + cairo_rectangle(gr->cr, x, y, w, h); + cairo_fill(gr->cr); +} + /************************** FONT STUFF ****************************/ static void Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -b -r1.22 -r1.23 --- gnu/java/awt/peer/gtk/CairoGraphics2D.java 13 Jun 2006 12:59:22 -0000 1.22 +++ gnu/java/awt/peer/gtk/CairoGraphics2D.java 14 Jun 2006 13:51:04 -0000 1.23 @@ -66,7 +66,6 @@ import java.awt.geom.Arc2D; import java.awt.geom.Area; 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; @@ -427,6 +426,46 @@ */ 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 @@ -940,12 +979,15 @@ public void drawLine(int x1, int y1, int x2, int y2) { - draw(new Line2D.Double(x1, y1, x2, y2)); + cairoDrawLine(nativePointer, shifted(x1, shiftDrawCalls), + shifted(y1, shiftDrawCalls), shifted(x2, shiftDrawCalls), + shifted(y2, shiftDrawCalls)); } 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 +1000,7 @@ 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) Index: include/gnu_java_awt_peer_gtk_CairoGraphics2D.h =================================================================== RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- include/gnu_java_awt_peer_gtk_CairoGraphics2D.h 12 Jun 2006 10:32:44 -0000 1.6 +++ include/gnu_java_awt_peer_gtk_CairoGraphics2D.h 14 Jun 2006 13:51:04 -0000 1.7 @@ -37,6 +37,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoPreserveClip (JNIEnv *env, jobject, jlong); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoResetClip (JNIEnv *env, jobject, jlong); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSurfaceSetFilter (JNIEnv *env, jobject, jlong, jint); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawLine (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawRect (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoFillRect (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble); #ifdef __cplusplus } Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.7809 retrieving revision 1.7810 diff -u -b -r1.7809 -r1.7810 --- ChangeLog 14 Jun 2006 13:00:09 -0000 1.7809 +++ ChangeLog 14 Jun 2006 13:51:04 -0000 1.7810 @@ -1,3 +1,18 @@ +2006-06-14 Roman Kennke <[EMAIL PROTECTED]> + + * gnu/java/awt/peer/gtk/CairoGraphics2D.java + (cairoDrawLine): New native method. + (cairoDrawRect): New native method. + (cairoFillRect): New native method. + (drawLine): Use special native method. + (drawRect): Use special native method. + (fillRect): Use special native method. + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c + (cairoDrawLine): New native method. + (cairoDrawRect): New native method. + (cairoFillRect): New native method. + * include/gnu_java_awt_peer_gtk_CairoGraphics2D.h: Regenerated. + 2006-06-14 Mark Wielaard <[EMAIL PROTECTED]> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c