From 4cd26b3a6f3cad2a92cb1ef8d14b7253a740c740 Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Tue, 9 Oct 2012 17:01:47 -0400 Subject: Use Cairo instead of gdk_draw_drawable and gdk_gc_set_exposures --- .../gtk/org/eclipse/swt/widgets/Canvas.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 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 f45d8438fd..f3392944bf 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,19 @@ 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 - long /*int*/ 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); + if (OS.USE_CAIRO) { + OS.gdk_window_invalidate_rect (window, copyRect, true); + long /*int*/ cairo = OS.gdk_cairo_create (window); + OS.gdk_cairo_set_source_window (cairo, window, 0, 0); + Cairo.cairo_rectangle (cairo, copyRect.x + deltaX, copyRect.y + deltaY, copyRect.width, copyRect.height); + Cairo.cairo_fill (cairo); + Cairo.cairo_destroy (cairo); + } else { + long /*int*/ 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 (); -- cgit