Re: [gtk-list] Re: Using GtkPreview/gtk_preview_draw_row
- From: Havoc Pennington <rhp zirx pair com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Using GtkPreview/gtk_preview_draw_row
- Date: Mon, 5 Jul 1999 21:14:55 -0400 (EDT)
I'll just make some comments and hopefully one or more will help. :-)
On Mon, 5 Jul 1999, Eden Li wrote:
>
> gc = gdk_gc_new (swatch->window);
You probably want to do this just once then keep it around, just for
efficiency.
> gdk_gc_set_foreground (gc, col);
> gdk_gc_set_background (gc, col);
> gdk_gc_set_fill (gc, GDK_SOLID);
> gdk_draw_rectangle (swatch->window, gc, TRUE, 0, 0, SWATCH_WIDTH,
> SWATCH_HEIGHT);
I would use event->area.x, event->area.y, event->area.width,
event->area.height as your redraw region instead; you're doing extra
work by redrawing the whole thing.
> gdk_gc_destroy (gc);
> gtk_widget_queue_draw (swatch);
The queue_draw isn't needed; you've already drawn, no reason to do it
again.
Two helpful places to read: the "scribble" example in the Gtk tutorial on
www.gtk.org, and Chapter 10 on Gdk from my book, at
http://pobox.com/~hp/gnome-app-devel.html (it's the second sample
chapter).
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]