summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT PI
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c83
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java5
4 files changed, 91 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c
index 7a433f68de..78064ebda1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c
@@ -93,3 +93,86 @@ fail:
Cairo_NATIVE_EXIT(env, that, cairo_1extents_FUNC);
}
#endif
+
+#ifndef NO_cairo_1points
+#define PATH_MOVE_TO 0
+#define PATH_LINE_TO 1
+#define PATH_CURVE_TO 3
+#define PATH_CLOSE 4
+typedef struct _points_data {
+ jint *n_types;
+ jint *n_points;
+ jbyte *types;
+ jfloat *points;
+} points_data;
+
+static void pointsMoveTo(points_data *data, double x, double y) {
+ if (data->types != NULL) data->types[data->n_types[0]] = PATH_MOVE_TO;
+ if (data->points != NULL) {
+ int offset = data->n_points[0] * 2;
+ data->points[offset] = x;
+ data->points[offset + 1] = y;
+ }
+ data->n_types[0]++;
+ data->n_points[0]++;
+}
+
+static void pointsLineTo(points_data *data, double x, double y) {
+ if (data->types != NULL) data->types[data->n_types[0]] = PATH_LINE_TO;
+ if (data->points != NULL) {
+ int offset = data->n_points[0] * 2;
+ data->points[offset] = x;
+ data->points[offset + 1] = y;
+ }
+ data->n_types[0]++;
+ data->n_points[0]++;
+}
+
+static void pointsCurveTo(points_data *data, double x1, double y1, double x2, double y2, double x3, double y3) {
+ if (data->types != NULL) data->types[data->n_types[0]] = PATH_CURVE_TO;
+ if (data->points != NULL) {
+ int offset = data->n_points[0] * 2;
+ data->points[offset] = x1;
+ data->points[offset + 1] = y1;
+ data->points[offset + 2] = x2;
+ data->points[offset + 3] = y2;
+ data->points[offset + 4] = x3;
+ data->points[offset + 5] = y3;
+ }
+ data->n_types[0]++;
+ data->n_points[0] += 3;
+}
+
+static void pointsClosePath(points_data *data) {
+ if (data->types != NULL) data->types[data->n_types[0]] = PATH_CLOSE;
+ data->n_types[0]++;
+}
+
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1points)
+ (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2, jbyteArray arg3, jfloatArray arg4)
+{
+ points_data data;
+ jint *lparg1=NULL;
+ jint *lparg2=NULL;
+ jbyte *lparg3=NULL;
+ jfloat *lparg4=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1points_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetFloatArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ data.n_types = lparg1;
+ data.n_points = lparg2;
+ data.types = lparg3;
+ data.points = lparg4;
+ data.n_types[0] = data.n_points[0] = 0;
+ cairo_current_path((cairo_t *)arg0, (cairo_move_to_func_t *)pointsMoveTo, (cairo_line_to_func_t *)pointsLineTo, (cairo_curve_to_func_t *)pointsCurveTo, (cairo_close_path_func_t *)pointsClosePath, (void *)&data);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseFloatArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1points_FUNC);
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
index 97dd86a2de..b3208e050c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
@@ -24,8 +24,8 @@
#ifdef NATIVE_STATS
-int Cairo_nativeFunctionCount = 124;
-int Cairo_nativeFunctionCallCount[124];
+int Cairo_nativeFunctionCount = 125;
+int Cairo_nativeFunctionCallCount[125];
char * Cairo_nativeFunctionNames[] = {
"cairo_1add_1path",
"cairo_1arc",
@@ -100,6 +100,7 @@ char * Cairo_nativeFunctionNames[] = {
"cairo_1pattern_1set_1extend",
"cairo_1pattern_1set_1filter",
"cairo_1pattern_1set_1matrix",
+ "cairo_1points",
"cairo_1rectangle",
"cairo_1reference",
"cairo_1rel_1curve_1to",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
index 97b6cc0e27..4a5a6c8386 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
@@ -104,6 +104,7 @@ typedef enum {
cairo_1pattern_1set_1extend_FUNC,
cairo_1pattern_1set_1filter_FUNC,
cairo_1pattern_1set_1matrix_FUNC,
+ cairo_1points_FUNC,
cairo_1rectangle_FUNC,
cairo_1reference_FUNC,
cairo_1rel_1curve_1to_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
index 12944a92d3..bd4dd7b075 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
@@ -80,9 +80,12 @@ public class Cairo {
/** 64*/
public static final synchronized native int cairo_font_extents_t_sizeof ();
-/** Natives */
+/** Custom natives */
public static final synchronized native void cairo_add_path (int /*long*/ cr1, int /*long*/ cr2);
public static final synchronized native void cairo_extents (int /*long*/ cr, double[] extents);
+public static final synchronized native void cairo_points (int /*long*/ cr, int[] n_types, int[] n_points, byte[] types, float[] points);
+
+/** Natives */
public static final synchronized native int /*long*/ cairo_create ();
public static final synchronized native void cairo_reference (int /*long*/ cr);
public static final synchronized native void cairo_destroy (int /*long*/ cr);