Drawing area and double buffering.



Hi everyone!

I'm doing a project using a drawingarea, it's a sound editor, and i'm having 
trouble to get it working... I explain:
The drawingarea is the place where I draw the wave. I've tested 2 method to do 
it as quickly as possible.

Fisrt I've used this:
Gdk::Rectangle rect(0, 0, get_width(), get_height());
get_window()->begin_paint_rect(rect);
...
//drawing my stuff
...
get_window()->end_paint();

But it was too slow! More precisely when I do a selection or when the file is 
playing, because the wave is redrawn every time.
So I decided to use another technique. Now I draw the wave only one time on a 
Glib::RefPtr<Gdk::Pixmap>. And when I want to draw it on the window, I just 
copy the drawing with draw_drawable(...). Now it's very fast and less CPU 
time consuming. But I've got another problem. 
When I'm zooming on my wave, the pixmap used for the buffering has to be very 
broad to contain all the drawing, and when it is larger than approximately 
4000 pixels width, a part of the wave is not drawn...
So here is my question:
I've done something wrong? Is it a bug?
Is there another technique for drawing such things?

Thank you and regards,
Raoul




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]