[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_PDFSurface.c, 1.4, 1.5

Jeffrey Morgan commit at pdx.freedesktop.org
Thu Jun 2 10:51:08 PDT 2005


Committed by: kuzman

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

Modified Files:
	org_freedesktop_cairo_PDFSurface.c 
Log Message:
updated bindings to match upstream changes.

Index: org_freedesktop_cairo_PDFSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_PDFSurface.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- org_freedesktop_cairo_PDFSurface.c	16 May 2005 14:44:13 -0000	1.4
+++ org_freedesktop_cairo_PDFSurface.c	2 Jun 2005 17:51:06 -0000	1.5
@@ -19,11 +19,6 @@
 extern "C" {
 #endif
 
-typedef struct jg_pdfsurface {
-	cairo_surface_t *surface;
-	FILE *file;
-} jg_pdfsurface_t;
-
 /*
  * Class:     org_freedesktop_cairo_PDFSurface
  * Method:    cairo_pdf_surface_create
@@ -32,27 +27,13 @@
 JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_PDFSurface_cairo_1pdf_1surface_1create
   (JNIEnv *env, jclass cls, jstring filename, jdouble width, jdouble height)
 {
-	jg_pdfsurface_t *s = malloc(sizeof(jg_pdfsurface_t));
-	char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
-	FILE *f = fopen(fn, "w");
-	cairo_surface_t *sur = cairo_pdf_surface_create(f, width, height);
+	char *fn;
+	cairo_surface_t *sur;
+	
+	fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
+	sur = cairo_pdf_surface_create(fn, width, height);
 	(*env)->ReleaseStringUTFChars(env, filename, fn);
-	s->surface = sur;
-	s->file = f;
-	return getHandleFromPointer(env, s);
-}
-
-/*
- * Class:     org_freedesktop_cairo_PDFSurface
- * Method:    close_file
- * Signature: (Lorg/gnu/glib/Handle;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PDFSurface_close
-  (JNIEnv *env, jclass cls, jobject sur)
-{
-	jg_pdfsurface_t *s = (jg_pdfsurface_t*)getPointerFromHandle(env, sur);
-	fclose(s->file);
-	free(s);
+	return getHandleFromPointer(env, sur);
 }
 
 /*
@@ -63,9 +44,9 @@
 JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PDFSurface_cairo_1pdf_1surface_1set_1ppi
   (JNIEnv *env, jclass cls, jobject sur, jdouble x, jdouble y)
 {
-	jg_pdfsurface_t *s;
+	cairo_surface_t *s;
 	
-	s = (jg_pdfsurface_t*)getPointerFromHandle(env, sur);
+	s = getPointerFromHandle(env, sur);
 	cairo_pdf_surface_set_ppi(s, x, y);
 }
 




More information about the cairo-commit mailing list