summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2005-03-22 16:47:10 +0000
committerSilenio Quarti <silenio>2005-03-22 16:47:10 +0000
commitea58e97ac5ce5b3c8718b16cdc5391fa3f361299 (patch)
tree61cc88c00aeb2169fb407e01ae0b7693e700fdeb /bundles/org.eclipse.swt
parent226d349ac9ca22240bc56e4676ede7bfeaccd06d (diff)
downloadeclipse.platform.swt-ea58e97ac5ce5b3c8718b16cdc5391fa3f361299.tar.gz
eclipse.platform.swt-ea58e97ac5ce5b3c8718b16cdc5391fa3f361299.tar.xz
eclipse.platform.swt-ea58e97ac5ce5b3c8718b16cdc5391fa3f361299.zip
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c50
-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.java1
4 files changed, 51 insertions, 6 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 8e782286ee..7a433f68de 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
@@ -26,19 +26,19 @@
#define Cairo_NATIVE(func) Java_org_eclipse_swt_internal_cairo_Cairo_##func
#ifndef NO_cairo_1add_1path
-void moveTo(cairo_t *cairo, double x, double y) {
+static void moveTo(cairo_t *cairo, double x, double y) {
cairo_move_to(cairo, x, y);
}
-void lineTo(cairo_t *cairo, double x, double y) {
+static void lineTo(cairo_t *cairo, double x, double y) {
cairo_line_to(cairo, x, y);
}
-void curveTo(cairo_t *cairo, double x1, double y1, double x2, double y2, double x3, double y3) {
+static void curveTo(cairo_t *cairo, double x1, double y1, double x2, double y2, double x3, double y3) {
cairo_curve_to(cairo, x1, y1, x2, y2, x3, y3);
}
-void closePath(cairo_t *cairo) {
+static void closePath(cairo_t *cairo) {
cairo_close_path(cairo);
}
@@ -51,3 +51,45 @@ JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1add_1path)
Cairo_NATIVE_EXIT(env, that, cairo_1add_1path_FUNC);
}
#endif
+
+#ifndef NO_cairo_1extents
+#include <float.h>
+#define EXTENTS(x, y, extents) \
+ if (x < extents[0]) extents[0] = x; \
+ if (y < extents[1]) extents[1] = y; \
+ if (x > extents[2]) extents[2] = x; \
+ if (y > extents[3]) extents[3] = y;
+
+static void extentsMoveTo(jdouble *extents, double x, double y) {
+ EXTENTS(x, y, extents)
+}
+
+static void extentsLineTo(jdouble *extents, double x, double y) {
+ EXTENTS(x, y, extents)
+}
+
+static void extentsCurveTo(jdouble *extents, double x1, double y1, double x2, double y2, double x3, double y3) {
+ EXTENTS(x1, y1, extents)
+ EXTENTS(x2, y2, extents)
+ EXTENTS(x3, y3, extents)
+}
+
+static void extentsClosePath(jdouble *extents) {
+}
+
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1extents)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1)
+{
+ jdouble *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1extents_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ lparg1[0] = lparg1[1] = DBL_MAX;
+ lparg1[2] = lparg1[3] = DBL_MIN;
+ cairo_current_path((cairo_t *)arg0, (cairo_move_to_func_t *)extentsMoveTo, (cairo_line_to_func_t *)extentsLineTo, (cairo_curve_to_func_t *)extentsCurveTo, (cairo_close_path_func_t *)extentsClosePath, (void *)lparg1);
+ if (lparg1[0] == lparg1[1] && lparg1[0] == DBL_MAX) lparg1[0] = lparg1[1] = 0;
+ if (lparg1[2] == lparg1[3] && lparg1[2] == DBL_MAX) lparg1[2] = lparg1[3] = 0;
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1extents_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 a3be62d3b1..97dd86a2de 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 = 123;
-int Cairo_nativeFunctionCallCount[123];
+int Cairo_nativeFunctionCount = 124;
+int Cairo_nativeFunctionCallCount[124];
char * Cairo_nativeFunctionNames[] = {
"cairo_1add_1path",
"cairo_1arc",
@@ -56,6 +56,7 @@ char * Cairo_nativeFunctionNames[] = {
"cairo_1curve_1to",
"cairo_1default_1matrix",
"cairo_1destroy",
+ "cairo_1extents",
"cairo_1fill",
"cairo_1fill_1extents",
"cairo_1font_1destroy",
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 cc729d3398..97b6cc0e27 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
@@ -60,6 +60,7 @@ typedef enum {
cairo_1curve_1to_FUNC,
cairo_1default_1matrix_FUNC,
cairo_1destroy_FUNC,
+ cairo_1extents_FUNC,
cairo_1fill_FUNC,
cairo_1fill_1extents_FUNC,
cairo_1font_1destroy_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 719dbe3391..12944a92d3 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
@@ -82,6 +82,7 @@ public static final synchronized native int cairo_font_extents_t_sizeof ();
/** 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 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);