diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-24 12:34:34 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-24 12:34:34 -0400 |
commit | 8476734fd111573cf0ddf1d7d4a1b344a98eddb7 (patch) | |
tree | 61e414d98c856a9d34e0dab76d332404d0b056fe | |
parent | d0985fba0cef991baab13fb0af6025f5280dd3dc (diff) | |
download | eclipse.platform.swt-gtk_gc_clip_region.tar.gz eclipse.platform.swt-gtk_gc_clip_region.tar.xz eclipse.platform.swt-gtk_gc_clip_region.zip |
Use Cairo instead of gtk_gc_set_clip_region() in Themegtk_gc_clip_region
4 files changed, 31 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 12cff6d853..e11d5d7148 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -5479,7 +5479,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1gc_1set_1clip_1region) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) { OS_NATIVE_ENTER(env, that, _1gdk_1gc_1set_1clip_1region_FUNC); - gdk_gc_set_clip_region((GdkGC *)arg0, (GdkRegion *)arg1); +/* + gdk_gc_set_clip_region(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_gc_set_clip_region) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1gc_1set_1clip_1region_FUNC); } #endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 69b44542ef..7599566606 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -168,6 +168,7 @@ #define gdk_draw_image_LIB LIB_GDK #define gdk_drawable_get_size_LIB LIB_GDK #define gdk_gc_set_background_LIB LIB_GDK +#define gdk_gc_set_clip_region_LIB LIB_GDK #define gdk_gc_set_clip_mask_LIB LIB_GDK #define gdk_gc_set_clip_origin_LIB LIB_GDK #define gdk_gc_set_dashes_LIB LIB_GDK diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 312603a2b1..996edf9102 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -4122,8 +4122,7 @@ public static final void gdk_gc_set_clip_origin(int /*long*/ gc, int x, int y) { } } /** - * @param gc cast=(GdkGC *) - * @param region cast=(GdkRegion *) + * @method flags=dynamic */ public static final native void _gdk_gc_set_clip_region(int /*long*/ gc, int /*long*/ region); public static final void gdk_gc_set_clip_region(int /*long*/ gc, int /*long*/ region) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java index 1357fb9c9e..c4e617c476 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java @@ -13,6 +13,7 @@ package org.eclipse.swt.internal.theme; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; public class Theme { @@ -193,26 +194,36 @@ void transferClipping(GC gc, int /*long*/ style) { int /*long*/ [] curGC = new int /*long*/ [1]; for (int i = 0; i < 5; i++) { OS.gtk_style_get_fg_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_bg_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_light_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_dark_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_mid_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_text_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_text_aa_gc (style, i, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); } OS.gtk_style_get_black_gc (style, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); OS.gtk_style_get_white_gc (style, curGC); - if (curGC[0] != 0) OS.gdk_gc_set_clip_region (curGC[0], clipping); + if (curGC[0] != 0) gdk_cairo_set_clip_region (data, curGC[0], clipping); if (clipping != clipRgn && clipping != damageRgn) { OS.gdk_region_destroy(clipping); } } +void gdk_cairo_set_clip_region (GCData data, int /*long*/ curGC, int /*long*/ region){ + if (OS.USE_CAIRO) { + int /*long*/ cairo = data.cairo; + OS.gdk_cairo_region(cairo, region); + Cairo.cairo_clip(cairo); + Cairo.cairo_destroy(cairo); + } else { + OS.gdk_gc_set_clip_region (curGC, region); + } +} } |