[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk
Subject:    [gtk-list] Re: Using GtkPreview/gtk_preview_draw_row
From:       Havoc Pennington <rhp () zirx ! pair ! com>
Date:       1999-07-06 1:14:55
[Download RAW message or body]


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


-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic