summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-20 13:15:22 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-20 13:15:22 -0400
commit4f970cd3d5166804b92bf9472452d81def30b1ea (patch)
tree4881ccc8634e01dd1d5318bcd7d14d2f395f66c1
parentb4cb6fedd5e033c160eed2842a6ba8b09aa3352c (diff)
downloadeclipse.platform.swt-gdk_draw_pixbuff.tar.gz
eclipse.platform.swt-gdk_draw_pixbuff.tar.xz
eclipse.platform.swt-gdk_draw_pixbuff.zip
Use Cairo instead of gdk_draw_pixbuf()gdk_draw_pixbuff
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java11
4 files changed, 22 insertions, 8 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 4e3b0f2d57..9a82bd175d 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
@@ -5133,12 +5133,12 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1draw_1pixbuf)
{
OS_NATIVE_ENTER(env, that, _1gdk_1draw_1pixbuf_FUNC);
/*
- gdk_draw_pixbuf((GdkDrawable *)arg0, (GdkGC *)arg1, (GdkPixbuf *)arg2, (gint)arg3, (gint)arg4, (gint)arg5, (gint)arg6, (gint)arg7, (gint)arg8, (GdkRgbDither)arg9, (gint)arg10, (gint)arg11);
+ gdk_draw_pixbuf(arg0, arg1, arg2, (gint)arg3, (gint)arg4, (gint)arg5, (gint)arg6, (gint)arg7, (gint)arg8, arg9, (gint)arg10, (gint)arg11);
*/
{
OS_LOAD_FUNCTION(fp, gdk_draw_pixbuf)
if (fp) {
- ((void (CALLING_CONVENTION*)(GdkDrawable *, GdkGC *, GdkPixbuf *, gint, gint, gint, gint, gint, gint, GdkRgbDither, gint, gint))fp)((GdkDrawable *)arg0, (GdkGC *)arg1, (GdkPixbuf *)arg2, (gint)arg3, (gint)arg4, (gint)arg5, (gint)arg6, (gint)arg7, (gint)arg8, (GdkRgbDither)arg9, (gint)arg10, (gint)arg11);
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong, jintLong, gint, gint, gint, gint, gint, gint, jint, gint, gint))fp)(arg0, arg1, arg2, (gint)arg3, (gint)arg4, (gint)arg5, (gint)arg6, (gint)arg7, (gint)arg8, arg9, (gint)arg10, (gint)arg11);
}
}
OS_NATIVE_EXIT(env, that, _1gdk_1draw_1pixbuf_FUNC);
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 421703038c..5707f425c2 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
@@ -3841,16 +3841,12 @@ public static final void gdk_draw_lines(int /*long*/ drawable, int /*long*/ gc,
}
/**
* @method flags=dynamic
- * @param drawable cast=(GdkDrawable *)
- * @param gc cast=(GdkGC *)
- * @param pixbuf cast=(GdkPixbuf *)
* @param xsrc cast=(gint)
* @param ysrc cast=(gint)
* @param xdest cast=(gint)
* @param ydest cast=(gint)
* @param width cast=(gint)
* @param height cast=(gint)
- * @param dither cast=(GdkRgbDither)
* @param x_dither cast=(gint)
* @param y_dither cast=(gint)
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
index 9785073ac0..264a712b49 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
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 DrawData {
@@ -97,7 +98,15 @@ void drawImage(Theme theme, Image image, GC gc, Rectangle bounds) {
OS.g_object_unref(pixbuf);
//TODO - stretching
if (rendered != 0) {
- OS.gdk_draw_pixbuf(drawable, gc.handle, rendered, 0, 0, bounds.x, bounds.y, bounds.width, bounds.height, OS.GDK_RGB_DITHER_NORMAL, 0, 0);
+ if (OS.USE_CAIRO) {
+ int /*long*/ cairo = OS.gdk_cairo_create (drawable);
+ OS.gdk_cairo_set_source_pixbuf (cairo, gc.handle, 0, 0);
+ Cairo.cairo_rectangle (cairo,bounds.x,bounds.y,bounds.width,bounds.height);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_destroy(cairo);
+ } else {
+ OS.gdk_draw_pixbuf(drawable, gc.handle, rendered, 0, 0, bounds.x, bounds.y, bounds.width, bounds.height, OS.GDK_RGB_DITHER_NORMAL, 0, 0);
+ }
OS.g_object_unref(rendered);
}
OS.gtk_icon_source_free(source);
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 61021eb94a..39aefbeb75 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
@@ -1017,7 +1017,16 @@ void drawImageAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHei
if (scaledPixbuf == 0) return;
pixbuf = scaledPixbuf;
}
- OS.gdk_draw_pixbuf(data.drawable, handle, pixbuf, 0, 0, destX, destY, destWidth, destHeight, OS.GDK_RGB_DITHER_NORMAL, 0, 0);
+ if (OS.USE_CAIRO) {
+ int /*long*/ cairo = OS.gdk_cairo_create (data.drawable);
+ OS.gdk_cairo_set_source_pixbuf (cairo, pixbuf, 0, 0);
+ Cairo.cairo_rectangle(cairo, destX, destY, imgWidth, destHeight);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_destroy(cairo);
+ } else {
+ OS.gdk_draw_pixbuf(data.drawable, handle, pixbuf, 0, 0, destX, destY, destWidth, destHeight, OS.GDK_RGB_DITHER_NORMAL, 0, 0);
+ }
+
OS.g_object_unref(pixbuf);
}
void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight) {