Re: Drawing with cairo
- Date: Sun, 18 May 2008 10:37:12 +0300
- From: "Dov Grobgeld" <dov.grobgeld@xxxxxxxxx>
- Subject: Re: Drawing with cairo
Saving the cairo context won't help you for performance of a plot with lots of point. What you may want to do if memory is more available than CPU is to cache the image that you draw on, and then just show the image next time you have an expose event. There might actually be some functionality in gtk to do this automatically...
Regards,
Dov
2008/5/15 Diego A. Fons <diegofons@xxxxxxxxxx>:
Paul Davis wrote:So you are saying I create the Cairo context in the expose event and
> On Thu, 2008-05-15 at 12:05 -0300, Diego A. Fons wrote:
>
>
>> Like Theodore I'm using gtkmm. This is an extrac of the code which
>> doesn't work:
>> void Plotter::on_realize( void )
>> {
>> // Create the GDK window
>> refGdkWindow = Gdk::Window::create(get_window(), &attributes,
>> GDK_WA_X | GDK_WA_Y);
>>
>> // Create Cairo context
>> Cairo::RefPtr<Cairo::Context> cr = refGdkWindow->create_cairo_context();
>> }
>>
>
> you're all thinking too hard. Cairo drawing contexts are supposed to be
> created as necessary. They are cheap. Don't try to cache them. Create
> them in an expose handler and get rid of them.
>
> my attitude towards Cairo is to assume that its been handcoded in SSE9
> assembler unless i come across particular hotspots.
>
>
>
don't care about performance of redrawing the whole plot? OK, I'm trying
that. I'm also going to try the image buffer approach, it is, drawing in
a buffer as a member variable and write the buffer's content to the
Cairo context in the expose event.
Still I don't understand why can't get a context and store it in a
member variable.
Regards,
Diego A. Fons.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list
- References:
- Drawing with cairo
- From: Diego A. Fons
- Re: Drawing with cairo
- From: Igor Gorbounov
- Re: Drawing with cairo
- From: Theodore Papadopoulo
- Re: Drawing with cairo
- From: Diego A. Fons
- Re: Drawing with cairo
- From: Paul Davis
- Re: Drawing with cairo
- From: Diego A. Fons
- Drawing with cairo
- Prev by Date: Re: Setting up GTK+ on Windows using Mingw
- Next by Date: Re: Setting up GTK+ on Windows using Mingw
- Previous by thread: Re: Drawing with cairo
- Next by thread: Re: Drawing with cairo
- Index(es):