[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_Surface.c,
1.7, 1.8 org_freedesktop_cairo_ScaledFont.c, 1.1, 1.2
Jeffrey Morgan
commit at pdx.freedesktop.org
Mon May 9 09:02:09 PDT 2005
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv12741/src/jni
Modified Files:
org_freedesktop_cairo_Surface.c
org_freedesktop_cairo_ScaledFont.c
Log Message:
added code to perform proper referencing of objects.
Index: org_freedesktop_cairo_Surface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Surface.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- org_freedesktop_cairo_Surface.c 7 May 2005 00:27:02 -0000 1.7
+++ org_freedesktop_cairo_Surface.c 9 May 2005 16:02:07 -0000 1.8
@@ -26,23 +26,17 @@
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1create_1similar
(JNIEnv *env, jclass cls, jobject other, jint format, jint width, jint height)
{
- cairo_surface_t *other_g = (cairo_surface_t*)getPointerFromHandle(env, other);
- return getHandleFromPointer(env, cairo_surface_create_similar(other_g, (cairo_format_t)format,
- width, height));
-}
-
-/*
- * Class: org_freedesktop_cairo_Surface
- * Method: cairo_surface_reference
- * Signature: (Lorg/gnu/glib/Handle;)V
- */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1reference
- (JNIEnv *env, jclass cls, jobject obj)
-{
- cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
+ cairo_surface_t *other_g;
+ cairo_surface_t *surface;
+
+ other_g = (cairo_surface_t*)getPointerFromHandle(env, other);
- cairo_surface_reference(surface);
- updateHandle(env, obj, &surface);
+ surface = cairo_surface_create_similar(other_g, (cairo_format_t)format,
+ width, height);
+ if (surface)
+ cairo_surface_reference(surface);
+
+ return getHandleFromPointer(env, surface);
}
/*
Index: org_freedesktop_cairo_ScaledFont.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_ScaledFont.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- org_freedesktop_cairo_ScaledFont.c 23 Apr 2005 19:25:56 -0000 1.1
+++ org_freedesktop_cairo_ScaledFont.c 9 May 2005 16:02:07 -0000 1.2
@@ -25,11 +25,21 @@
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_ScaledFont_cairo_1scaled_1font_1create
(JNIEnv *env, jclass cls, jobject face, jobject matrix, jobject ctm)
{
- cairo_font_face_t *face_g = (cairo_font_face_t*)getPointerFromHandle(env, face);
- cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
- cairo_matrix_t *ctm_g = (cairo_matrix_t*)getPointerFromHandle(env, ctm);
- return getHandleFromPointer(env,
- cairo_scaled_font_create(face_g, matrix_g, ctm_g));
+ cairo_font_face_t *face_g;
+ cairo_matrix_t *matrix_g;
+ cairo_matrix_t *ctm_g;
+ cairo_scaled_font_t *sf;
+
+ face_g = (cairo_font_face_t*)getPointerFromHandle(env, face);
+ matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
+ ctm_g = (cairo_matrix_t*)getPointerFromHandle(env, ctm);
+
+ sf = cairo_scaled_font_create(face_g, matrix_g, ctm_g);
+ if (sf)
+ cairo_scaled_font_reference(sf);
+
+ return getHandleFromPointer(env, sf);
+
}
/*
More information about the cairo-commit
mailing list