summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov <akurtako@redhat.com>2013-07-12 17:05:58 +0300
committerAlexander Kurtakov <akurtako@redhat.com>2013-07-12 17:05:58 +0300
commitd2e5c07029c231cf71046f566a084417747c40b0 (patch)
treeda775e917d34f7e81456b6b5354ab83f9bb7e921
parente6aa5ace75b7d76f999c03a1263487de3b558d2d (diff)
downloadeclipse.platform.swt-d2e5c07029c231cf71046f566a084417747c40b0.tar.gz
eclipse.platform.swt-d2e5c07029c231cf71046f566a084417747c40b0.tar.xz
eclipse.platform.swt-d2e5c07029c231cf71046f566a084417747c40b0.zip
GC remove GTK pre-2.8 code paths.
This allows reducing the Cairo bindings and simplifies the codebase.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c95
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c91
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java65
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_text_extents_t.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java96
9 files changed, 22 insertions, 432 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
index 8c2052bcaa..ee6c4b2772 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2012 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2013 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
@@ -242,20 +242,6 @@ JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1fill_1preserve)
}
#endif
-#ifndef NO__1cairo_1font_1extents
-JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1font_1extents)
- (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
-{
- cairo_font_extents_t _arg1, *lparg1=NULL;
- Cairo_NATIVE_ENTER(env, that, _1cairo_1font_1extents_FUNC);
- if (arg1) if ((lparg1 = getcairo_font_extents_tFields(env, arg1, &_arg1)) == NULL) goto fail;
- cairo_font_extents((cairo_t *)arg0, lparg1);
-fail:
- if (arg1 && lparg1) setcairo_font_extents_tFields(env, arg1, lparg1);
- Cairo_NATIVE_EXIT(env, that, _1cairo_1font_1extents_FUNC);
-}
-#endif
-
#ifndef NO__1cairo_1font_1options_1create
JNIEXPORT jintLong JNICALL Cairo_NATIVE(_1cairo_1font_1options_1create)
(JNIEnv *env, jclass that)
@@ -387,16 +373,6 @@ fail:
}
#endif
-#ifndef NO__1cairo_1get_1font_1options
-JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1get_1font_1options)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
-{
- Cairo_NATIVE_ENTER(env, that, _1cairo_1get_1font_1options_FUNC);
- cairo_get_font_options((cairo_t *)arg0, (cairo_font_options_t *)arg1);
- Cairo_NATIVE_EXIT(env, that, _1cairo_1get_1font_1options_FUNC);
-}
-#endif
-
#ifndef NO__1cairo_1get_1line_1cap
JNIEXPORT jint JNICALL Cairo_NATIVE(_1cairo_1get_1line_1cap)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -1523,20 +1499,6 @@ JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1show_1page)
}
#endif
-#ifndef NO__1cairo_1show_1text
-JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1show_1text)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
-{
- jbyte *lparg1=NULL;
- Cairo_NATIVE_ENTER(env, that, _1cairo_1show_1text_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
- cairo_show_text((cairo_t *)arg0, (const char *)lparg1);
-fail:
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- Cairo_NATIVE_EXIT(env, that, _1cairo_1show_1text_FUNC);
-}
-#endif
-
#ifndef NO__1cairo_1status
JNIEXPORT jint JNICALL Cairo_NATIVE(_1cairo_1status)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -1758,37 +1720,6 @@ JNIEXPORT jint JNICALL Cairo_NATIVE(_1cairo_1surface_1set_1user_1data)
}
#endif
-#ifndef NO__1cairo_1text_1extents
-JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1text_1extents)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jobject arg2)
-{
- jbyte *lparg1=NULL;
- cairo_text_extents_t _arg2, *lparg2=NULL;
- Cairo_NATIVE_ENTER(env, that, _1cairo_1text_1extents_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
- if (arg2) if ((lparg2 = getcairo_text_extents_tFields(env, arg2, &_arg2)) == NULL) goto fail;
- cairo_text_extents((cairo_t *)arg0, (const char *)lparg1, (cairo_text_extents_t *)lparg2);
-fail:
- if (arg2 && lparg2) setcairo_text_extents_tFields(env, arg2, lparg2);
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- Cairo_NATIVE_EXIT(env, that, _1cairo_1text_1extents_FUNC);
-}
-#endif
-
-#ifndef NO__1cairo_1text_1path
-JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1text_1path)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
-{
- jbyte *lparg1=NULL;
- Cairo_NATIVE_ENTER(env, that, _1cairo_1text_1path_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
- cairo_text_path((cairo_t *)arg0, (const char *)lparg1);
-fail:
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- Cairo_NATIVE_EXIT(env, that, _1cairo_1text_1path_FUNC);
-}
-#endif
-
#ifndef NO__1cairo_1transform
JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1transform)
(JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1)
@@ -1941,18 +1872,6 @@ JNIEXPORT void JNICALL Cairo_NATIVE(_1cairo_1xlib_1surface_1set_1size)
}
#endif
-#ifndef NO_cairo_1font_1extents_1t_1sizeof
-JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1font_1extents_1t_1sizeof)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- Cairo_NATIVE_ENTER(env, that, cairo_1font_1extents_1t_1sizeof_FUNC);
- rc = (jint)cairo_font_extents_t_sizeof();
- Cairo_NATIVE_EXIT(env, that, cairo_1font_1extents_1t_1sizeof_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_cairo_1path_1data_1t_1sizeof
JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1path_1data_1t_1sizeof)
(JNIEnv *env, jclass that)
@@ -1977,18 +1896,6 @@ JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1path_1t_1sizeof)
}
#endif
-#ifndef NO_cairo_1text_1extents_1t_1sizeof
-JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1text_1extents_1t_1sizeof)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- Cairo_NATIVE_ENTER(env, that, cairo_1text_1extents_1t_1sizeof_FUNC);
- rc = (jint)cairo_text_extents_t_sizeof();
- Cairo_NATIVE_EXIT(env, that, cairo_1text_1extents_1t_1sizeof_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_cairo_1version
JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1version)
(JNIEnv *env, jclass that)
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 5cdb9a0ddf..1ed286b6f2 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
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2012 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2013 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
@@ -43,7 +43,6 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1fill",
"_1cairo_1fill_1extents",
"_1cairo_1fill_1preserve",
- "_1cairo_1font_1extents",
"_1cairo_1font_1options_1create",
"_1cairo_1font_1options_1destroy",
"_1cairo_1font_1options_1get_1antialias",
@@ -54,7 +53,6 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1get_1fill_1rule",
"_1cairo_1get_1font_1face",
"_1cairo_1get_1font_1matrix",
- "_1cairo_1get_1font_1options",
"_1cairo_1get_1line_1cap",
"_1cairo_1get_1line_1join",
"_1cairo_1get_1line_1width",
@@ -146,7 +144,6 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1set_1tolerance",
"_1cairo_1show_1glyphs",
"_1cairo_1show_1page",
- "_1cairo_1show_1text",
"_1cairo_1status",
"_1cairo_1status_1to_1string",
"_1cairo_1stroke",
@@ -164,8 +161,6 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1surface_1set_1device_1offset",
"_1cairo_1surface_1set_1fallback_1resolution",
"_1cairo_1surface_1set_1user_1data",
- "_1cairo_1text_1extents",
- "_1cairo_1text_1path",
"_1cairo_1transform",
"_1cairo_1translate",
"_1cairo_1user_1to_1device",
@@ -176,10 +171,8 @@ char * Cairo_nativeFunctionNames[] = {
"_1cairo_1xlib_1surface_1get_1height",
"_1cairo_1xlib_1surface_1get_1width",
"_1cairo_1xlib_1surface_1set_1size",
- "cairo_1font_1extents_1t_1sizeof",
"cairo_1path_1data_1t_1sizeof",
"cairo_1path_1t_1sizeof",
- "cairo_1text_1extents_1t_1sizeof",
"cairo_1version",
#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_cairo_cairo_1path_1data_1t_2II",
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 79bfc95f83..bcb3f25550 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
@@ -15,7 +15,7 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2012 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2013 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
@@ -53,7 +53,6 @@ typedef enum {
_1cairo_1fill_FUNC,
_1cairo_1fill_1extents_FUNC,
_1cairo_1fill_1preserve_FUNC,
- _1cairo_1font_1extents_FUNC,
_1cairo_1font_1options_1create_FUNC,
_1cairo_1font_1options_1destroy_FUNC,
_1cairo_1font_1options_1get_1antialias_FUNC,
@@ -64,7 +63,6 @@ typedef enum {
_1cairo_1get_1fill_1rule_FUNC,
_1cairo_1get_1font_1face_FUNC,
_1cairo_1get_1font_1matrix_FUNC,
- _1cairo_1get_1font_1options_FUNC,
_1cairo_1get_1line_1cap_FUNC,
_1cairo_1get_1line_1join_FUNC,
_1cairo_1get_1line_1width_FUNC,
@@ -156,7 +154,6 @@ typedef enum {
_1cairo_1set_1tolerance_FUNC,
_1cairo_1show_1glyphs_FUNC,
_1cairo_1show_1page_FUNC,
- _1cairo_1show_1text_FUNC,
_1cairo_1status_FUNC,
_1cairo_1status_1to_1string_FUNC,
_1cairo_1stroke_FUNC,
@@ -174,8 +171,6 @@ typedef enum {
_1cairo_1surface_1set_1device_1offset_FUNC,
_1cairo_1surface_1set_1fallback_1resolution_FUNC,
_1cairo_1surface_1set_1user_1data_FUNC,
- _1cairo_1text_1extents_FUNC,
- _1cairo_1text_1path_FUNC,
_1cairo_1transform_FUNC,
_1cairo_1translate_FUNC,
_1cairo_1user_1to_1device_FUNC,
@@ -186,10 +181,8 @@ typedef enum {
_1cairo_1xlib_1surface_1get_1height_FUNC,
_1cairo_1xlib_1surface_1get_1width_FUNC,
_1cairo_1xlib_1surface_1set_1size_FUNC,
- cairo_1font_1extents_1t_1sizeof_FUNC,
cairo_1path_1data_1t_1sizeof_FUNC,
cairo_1path_1t_1sizeof_FUNC,
- cairo_1text_1extents_1t_1sizeof_FUNC,
cairo_1version_FUNC,
#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_cairo_cairo_1path_1data_1t_2II_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c
index e9b4407bb8..49b7749b30 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c
@@ -15,56 +15,13 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2012 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2013 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
#include "swt.h"
#include "cairo_structs.h"
-#ifndef NO_cairo_font_extents_t
-typedef struct cairo_font_extents_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID ascent, descent, height, max_x_advance, max_y_advance;
-} cairo_font_extents_t_FID_CACHE;
-
-cairo_font_extents_t_FID_CACHE cairo_font_extents_tFc;
-
-void cachecairo_font_extents_tFields(JNIEnv *env, jobject lpObject)
-{
- if (cairo_font_extents_tFc.cached) return;
- cairo_font_extents_tFc.clazz = (*env)->GetObjectClass(env, lpObject);
- cairo_font_extents_tFc.ascent = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "ascent", "D");
- cairo_font_extents_tFc.descent = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "descent", "D");
- cairo_font_extents_tFc.height = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "height", "D");
- cairo_font_extents_tFc.max_x_advance = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "max_x_advance", "D");
- cairo_font_extents_tFc.max_y_advance = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "max_y_advance", "D");
- cairo_font_extents_tFc.cached = 1;
-}
-
-cairo_font_extents_t *getcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct)
-{
- if (!cairo_font_extents_tFc.cached) cachecairo_font_extents_tFields(env, lpObject);
- lpStruct->ascent = (*env)->GetDoubleField(env, lpObject, cairo_font_extents_tFc.ascent);
- lpStruct->descent = (*env)->GetDoubleField(env, lpObject, cairo_font_extents_tFc.descent);
- lpStruct->height = (*env)->GetDoubleField(env, lpObject, cairo_font_extents_tFc.height);
- lpStruct->max_x_advance = (*env)->GetDoubleField(env, lpObject, cairo_font_extents_tFc.max_x_advance);
- lpStruct->max_y_advance = (*env)->GetDoubleField(env, lpObject, cairo_font_extents_tFc.max_y_advance);
- return lpStruct;
-}
-
-void setcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct)
-{
- if (!cairo_font_extents_tFc.cached) cachecairo_font_extents_tFields(env, lpObject);
- (*env)->SetDoubleField(env, lpObject, cairo_font_extents_tFc.ascent, (jdouble)lpStruct->ascent);
- (*env)->SetDoubleField(env, lpObject, cairo_font_extents_tFc.descent, (jdouble)lpStruct->descent);
- (*env)->SetDoubleField(env, lpObject, cairo_font_extents_tFc.height, (jdouble)lpStruct->height);
- (*env)->SetDoubleField(env, lpObject, cairo_font_extents_tFc.max_x_advance, (jdouble)lpStruct->max_x_advance);
- (*env)->SetDoubleField(env, lpObject, cairo_font_extents_tFc.max_y_advance, (jdouble)lpStruct->max_y_advance);
-}
-#endif
-
#ifndef NO_cairo_path_data_t
typedef struct cairo_path_data_t_FID_CACHE {
int cached;
@@ -136,49 +93,3 @@ void setcairo_path_tFields(JNIEnv *env, jobject lpObject, cairo_path_t *lpStruct
}
#endif
-#ifndef NO_cairo_text_extents_t
-typedef struct cairo_text_extents_t_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID x_bearing, y_bearing, width, height, x_advance, y_advance;
-} cairo_text_extents_t_FID_CACHE;
-
-cairo_text_extents_t_FID_CACHE cairo_text_extents_tFc;
-
-void cachecairo_text_extents_tFields(JNIEnv *env, jobject lpObject)
-{
- if (cairo_text_extents_tFc.cached) return;
- cairo_text_extents_tFc.clazz = (*env)->GetObjectClass(env, lpObject);
- cairo_text_extents_tFc.x_bearing = (*env)->GetFieldID(env, cairo_text_extents_tFc.clazz, "x_bearing", "D");
- cairo_text_extents_tFc.y_bearing = (*env)->GetFieldID(env, cairo_text_extents_tFc.clazz, "y_bearing", "D");
- cairo_text_extents_tFc.width = (*env)->GetFieldID(env, cairo_text_extents_tFc.clazz, "width", "D");
- cairo_text_extents_tFc.height = (*env)->GetFieldID(env, cairo_text_extents_tFc.clazz, "height", "D");
- cairo_text_extents_tFc.x_advance = (*env)->GetFieldID(env, cairo_text_extents_tFc.clazz, "x_advance", "D");
- cairo_text_extents_tFc.y_advance = (*env)->GetFieldID(env, cairo_text_extents_tFc.clazz, "y_advance", "D");
- cairo_text_extents_tFc.cached = 1;
-}
-
-cairo_text_extents_t *getcairo_text_extents_tFields(JNIEnv *env, jobject lpObject, cairo_text_extents_t *lpStruct)
-{
- if (!cairo_text_extents_tFc.cached) cachecairo_text_extents_tFields(env, lpObject);
- lpStruct->x_bearing = (*env)->GetDoubleField(env, lpObject, cairo_text_extents_tFc.x_bearing);
- lpStruct->y_bearing = (*env)->GetDoubleField(env, lpObject, cairo_text_extents_tFc.y_bearing);
- lpStruct->width = (*env)->GetDoubleField(env, lpObject, cairo_text_extents_tFc.width);
- lpStruct->height = (*env)->GetDoubleField(env, lpObject, cairo_text_extents_tFc.height);
- lpStruct->x_advance = (*env)->GetDoubleField(env, lpObject, cairo_text_extents_tFc.x_advance);
- lpStruct->y_advance = (*env)->GetDoubleField(env, lpObject, cairo_text_extents_tFc.y_advance);
- return lpStruct;
-}
-
-void setcairo_text_extents_tFields(JNIEnv *env, jobject lpObject, cairo_text_extents_t *lpStruct)
-{
- if (!cairo_text_extents_tFc.cached) cachecairo_text_extents_tFields(env, lpObject);
- (*env)->SetDoubleField(env, lpObject, cairo_text_extents_tFc.x_bearing, (jdouble)lpStruct->x_bearing);
- (*env)->SetDoubleField(env, lpObject, cairo_text_extents_tFc.y_bearing, (jdouble)lpStruct->y_bearing);
- (*env)->SetDoubleField(env, lpObject, cairo_text_extents_tFc.width, (jdouble)lpStruct->width);
- (*env)->SetDoubleField(env, lpObject, cairo_text_extents_tFc.height, (jdouble)lpStruct->height);
- (*env)->SetDoubleField(env, lpObject, cairo_text_extents_tFc.x_advance, (jdouble)lpStruct->x_advance);
- (*env)->SetDoubleField(env, lpObject, cairo_text_extents_tFc.y_advance, (jdouble)lpStruct->y_advance);
-}
-#endif
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h
index 4e8a012cde..96740656a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h
@@ -15,24 +15,12 @@
*
* IBM
* - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2012 IBM Corp. All Rights Reserved.
+ * - Copyright (C) 2005, 2013 IBM Corp. All Rights Reserved.
*
* ***** END LICENSE BLOCK ***** */
#include "cairo.h"
-#ifndef NO_cairo_font_extents_t
-void cachecairo_font_extents_tFields(JNIEnv *env, jobject lpObject);
-cairo_font_extents_t *getcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct);
-void setcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct);
-#define cairo_font_extents_t_sizeof() sizeof(cairo_font_extents_t)
-#else
-#define cachecairo_font_extents_tFields(a,b)
-#define getcairo_font_extents_tFields(a,b,c) NULL
-#define setcairo_font_extents_tFields(a,b,c)
-#define cairo_font_extents_t_sizeof() 0
-#endif
-
#ifndef NO_cairo_path_data_t
void cachecairo_path_data_tFields(JNIEnv *env, jobject lpObject);
cairo_path_data_t *getcairo_path_data_tFields(JNIEnv *env, jobject lpObject, cairo_path_data_t *lpStruct);
@@ -57,15 +45,3 @@ void setcairo_path_tFields(JNIEnv *env, jobject lpObject, cairo_path_t *lpStruct
#define cairo_path_t_sizeof() 0
#endif
-#ifndef NO_cairo_text_extents_t
-void cachecairo_text_extents_tFields(JNIEnv *env, jobject lpObject);
-cairo_text_extents_t *getcairo_text_extents_tFields(JNIEnv *env, jobject lpObject, cairo_text_extents_t *lpStruct);
-void setcairo_text_extents_tFields(JNIEnv *env, jobject lpObject, cairo_text_extents_t *lpStruct);
-#define cairo_text_extents_t_sizeof() sizeof(cairo_text_extents_t)
-#else
-#define cachecairo_text_extents_tFields(a,b)
-#define getcairo_text_extents_tFields(a,b,c) NULL
-#define setcairo_text_extents_tFields(a,b,c)
-#define cairo_text_extents_t_sizeof() 0
-#endif
-
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 896e139138..0b50f6fd09 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
@@ -90,10 +90,8 @@ public class Cairo extends Platform {
public static final int CAIRO_PATH_CLOSE_PATH = 3;
/** 64*/
-public static final native int cairo_font_extents_t_sizeof ();
public static final native int cairo_path_data_t_sizeof ();
public static final native int cairo_path_t_sizeof ();
-public static final native int cairo_text_extents_t_sizeof ();
/** Natives */
public static final native int CAIRO_VERSION_ENCODE(int major, int minor, int micro);
@@ -270,16 +268,6 @@ public static final void cairo_fill_preserve(long /*int*/ cr) {
lock.unlock();
}
}
-/** @param cr cast=(cairo_t *) */
-public static final native void _cairo_font_extents(long /*int*/ cr, cairo_font_extents_t extents);
-public static final void cairo_font_extents(long /*int*/ cr, cairo_font_extents_t extents) {
- lock.lock();
- try {
- _cairo_font_extents(cr, extents);
- } finally {
- lock.unlock();
- }
-}
public static final native long /*int*/ _cairo_font_options_create();
public static final long /*int*/ cairo_font_options_create() {
lock.lock();
@@ -382,19 +370,6 @@ public static final void cairo_get_font_matrix(long /*int*/ cr, double[] matrix)
lock.unlock();
}
}
-/**
- * @param cr cast=(cairo_t *)
- * @param options cast=(cairo_font_options_t *)
- */
-public static final native void _cairo_get_font_options(long /*int*/ cr, long /*int*/ options);
-public static final void cairo_get_font_options(long /*int*/ cr, long /*int*/ options) {
- lock.lock();
- try {
- _cairo_get_font_options(cr, options);
- } finally {
- lock.unlock();
- }
-}
/** @param cr cast=(cairo_t *) */
public static final native int _cairo_get_line_cap(long /*int*/ cr);
public static final int cairo_get_line_cap(long /*int*/ cr) {
@@ -1353,19 +1328,6 @@ public static final void cairo_show_page(long /*int*/ cr) {
lock.unlock();
}
}
-/**
- * @param cr cast=(cairo_t *)
- * @param utf8 cast=(const char *)
- */
-public static final native void _cairo_show_text(long /*int*/ cr, byte[] utf8);
-public static final void cairo_show_text(long /*int*/ cr, byte[] utf8) {
- lock.lock();
- try {
- _cairo_show_text(cr, utf8);
- } finally {
- lock.unlock();
- }
-}
/** @param cr cast=(cairo_t *) */
public static final native int _cairo_status(long /*int*/ cr);
public static final int cairo_status(long /*int*/ cr) {
@@ -1551,33 +1513,6 @@ public static final int cairo_surface_set_user_data(long /*int*/ surface, long /
}
/**
* @param cr cast=(cairo_t *)
- * @param utf8 cast=(const char *)
- * @param extents cast=(cairo_text_extents_t *)
- */
-public static final native void _cairo_text_extents(long /*int*/ cr, byte[] utf8, cairo_text_extents_t extents);
-public static final void cairo_text_extents(long /*int*/ cr, byte[] utf8, cairo_text_extents_t extents) {
- lock.lock();
- try {
- _cairo_text_extents(cr, utf8, extents);
- } finally {
- lock.unlock();
- }
-}
-/**
- * @param cr cast=(cairo_t *)
- * @param utf8 cast=(const char *)
- */
-public static final native void _cairo_text_path(long /*int*/ cr, byte[] utf8);
-public static final void cairo_text_path(long /*int*/ cr, byte[] utf8) {
- lock.lock();
- try {
- _cairo_text_path(cr, utf8);
- } finally {
- lock.unlock();
- }
-}
-/**
- * @param cr cast=(cairo_t *)
* @param matrix cast=(cairo_matrix_t *)
*/
public static final native void _cairo_transform(long /*int*/ cr, double[] matrix);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java
deleted file mode 100644
index 72562b8423..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2006 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.cairo;
-
-
-public class cairo_font_extents_t {
- public double ascent;
- public double descent;
- public double height;
- public double max_x_advance;
- public double max_y_advance;
- public static final int sizeof = Cairo.cairo_font_extents_t_sizeof();
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_text_extents_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_text_extents_t.java
deleted file mode 100644
index 7408d29ab4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_text_extents_t.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Cairo and SWT
- * - Copyright (C) 2005, 2006 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.cairo;
-
-
-public class cairo_text_extents_t {
- public double x_bearing;
- public double y_bearing;
- public double width;
- public double height;
- public double x_advance;
- public double y_advance;
- public static final int sizeof = Cairo.cairo_text_extents_t_sizeof();
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index 55b22a1bfb..653072981e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -167,26 +167,17 @@ public GC(Drawable drawable, int style) {
static void addCairoString(long /*int*/ cairo, String string, float x, float y, Font font) {
byte[] buffer = Converter.wcsToMbcs(null, string, true);
- if (OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- long /*int*/ layout = OS.pango_cairo_create_layout(cairo);
- if (layout == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.pango_layout_set_text(layout, buffer, -1);
- OS.pango_layout_set_font_description(layout, font.handle);
- double[] currentX = new double[1], currentY = new double[1];
- Cairo.cairo_get_current_point(cairo, currentX, currentY);
- if (currentX[0] != x || currentY[0] != y) {
- Cairo.cairo_move_to(cairo, x, y);
- }
- OS.pango_cairo_layout_path(cairo, layout);
- OS.g_object_unref(layout);
- } else {
- GC.setCairoFont(cairo, font);
- cairo_font_extents_t extents = new cairo_font_extents_t();
- Cairo.cairo_font_extents(cairo, extents);
- double baseline = y + extents.ascent;
- Cairo.cairo_move_to(cairo, x, baseline);
- Cairo.cairo_text_path(cairo, buffer);
+ long /*int*/ layout = OS.pango_cairo_create_layout(cairo);
+ if (layout == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ OS.pango_layout_set_text(layout, buffer, -1);
+ OS.pango_layout_set_font_description(layout, font.handle);
+ double[] currentX = new double[1], currentY = new double[1];
+ Cairo.cairo_get_current_point(cairo, currentX, currentY);
+ if (currentX[0] != x || currentY[0] != y) {
+ Cairo.cairo_move_to(cairo, x, y);
}
+ OS.pango_cairo_layout_path(cairo, layout);
+ OS.g_object_unref(layout);
}
static int checkStyle (int style) {
@@ -283,9 +274,6 @@ void checkGC (int mask) {
Font font = data.font;
OS.pango_layout_set_font_description(data.layout, font.handle);
}
- if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
- setCairoFont(cairo, data.font);
- }
}
if ((state & LINE_CAP) != 0) {
int cap_style = 0;
@@ -1736,20 +1724,6 @@ public void drawText (String string, int x, int y, int flags) {
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (string.length() == 0) return;
long /*int*/ cairo = data.cairo;
- if (cairo != 0) {
- if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
- //TODO - honor flags
- checkGC(FOREGROUND | FONT);
- cairo_font_extents_t extents = new cairo_font_extents_t();
- Cairo.cairo_font_extents(cairo, extents);
- double baseline = y + extents.ascent;
- Cairo.cairo_move_to(cairo, x, baseline);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- Cairo.cairo_show_text(cairo, buffer);
- Cairo.cairo_new_path(cairo);
- return;
- }
- }
setString(string, flags);
if (cairo != 0) {
checkGC(FONT);
@@ -2831,17 +2805,10 @@ public int getTextAntialias() {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (data.cairo == 0) return SWT.DEFAULT;
int antialias = Cairo.CAIRO_ANTIALIAS_DEFAULT;
- if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
- long /*int*/ options = Cairo.cairo_font_options_create();
- Cairo.cairo_get_font_options(data.cairo, options);
- antialias = Cairo.cairo_font_options_get_antialias(options);
- Cairo.cairo_font_options_destroy(options);
- } else {
- if (data.context != 0) {
- long /*int*/ options = OS.pango_cairo_context_get_font_options(data.context);
- if (options != 0) antialias = Cairo.cairo_font_options_get_antialias(options);
- }
- }
+ if (data.context != 0) {
+ long /*int*/ options = OS.pango_cairo_context_get_font_options(data.context);
+ if (options != 0) antialias = Cairo.cairo_font_options_get_antialias(options);
+ }
switch (antialias) {
case Cairo.CAIRO_ANTIALIAS_DEFAULT: return SWT.DEFAULT;
case Cairo.CAIRO_ANTIALIAS_NONE: return SWT.OFF;
@@ -3292,19 +3259,7 @@ static void setCairoFont(long /*int*/ cairo, long /*int*/ font) {
}
static void setCairoRegion(long /*int*/ cairo, long /*int*/ rgn) {
- if (OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- OS.gdk_cairo_region(cairo, rgn);
- } else {
- int[] nRects = new int[1];
- long /*int*/[] rects = new long /*int*/[1];
- OS.gdk_region_get_rectangles(rgn, rects, nRects);
- GdkRectangle rect = new GdkRectangle();
- for (int i=0; i<nRects[0]; i++) {
- OS.memmove(rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof);
- Cairo.cairo_rectangle(cairo, rect.x, rect.y, rect.width, rect.height);
- }
- if (rects[0] != 0) OS.g_free(rects[0]);
- }
+ OS.gdk_cairo_region(cairo, rgn);
}
static void setCairoPatternColor(long /*int*/ pattern, int offset, Color c, int alpha) {
@@ -4014,12 +3969,8 @@ public void setTextAntialias(int antialias) {
initCairo();
long /*int*/ options = Cairo.cairo_font_options_create();
Cairo.cairo_font_options_set_antialias(options, mode);
- if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
- Cairo.cairo_set_font_options(data.cairo, options);
- } else {
- if (data.context == 0) createLayout();
- OS.pango_cairo_context_set_font_options(data.context, options);
- }
+ if (data.context == 0) createLayout();
+ OS.pango_cairo_context_set_font_options(data.context, options);
Cairo.cairo_font_options_destroy(options);
}
@@ -4178,19 +4129,6 @@ public Point textExtent(String string) {
public Point textExtent(String string, int flags) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- long /*int*/ cairo = data.cairo;
- if (cairo != 0) {
- if (OS.GTK_VERSION < OS.VERSION(2, 8, 0)) {
- //TODO - honor flags
- checkGC(FONT);
- byte[] buffer = Converter.wcsToMbcs(null, string, true);
- cairo_font_extents_t font_extents = new cairo_font_extents_t();
- Cairo.cairo_font_extents(cairo, font_extents);
- cairo_text_extents_t extents = new cairo_text_extents_t();
- Cairo.cairo_text_extents(cairo, buffer, extents);
- return new Point((int)extents.width, (int)font_extents.height);
- }
- }
setString(string, flags);
checkGC(FONT);
if (data.stringWidth == -1) {