diff options
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java index 1799563854..c2adcf0917 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java @@ -12,6 +12,7 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.*; @@ -275,11 +276,28 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b // GC gc = new GC (this); // gc.copyArea (x, y, width, height, destX, destY); // gc.dispose (); - //TODO: Use Cairo + if (OS.USE_CAIRO) { + int /*long */ cairo = OS.gdk_cairo_create (window); + Cairo.cairo_save(cairo); + Cairo.cairo_rectangle(cairo, destX, destY, width, height); + Cairo.cairo_clip(cairo); + Cairo.cairo_translate(cairo, deltaX, deltaY); + Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_SOURCE); + Cairo.cairo_push_group(cairo); + OS.gdk_cairo_set_source_window(cairo, window, 0, 0); + Cairo.cairo_paint(cairo); + Cairo.cairo_pop_group_to_source(cairo); + Cairo.cairo_rectangle(cairo, destX - deltaX, destY - deltaY, width, height); + Cairo.cairo_clip(cairo); + Cairo.cairo_paint(cairo); + Cairo.cairo_restore(cairo); + Cairo.cairo_destroy(cairo); + }else{ int /*long*/ gdkGC = OS.gdk_gc_new (window); OS.gdk_gc_set_exposures (gdkGC, true); OS.gdk_draw_drawable (window, gdkGC, window, copyRect.x, copyRect.y, copyRect.x + deltaX, copyRect.y + deltaY, copyRect.width, copyRect.height); OS.g_object_unref (gdkGC); + } boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY); if (disjoint) { GdkRectangle rect = new GdkRectangle (); |