using cairo surfaces



Hello. I'm trying to create a custom container widget that holds the child widgets in a hbox (or scrollarea, after I learn how to use it). The child widgets are using cairo for the drawing, and so is the container widget.

I want to optimize the container drawing since the child widgets don't always need complete redrawing.

The child drawing is currently done to the container's cairo surface, which is passed to each child widget, and childs draw to this surface. Reference to this surface is stored and I'm using a private variable in the container widget that keeps track of whether the childs need full redraw or can I use the stored surface to do quick redraw without the need to call the childs' drawing functions.

Now, I want the child widgets to have their own surfaces and each child should handle the "smart drawing". So the child widget decides whether it uses the previously rendered surface or redraws some parts. The container then just uses set_source_surface to draw the child at desired position.

What kind of surface I should create in the child widgets and how do I copy it to the container surface?

I've tried creating image surface, but I guess I was doing something wrong, because nothing was drawn, or I got segfault. So I still have not found the right way of doing it. The documentation is lacking examples, so I have proceeded in "trial and error"-basis, and now I'm kind of stuck.


Tommi



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