[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_Surface.c, 1.6, 1.7 org_freedesktop_cairo_Matrix.c, 1.4, 1.5 org_freedesktop_cairo_PngSurface.c, 1.8, NONE org_freedesktop_cairo_PDFSurface.c, 1.1, 1.2 org_freedesktop_cairo_Context.c, 1.2, 1.3

Jeffrey Morgan commit at pdx.freedesktop.org
Fri May 6 17:27:08 PDT 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv23023/src/jni

Modified Files:
	org_freedesktop_cairo_Surface.c org_freedesktop_cairo_Matrix.c 
	org_freedesktop_cairo_PDFSurface.c 
	org_freedesktop_cairo_Context.c 
Removed Files:
	org_freedesktop_cairo_PngSurface.c 
Log Message:
update so we compile after massive upstream API change.

Index: org_freedesktop_cairo_Surface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Surface.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- org_freedesktop_cairo_Surface.c	6 May 2005 14:58:40 -0000	1.6
+++ org_freedesktop_cairo_Surface.c	7 May 2005 00:27:02 -0000	1.7
@@ -9,6 +9,7 @@
 
 #include <jni.h>
 #include <cairo.h>
+#include <stdlib.h>
 #include <jg_jnu.h>
 
 #ifndef _Included_org_freedesktop_cairo_Surface
@@ -38,9 +39,10 @@
 JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1reference
   (JNIEnv *env, jclass cls, jobject obj)
 {
-	cairo_surface_t *surface = g_new0(cairo_surface_t, 1);
+	cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
+
 	cairo_surface_reference(surface);
-	updateHandle(env, obj, surface);
+	updateHandle(env, obj, &surface);
 }
 
 /*
@@ -57,18 +59,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_Surface
- * Method:    cairo_surface_set_repeat
- * Signature: (Lorg/gnu/glib/Handle;I)I
- */
-JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1set_1repeat
-  (JNIEnv *env, jclass cls, jobject obj, jint repeat)
-{
-	cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
-	cairo_surface_set_repeat(surface, repeat);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Surface
  * Method:    cairo_surface_finish
  * Signature: (Lorg/gnu/glib/Handle;)I
  */
@@ -82,58 +72,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_Surface
- * Method:    cairo_surface_set_matrix
- * Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
- */
-JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1set_1matrix
-  (JNIEnv *env, jclass cls, jobject obj, jobject matrix)
-{
-	cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
-	cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
-	return (jint)cairo_surface_set_matrix(surface, matrix_g);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Surface
- * Method:    cairo_surface_get_matrix
- * Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
- */
-JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1get_1matrix
-  (JNIEnv *env, jclass cls, jobject obj, jobject matrix)
- {
-	cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
-	cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
-	jint status = (jint)cairo_surface_set_matrix(surface, matrix_g);
-	updateHandle(env, matrix, matrix_g);
-	return status;
- }
-
-/*
- * Class:     org_freedesktop_cairo_Surface
- * Method:    cairo_surface_set_filter
- * Signature: (Lorg/gnu/glib/Handle;I)I
- */
-JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1set_1filter
-  (JNIEnv *env, jclass cls, jobject obj, jint filter)
-{
-	cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
-	return cairo_surface_set_filter(surface, (cairo_filter_t)filter);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Surface
- * Method:    cairo_surface_get_filter
- * Signature: (Lorg/gnu/glib/Handle;)I
- */
-JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1get_1filter
-  (JNIEnv *env, jclass cls, jobject obj)
-{
-	cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
-	return cairo_surface_get_filter(surface);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Surface
  * Method:    cairo_surface_set_device_offset
  * Signature: (Lorg/gnu/javagnome/Handle;DD)V
  */

Index: org_freedesktop_cairo_Matrix.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Matrix.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- org_freedesktop_cairo_Matrix.c	6 May 2005 11:50:56 -0000	1.4
+++ org_freedesktop_cairo_Matrix.c	7 May 2005 00:27:02 -0000	1.5
@@ -187,68 +187,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_Matrix
- * Method:    cairo_matrix_create
- * Signature: ()Lorg/gnu/glib/Handle;
- */
-JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1create
-  (JNIEnv *env, jclass cls)
-{
-	return getHandleFromPointer(env, cairo_matrix_create());
-}
-
-/*
- * Class:     org_freedesktop_cairo_Matrix
- * Method:    cairo_matrix_destroy
- * Signature: (Lorg/gnu/glib/Handle;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1destroy
-  (JNIEnv *env, jclass cls, jobject obj)
-{
-	cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
-	cairo_matrix_destroy(matrix);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Matrix
- * Method:    cairo_matrix_copy
- * Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1copy
-  (JNIEnv *env, jclass cls, jobject dest, jobject src)
-{
-	cairo_matrix_t *dest_g = (cairo_matrix_t*)getPointerFromHandle(env, dest);
-	cairo_matrix_t *src_g = (cairo_matrix_t*)getPointerFromHandle(env, src);
-	cairo_matrix_copy(dest_g, src_g);
-	updateHandle(env, dest, dest_g);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Matrix
- * Method:    cairo_matrix_set_identity
- * Signature: (Lorg/gnu/glib/Handle;)I
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1set_1identity
-  (JNIEnv *env, jclass cls, jobject obj)
-{
-	cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
-	cairo_matrix_set_identity(matrix);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Matrix
- * Method:    cairo_matrix_set_affine
- * Signature: (Lorg/gnu/glib/Handle;DDDDDD)I
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1set_1affine
-  (JNIEnv *env, jclass cls, jobject obj, jdouble a, jdouble b, jdouble c, jdouble d, 
-  		jdouble tx, jdouble ty)
-{
-	cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
-	cairo_matrix_set_affine(matrix, a, b, c, d, tx, ty);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Matrix
  * Method:    cairo_matrix_get_affine
  * Signature: (Lorg/gnu/glib/Handle;[D[D[D[D[D[D)I
  */

--- org_freedesktop_cairo_PngSurface.c DELETED ---

Index: org_freedesktop_cairo_PDFSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_PDFSurface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- org_freedesktop_cairo_PDFSurface.c	3 May 2005 01:40:40 -0000	1.1
+++ org_freedesktop_cairo_PDFSurface.c	7 May 2005 00:27:02 -0000	1.2
@@ -27,20 +27,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_PDFSurface
- * Method:    cairo_set_target_pdf
- * Signature: (Lorg/gnu/glib/Handle;Ljava/lang/String;DDDD)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PDFSurface_cairo_1set_1target_1pdf
-  (JNIEnv *env, jclass cls, jobject cr, jobject sur, jdouble width, jdouble height, 
-  		jdouble x, jdouble y)
-{
-	cairo_t *cr_g = (cairo_t*)getPointerFromHandle(env, cr);
-	jg_pdfsurface_t *s = (jg_pdfsurface_t*)getPointerFromHandle(env, sur);
-	cairo_set_target_pdf(cr_g, s->file, width, height, x, y);
-}
-
-/*
- * Class:     org_freedesktop_cairo_PDFSurface
  * Method:    cairo_pdf_surface_create
  * Signature: (Ljava/lang/String;DDDD)Lorg/gnu/glib/Handle;
  */

Index: org_freedesktop_cairo_Context.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Context.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- org_freedesktop_cairo_Context.c	6 May 2005 11:50:56 -0000	1.2
+++ org_freedesktop_cairo_Context.c	7 May 2005 00:27:02 -0000	1.3
@@ -17,26 +17,20 @@
 extern "C" {
 #endif
 
-static jmethodID move_to = NULL;
-static jmethodID line_to = NULL;
-static jmethodID curve_to = NULL;
-static jmethodID close_path = NULL;
-
-typedef struct {
-  JNIEnv *env;
-  jobject obj;
-} CairoCallback;
-
-
 /*
  * Class:     org_freedesktop_cairo_Context
  * Method:    cairo_create
  * Signature: ()Lorg/gnu/glib/Handle;
  */
 JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Context_cairo_1create
-  (JNIEnv *env, jclass cls)
+  (JNIEnv *env, jclass cls, jobject sur)
 {
-	return getHandleFromPointer(env, cairo_create());
+	cairo_surface_t *surface;
+	cairo_t *cairo;
+	
+	surface = (cairo_surface_t*)getPointerFromHandle(env, sur);
+	cairo = cairo_create(surface);
+	return getHandleFromPointer(env, cairo);
 }
 
 /*
@@ -91,33 +85,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_copy
- * Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1copy
-  (JNIEnv *env, jclass cls, jobject obj, jobject src)
-{
-	cairo_t *dest;
-	cairo_t *src_g = (cairo_t*)getPointerFromHandle(env, src);
-	cairo_copy(dest, src_g);
-	updateHandle(env, obj, dest);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_set_target_surface
- * Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1set_1target_1surface
-  (JNIEnv *env, jclass cls, jobject obj, jobject surface)
-{
-	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
-	cairo_surface_t *surface_g = (cairo_surface_t*)getPointerFromHandle(env, surface);
-	cairo_set_target_surface(cr, surface_g);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
  * Method:    cairo_set_operator
  * Signature: (Lorg/gnu/glib/Handle;I)V
  */
@@ -608,7 +575,7 @@
 	cairo_t *cr;
 	
 	cr = (cairo_t*)getPointerFromHandle(env, obj);
-	cairl_stroke_preserve(cr);
+	cairo_stroke_preserve(cr);
 }
 
 /*
@@ -994,18 +961,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_get_alpha
- * Signature: (Lorg/gnu/glib/Handle;)D
- */
-JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_Context_cairo_1get_1alpha
-  (JNIEnv *env, jclass cls, jobject obj)
-{
-	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
-	return (jdouble)cairo_get_alpha(cr);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
  * Method:    cairo_get_tolerance
  * Signature: (Lorg/gnu/glib/Handle;)D
  */
@@ -1108,18 +1063,6 @@
 
 /*
  * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_get_target_surface
- * Signature: (Lorg/gnu/glib/Handle;)Lorg/gnu/glib/Handle;
- */
-JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Context_cairo_1get_1target_1surface
-  (JNIEnv *env, jclass cls, jobject obj)
-{
-	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
-	return getHandleFromPointer(env, cairo_get_target_surface(cr));
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
  * Method:    cairo_status
  * Signature: (Lorg/gnu/glib/Handle;)I
  */
@@ -1144,182 +1087,6 @@
 
 
 
-CairoCallback* callback_data(JNIEnv *env, jclass cls, jobject cb)
-{
-  	jthrowable exc;
-  	jclass Exception;
-  	CairoCallback *cbdata;
-  	
-	cbdata = g_new(CairoCallback, 1);
-	cbdata->env = env;
-	cbdata->obj = (*env)->NewGlobalRef(env, cb);
-
-	if (NULL == move_to) {
-		move_to = (*env)->GetMethodID(env, cls, "move_to", "(DD)V");
-	    if (move_to == NULL ) {
-	        g_free(cbdata);
-	        return NULL;
-	    }
-	}
-
-	if (NULL == line_to) {
-		line_to = (*env)->GetMethodID(env, cls, "line_to", "(DD)V");
-	    if (line_to == NULL ) {
-	        g_free(cbdata);
-	        return NULL;
-	    }
-	}
-
-	if (NULL == curve_to) {
-		curve_to = (*env)->GetMethodID(env, cls, "curve_to", "(DDDDDD)V");
-	    if (curve_to == NULL ) {
-	        g_free(cbdata);
-	        return NULL;
-	    }
-	}
-
-	if (NULL == close_path) {
-		close_path = (*env)->GetMethodID(env, cls, "close_path", "()V");
-	    if (close_path == NULL ) {
-	        g_free(cbdata);
-	        return NULL;
-	    }
-	}
-    
-    return cbdata;
-}
-
-void move_to_callback(void *data, double x, double y)
-{
-	CairoCallback* cbdata = data;
-	jthrowable exc;
-
-	(*cbdata->env)->CallVoidMethod(cbdata->env, 
-				       cbdata->obj, 
-				       move_to,
-				       x, y); 
-	if (exc) {
-		/* Print stack trace */
-		(* cbdata->env)->ExceptionDescribe(cbdata->env);
-		/* clear the exception, so we can continue. */		
-    	(* cbdata->env)->ExceptionClear(cbdata->env);
-	}
-}
-
-void line_to_callback(void *data, double x, double y)
-{
-	CairoCallback* cbdata = data;
-	jthrowable exc;
-	
-	(*cbdata->env)->CallVoidMethod(cbdata->env, 
-				       cbdata->obj, 
-				       line_to, 
-				       x, y);
-
-	if (exc) {
-		/* Print stack trace */
-		(* cbdata->env)->ExceptionDescribe(cbdata->env);
-		/* clear the exception, so we can continue. */		
-    	(* cbdata->env)->ExceptionClear(cbdata->env);
-	}
-}
-
-void curve_to_callback(void *data, double x1, double y1, double x2, double y2,
-		double x3, double y3)
-{
-	CairoCallback* cbdata = data;
-	jthrowable exc;
-	
-	(*cbdata->env)->CallVoidMethod(cbdata->env, 
-				       cbdata->obj, 
-				       curve_to, 
-				       x1, y1, x2, y2, x3, y3);
-	if (exc) {
-		/* Print stack trace */
-		(* cbdata->env)->ExceptionDescribe(cbdata->env);
-		/* clear the exception, so we can continue. */		
-    	(* cbdata->env)->ExceptionClear(cbdata->env);
-	}
-}
-
-void close_path_callback(void *data)
-{
-	CairoCallback* cbdata = data;
-	jthrowable exc;
-	
-	(*cbdata->env)->CallVoidMethod(cbdata->env, 
-				       cbdata->obj, 
-				       move_to);
-	if (exc) {
-		/* Print stack trace */
-		(* cbdata->env)->ExceptionDescribe(cbdata->env);
-		/* clear the exception, so we can continue. */		
-    	(* cbdata->env)->ExceptionClear(cbdata->env);
-	}
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_get_path
- * Signature: (Lorg/gnu/glib/Handle;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1get_1path
-  (JNIEnv *env, jclass cls, jobject obj, jobject cb)
-{
-	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
-	CairoCallback *cbdata = callback_data(env, cls, cb);
-	if (cbdata == NULL)
-		return;
-	cairo_get_path(cr, move_to_callback, line_to_callback,
-			curve_to_callback, close_path_callback, cbdata);	
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_get_path_flat
- * Signature: (Lorg/gnu/glib/Handle;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1get_1path_1flat
-  (JNIEnv *env, jclass cls, jobject obj, jobject cb)
-{
-	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
-	CairoCallback *cbdata = callback_data(env, cls, cb);
-	if (cbdata == NULL)
-		return;
-	cairo_get_path_flat(cr, move_to_callback, line_to_callback,
-			close_path_callback, cbdata);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_set_target_image
- * Signature: (Lorg/gnu/glib/Handle;[cIIII)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1set_1target_1image
-  (JNIEnv *env, jclass cls, jobject obj, jcharArray data, jint format, jint width, jint height, jint stride)
-{
-	cairo_t *cr;
-	unsigned char* data_g;
-
-	cr = (cairo_t*)getPointerFromHandle(env, obj);
-	data_g = (unsigned char*)(*env)->GetCharArrayElements(env, data, NULL);
-	cairo_set_target_image(cr, data_g, (cairo_format_t)format, width, height, stride);
-	(*env)->ReleaseCharArrayElements(env, data, (jchar*)data_g, 0);
-}
-
-/*
- * Class:     org_freedesktop_cairo_Context
- * Method:    cairo_set_target_image_no_data
- * Signature: (Lorg/gnu/javagnome/Handle;III)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1set_1target_1image_1no_1data
-  (JNIEnv *env, jclass cls, jobject obj, jint format, jint width, jint height)
-{
-	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
-	cairo_set_target_image_no_data(cr, (cairo_format_t)format, width, height);	
-}
-
-
 #ifdef __cplusplus
 }
 #endif




More information about the cairo-commit mailing list