Re: drawables and refresh rates
- From: Rob Benton <rob benton conwaycorp net>
- To: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: drawables and refresh rates
- Date: Sat, 04 Dec 2004 00:04:23 -0600
Carl Nygard wrote:
On Fri, 2004-12-03 at 04:43, Andrew E. Makeev wrote:
Rob Benton wrote:
Andrew E. Makeev wrote:
Before to answer you, we need to know how do you "draw" your circles?
The common way is to use expose_event to redraw only those parts of
the drawing area that actually were changed. In this case I never
seen any flickering in my applications even on Celeron 300Mhz.
Right now I'm using 2 methods. Method A handles the expose event of
the Gtk::DrawingArea which then calls method B. Method B is also
connected to the value changed signal of both the Gtk::HScale widgets.
I do something like:
Method A handles expose events, and redraws exposed rectangle from
internal pixmap.
Method B connected to value changed signal, draws to internal pixmap,
calls queue_draw() which eventually triggers Method A.
Carl I did some reading on double buffering. Where I've been stuck is
that in order to start drawing to a Gdk::Drawable, it has to be realized
first. Pixmap looks like what I need but its create methods all take a
Glib::RefPtr<Gdk::Drawable>. And I get a segfault when I try that.
You can add efficiency by keeping track of the bounding box of what you
redraw, and only trigger expose events for those rectangles.
How would I do that? I have 1 drawing area widget which
is 100x100. I draw a complete blue circle and then a red arc on top of
that. Finally, to smooth out the edges I load an svg which is a smooth
black circle outline. The flickering comes even if I don't use
window->clear() just b/c each draw command overlaps the previous one.
Thanks for all the help.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]