[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_Surface.c,
1.11, 1.12 org_freedesktop_cairo_Pattern.c, 1.6,
1.7 org_freedesktop_cairo_ImageSurface.c, 1.3,
1.4 org_freedesktop_cairo_Status.c, NONE,
1.1 org_freedesktop_cairo_ScaledFont.c, 1.3,
1.4 org_freedesktop_cairo_PDFSurface.c, 1.5,
1.6 org_freedesktop_cairo_Context.c, 1.9,
1.10 org_freedesktop_cairo_FontFace.c, 1.5, 1.6
Jeffrey Morgan
commit at pdx.freedesktop.org
Tue Aug 16 17:23:46 PDT 2005
- Previous message: [cairo-commit] cairo ChangeLog, 1.894, 1.895 configure.in, 1.125,
1.126
- Next message: [cairo-commit] cairo-java/src/java/org/freedesktop/cairo
Surface.java, 1.14, 1.15 PDFSurface.java, 1.4, 1.5 Status.java,
1.9, 1.10 FontFace.java, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv18581/src/jni
Modified Files:
org_freedesktop_cairo_Surface.c
org_freedesktop_cairo_Pattern.c
org_freedesktop_cairo_ImageSurface.c
org_freedesktop_cairo_ScaledFont.c
org_freedesktop_cairo_PDFSurface.c
org_freedesktop_cairo_Context.c
org_freedesktop_cairo_FontFace.c
Added Files:
org_freedesktop_cairo_Status.c
Log Message:
Numerous updates and bug fixes (thanks Owen)
Index: org_freedesktop_cairo_Surface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- org_freedesktop_cairo_Surface.c 13 Aug 2005 22:35:13 -0000 1.11
+++ org_freedesktop_cairo_Surface.c 17 Aug 2005 00:23:44 -0000 1.12
@@ -34,32 +34,12 @@
surface = cairo_surface_create_similar(other_g, (cairo_content_t)content,
width, height);
- if (surface)
- cairo_surface_reference(surface);
return getHandleFromPointer(env, surface);
}
/*
* Class: org_freedesktop_cairo_Surface
- * Method: alloc
- * Signature: ()Lorg/gnu/javagnome/Handle;
- */
-JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Surface_alloc
- (JNIEnv *env, jclass cls)
-{
- cairo_surface_t *surface;
-
- // TODO: alloc
-// surface = malloc (sizeof (cairo_surface_t));
-// if (surface)
-// cairo_surface_reference(surface);
-// return getHandleFromPointer(env, surface);
- return NULL;
-}
-
-/*
- * Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
Index: org_freedesktop_cairo_Pattern.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Pattern.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- org_freedesktop_cairo_Pattern.c 2 Jul 2005 11:10:54 -0000 1.6
+++ org_freedesktop_cairo_Pattern.c 17 Aug 2005 00:23:44 -0000 1.7
@@ -31,8 +31,6 @@
surface_g = (cairo_surface_t*)getPointerFromHandle(env, surface);
pat = cairo_pattern_create_for_surface(surface_g);
- if (pat)
- cairo_pattern_reference(pat);
return getHandleFromPointer(env, pat);
}
@@ -76,8 +74,6 @@
cairo_pattern_t *pat;
pat = cairo_pattern_create_linear(x1, y1, x2, y2);
- if (pat)
- cairo_pattern_reference(pat);
return getHandleFromPointer(env, pat);
}
@@ -94,8 +90,6 @@
cairo_pattern_t *pat;
pat = cairo_pattern_create_radial(x1, y1, radius1, x2, y2, radius2);
- if (pat)
- cairo_pattern_reference(pat);
return getHandleFromPointer(env, pat);
}
Index: org_freedesktop_cairo_ImageSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_ImageSurface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- org_freedesktop_cairo_ImageSurface.c 10 May 2005 01:28:15 -0000 1.3
+++ org_freedesktop_cairo_ImageSurface.c 17 Aug 2005 00:23:44 -0000 1.4
@@ -27,8 +27,6 @@
{
cairo_surface_t *surface = cairo_image_surface_create(
(cairo_format_t)format, width, height);
- if (surface)
- cairo_surface_reference(surface);
return getHandleFromPointer(env, surface);
}
@@ -42,12 +40,14 @@
{
unsigned char* data_g;
cairo_surface_t *surface;
-
+
+ /* FIXME: This is entirely bogus; cairo_image_surcace_create_for_data()
+ * doesn't make a copy. We also need to check that the array passed
+ * in is the right size.
+ */
data_g = (unsigned char*)(*env)->GetCharArrayElements(env, data, NULL);
surface = cairo_image_surface_create_for_data(data_g,
(cairo_format_t)format, width, height, stride);
- if (surface)
- cairo_surface_reference(surface);
(*env)->ReleaseCharArrayElements(env, data, (jchar*)data_g, 0);
return getHandleFromPointer(env, surface);
}
--- NEW FILE: org_freedesktop_cairo_Status.c ---
/*
* Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
#include <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Status
#define _Included_org_freedesktop_cairo_Status
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_Status
* Method: cairo_status_to_string
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_freedesktop_cairo_Status_cairo_1status_1to_1string
(JNIEnv *env, jclass cls, jint status)
{
return (*env)->NewStringUTF(env, cairo_status_to_string(status));
}
#ifdef __cplusplus
}
#endif
#endif
Index: org_freedesktop_cairo_ScaledFont.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_ScaledFont.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- org_freedesktop_cairo_ScaledFont.c 13 Aug 2005 22:11:22 -0000 1.3
+++ org_freedesktop_cairo_ScaledFont.c 17 Aug 2005 00:23:44 -0000 1.4
@@ -38,7 +38,7 @@
sf = cairo_scaled_font_create(face_g, matrix_g, ctm_g, options_g);
- return getHandleFromPointer(env, cairo_scaled_font_reference(sf));
+ return getHandleFromPointer(env, sf);
}
/*
@@ -50,7 +50,7 @@
(JNIEnv *env, jclass cls, jobject sfont, jobject ext)
{
cairo_scaled_font_t *sfont_g = (cairo_scaled_font_t*)getPointerFromHandle(env, sfont);
- cairo_font_extents_t* ext_g;
+ cairo_font_extents_t* ext_g = g_new(cairo_font_extents_t, 1);
cairo_scaled_font_extents(sfont_g, ext_g);
updateHandle(env, ext, ext_g);
}
Index: org_freedesktop_cairo_PDFSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_PDFSurface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- org_freedesktop_cairo_PDFSurface.c 2 Jun 2005 17:51:06 -0000 1.5
+++ org_freedesktop_cairo_PDFSurface.c 17 Aug 2005 00:23:44 -0000 1.6
@@ -38,16 +38,16 @@
/*
* Class: org_freedesktop_cairo_PDFSurface
- * Method: cairo_pdf_surface_set_ppi
+ * Method: cairo_pdf_surface_set_dpi
* Signature: (Lorg/gnu/javagnome/Handle;DD)V
*/
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PDFSurface_cairo_1pdf_1surface_1set_1ppi
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PDFSurface_cairo_1pdf_1surface_1set_1dpi
(JNIEnv *env, jclass cls, jobject sur, jdouble x, jdouble y)
{
cairo_surface_t *s;
s = getPointerFromHandle(env, sur);
- cairo_pdf_surface_set_ppi(s, x, y);
+ cairo_pdf_surface_set_dpi(s, x, y);
}
Index: org_freedesktop_cairo_Context.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- org_freedesktop_cairo_Context.c 13 Aug 2005 22:35:13 -0000 1.9
+++ org_freedesktop_cairo_Context.c 17 Aug 2005 00:23:44 -0000 1.10
@@ -1,4 +1,4 @@
-/*
+ /*
* Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
@@ -809,6 +809,7 @@
cairo_glyph_t *glyphs_g = (cairo_glyph_t*)getPointerArrayFromHandles(env, glyphs);
int len = (*env)->GetArrayLength(env, glyphs);
cairo_show_glyphs(cr, glyphs_g, len);
+ g_free(glyphs_g);
}
/*
@@ -832,8 +833,7 @@
(JNIEnv *env, jclass cls, jobject obj, jobject extents)
{
cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
- /* TODO: should i be initializing to NULL? */
- cairo_font_extents_t *extents_g = (cairo_font_extents_t*)getPointerFromHandle(env, extents);
+ cairo_font_extents_t *extents_g = g_new(cairo_font_extents_t, 1);
cairo_font_extents(cr, extents_g);
updateHandle(env, extents, extents_g);
}
@@ -881,10 +881,11 @@
{
cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
cairo_glyph_t *glyphs_g = (cairo_glyph_t*)getPointerArrayFromHandles(env, glyphs);
- cairo_text_extents_t *extents_g = (cairo_text_extents_t*)getPointerFromHandle(env, extents);
+ cairo_text_extents_t *extents_g = g_new(cairo_text_extents_t, 1);
int len = (*env)->GetArrayLength(env, glyphs);
cairo_glyph_extents(cr, glyphs_g, len, extents_g);
updateHandle(env, extents, extents_g);
+ g_free(glyphs_g);
}
/*
@@ -913,6 +914,7 @@
cairo_glyph_t *glyphs_g = (cairo_glyph_t*)getPointerArrayFromHandles(env, glyphs);
int len = (*env)->GetArrayLength(env, glyphs);
cairo_glyph_path(cr, glyphs_g, len);
+ g_free(glyphs_g);
}
/*
Index: org_freedesktop_cairo_FontFace.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_FontFace.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- org_freedesktop_cairo_FontFace.c 13 Aug 2005 22:11:22 -0000 1.5
+++ org_freedesktop_cairo_FontFace.c 17 Aug 2005 00:23:44 -0000 1.6
@@ -21,25 +21,6 @@
/*
* Class: org_freedesktop_cairo_FontFace
- * Method: alloc
- * Signature: ()Lorg/gnu/javagnome/Handle;
- */
-JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_FontFace_alloc
- (JNIEnv *env, jclass cls)
-{
- cairo_font_face_t *font;
-
- // No way to malloc cairo_font_face_t
-// font = malloc(sizeof(cairo_font_face_t));
-// if (font)
-// return getHandleFromPointer(env, cairo_font_face_reference(font));
-// return getHandleFromPointer(env, font);
- return NULL;
-}
-
-
-/*
- * Class: org_freedesktop_cairo_FontFace
* Method: cairo_font_face_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
- Previous message: [cairo-commit] cairo ChangeLog, 1.894, 1.895 configure.in, 1.125,
1.126
- Next message: [cairo-commit] cairo-java/src/java/org/freedesktop/cairo
Surface.java, 1.14, 1.15 PDFSurface.java, 1.4, 1.5 Status.java,
1.9, 1.10 FontFace.java, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list