[Gd-chatter] r11517 - branches/opendylan-melange/gtk-duim
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Wed Dec 5 00:32:47 CET 2007
Author: hannes
Date: Wed Dec 5 00:32:46 2007
New Revision: 11517
Modified:
branches/opendylan-melange/gtk-duim/gtk-draw.dylan
branches/opendylan-melange/gtk-duim/gtk-medium.dylan
Log:
Job: fd
cache gcontext in gtk-medium object
clear box by drawing a white rectangle
Modified: branches/opendylan-melange/gtk-duim/gtk-draw.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-draw.dylan (original)
+++ branches/opendylan-melange/gtk-duim/gtk-draw.dylan Wed Dec 5 00:32:46 2007
@@ -426,11 +426,21 @@
(medium :: <gtk-medium>, left, top, right, bottom) => ()
let (drawable :: <GdkDrawable>, gcontext :: <GdkGC>)
= get-gcontext(medium);
+ let colormap = gdk-gc-get-colormap(gcontext);
+ with-stack-structure (color :: <GdkColor>)
+ gdk-color-white(colormap, color);
+ gdk-gc-set-foreground(gcontext, color);
+ end;
let sheet = medium-sheet(medium);
let transform = sheet-device-transform(sheet);
with-device-coordinates (transform, left, top, right, bottom)
- gdk-window-clear-area(drawable, left, top, right - left, bottom - top)
- end
+ //gdk-window-clear-area(drawable, left, top, right - left, bottom - top)
+ gdk-draw-rectangle(drawable, gcontext, $true, left, top, right - left, bottom - top);
+ end;
+ with-stack-structure (color :: <GdkColor>)
+ gdk-color-black(colormap, color);
+ gdk-gc-set-foreground(gcontext, color);
+ end;
end method clear-box;
Modified: branches/opendylan-melange/gtk-duim/gtk-medium.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-medium.dylan (original)
+++ branches/opendylan-melange/gtk-duim/gtk-medium.dylan Wed Dec 5 00:32:46 2007
@@ -19,6 +19,7 @@
sealed slot %background-color :: false-or(<GdkColor>) = #f;
// Cached clipping region
sealed slot %clip-mask = #f; // #f, #"none", or an X region
+ sealed slot %gcontext = #f;
end class <gtk-medium>;
define sealed domain make (singleton(<gtk-medium>));
@@ -171,18 +172,14 @@
define inline method get-gcontext
(medium :: <gtk-medium>)
=> (drawable :: <GdkDrawable>, gcontext :: <GdkGC>)
- let sheet = medium.medium-sheet;
- let mirror = sheet.sheet-mirror;
- let widget = mirror.mirror-widget;
let drawable = medium-drawable(medium);
- // let gcontext = widget.gtk-widget-get-style.GtkStyle-black-gc;
- // let gcontext = widget.gtk-widget-get-style.GtkStyle-fg-gc[widget.gtk-widget-get-state];
unless (drawable)
+ let widget = medium.medium-sheet.sheet-mirror.mirror-widget;
drawable := widget.gtk-widget-get-window;
medium-drawable(medium) := drawable;
+ %gcontext(medium) := gdk-gc-new(drawable);
end;
- let gcontext = gdk-gc-new(drawable);
- values(drawable, gcontext)
+ values(drawable, %gcontext(medium))
end method get-gcontext;
// Note that the brush defaults to 'medium-brush(medium)',
More information about the chatter
mailing list