diff options
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java | 5 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | 13 |
2 files changed, 9 insertions, 9 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 6c480d3ff6..405a09a611 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 @@ -96,10 +96,7 @@ public Canvas (Composite parent, int style) { * @since 3.2 */ public void drawBackground (GC gc, int x, int y, int width, int height) { - checkWidget (); - if (gc == null) error (SWT.ERROR_NULL_ARGUMENT); - if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); - super.drawBackground (gc, x, y, width, height); + drawBackground (gc, x, y, width, height, 0, 0); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index 55354e2285..b286425f68 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -330,7 +330,10 @@ void deregister () { if (socketHandle != 0) display.removeWidget (socketHandle); } -void drawBackground (GC gc, int x, int y, int width, int height) { +public void drawBackground (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { + checkWidget (); + if (gc == null) error (SWT.ERROR_NULL_ARGUMENT); + if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); Control control = findBackgroundControl (); if (control != null) { GCData data = gc.getGCData (); @@ -339,9 +342,9 @@ void drawBackground (GC gc, int x, int y, int width, int height) { Cairo.cairo_save (cairo); if (control.backgroundImage != null) { Point pt = display.map (this, control, 0, 0); - Cairo.cairo_translate (cairo, -pt.x, -pt.y); - x += pt.x; - y += pt.y; + Cairo.cairo_translate (cairo, -pt.x - offsetX, -pt.y - offsetY); + x += pt.x + offsetX; + y += pt.y + offsetY; int /*long*/ xDisplay = OS.GDK_DISPLAY (); int /*long*/ xVisual = OS.gdk_x11_visual_get_xvisual (OS.gdk_visual_get_system()); int /*long*/ drawable = control.backgroundImage.pixmap; @@ -374,7 +377,7 @@ void drawBackground (GC gc, int x, int y, int width, int height) { if (control.backgroundImage != null) { Point pt = display.map (this, control, 0, 0); OS.gdk_gc_set_fill (gdkGC, OS.GDK_TILED); - OS.gdk_gc_set_ts_origin (gdkGC, -pt.x, -pt.y); + OS.gdk_gc_set_ts_origin (gdkGC, -pt.x - offsetX, -pt.y - offsetY); OS.gdk_gc_set_tile (gdkGC, control.backgroundImage.pixmap); OS.gdk_draw_rectangle (data.drawable, gdkGC, 1, x, y, width, height); OS.gdk_gc_set_fill (gdkGC, values.fill); |