summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe@ca.ibm.com>2012-01-16 16:08:23 -0500
committerBogdan Gheorghe <gheorghe@ca.ibm.com>2012-01-16 16:08:23 -0500
commitee35d27d8f4e73e2435cc1829ff0629ac5f7f27d (patch)
tree5aeb1fe916fac3ed4f4a466854e0d7ec03261f28 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
parentcbbd1213ec1a9edc402d708865524e69d4ab9400 (diff)
downloadeclipse.platform.swt-ee35d27d8f4e73e2435cc1829ff0629ac5f7f27d.tar.gz
eclipse.platform.swt-ee35d27d8f4e73e2435cc1829ff0629ac5f7f27d.tar.xz
eclipse.platform.swt-ee35d27d8f4e73e2435cc1829ff0629ac5f7f27d.zip
Fixed for copying wrong portion of source window
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java27
1 files changed, 16 insertions, 11 deletions
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 903447746d..951d07f9f7 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
@@ -450,19 +450,24 @@ public void copyArea(Image image, int x, int y) {
if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
if (OS.USE_CAIRO) {
int /*long*/ cairo = Cairo.cairo_create(image.surface);
+ Cairo.cairo_translate(cairo, -x, -y);
if (data.image != null) {
- Cairo.cairo_set_source_surface(cairo, data.image.surface, x, y);
- } else if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
- OS.gdk_cairo_set_source_window(cairo, data.drawable, x, y);
+ Cairo.cairo_set_source_surface(cairo, data.image.surface, 0, 0);
+ } else if (data.drawable != 0) {
+ if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) {
+ OS.gdk_cairo_set_source_window(cairo, data.drawable, 0, 0);
+ } else {
+ int[] w = new int[1], h = new int[1];
+ OS.gdk_drawable_get_size(data.drawable, w, h);
+ int width = w[0], height = h[0];
+ int /*long*/ xDisplay = OS.GDK_DISPLAY();
+ int /*long*/ xDrawable = OS.gdk_x11_drawable_get_xid(data.drawable);
+ int /*long*/ xVisual = OS.gdk_x11_visual_get_xvisual(OS.gdk_visual_get_system());
+ int /*long*/ srcSurface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, width, height);
+ Cairo.cairo_set_source_surface(cairo, srcSurface, 0, 0);
+ }
} else {
- int[] w = new int[1], h = new int[1];
- OS.gdk_drawable_get_size(data.drawable, w, h);
- int width = w[0], height = h[0];
- int /*long*/ xDisplay = OS.GDK_DISPLAY();
- int /*long*/ xDrawable = OS.gdk_x11_drawable_get_xid(data.drawable);
- int /*long*/ xVisual = OS.gdk_x11_visual_get_xvisual(OS.gdk_visual_get_system());
- int /*long*/ srcSurface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, width, height);
- Cairo.cairo_set_source_surface(cairo, srcSurface, x, y);
+ return;
}
Cairo.cairo_paint(cairo);
Cairo.cairo_destroy(cairo);