[cairo] I don't see the pattern
Gerdus van Zyl
gerdusvanzyl at gmail.com
Sun Dec 9 12:46:27 PST 2007
> Is there any reason to do that in a clip? So, I guess I'm asking, in what way
> do you "cull"? What's the overall idea?
By that I mean outside of cairo. I have a "reflow" function that is
called every time the layout changes that runs throught all widgets
that changed position and computes if the object is visible and the
hit rectangle. Then every time I render using cairo or test for
collision with a mouseclick I can lookup all visible object in the
redraw region/ mouse click coordinates relatively fast. Please note I
am using cairo directly and not throught GTK.
> I'd like to hear more about your event handling. I am finding simple
> mouseover/out click/release to be really problematic.
I just totally ignore cairo for that. I do collision detection on my
objects using a simple rectangle approach. Although I have had a
prototype that made a hitmask using cairo for a circular shape for
finer grained testing on objects that matched using rectangles.
You should really try the python profiling libraries, it helped a lot
in seeing where problems where. For instance I had a shape that if you
moved it fast would render very slow. After profiling I found out I
was doing some very expensive calculations every time it moved that
was filling up my event queue and delaying rendering. Solution was to
only calc when the object stopped which was what I wanted anyway :-)
> (Also in South Africa
Wonderful to have a fellow S-African here!
>BTW congrats on your uxPython toolkit -- that's
> some amazing work you got there.
Thanks!
~Gerdus
------------------------------------------------------------------------------------------------------------------------------
On Dec 9, 2007 6:19 PM, Donn <donn.ingle at gmail.com> wrote:
> Gerdus,
> > From my own experience caching has not been much help. Visibility
> > culling of objects however has been a big win.
> I am new to a lot of the ideas here. When you say culling, I take it you mean
> ctx.clip()?
> If I have an area 400 by 400 and I draw a rectangle like so:
> ctx.rectangle(0,0,10,10)
> ctx.fill()
> Is there any reason to do that in a clip? So, I guess I'm asking, in what way
> do you "cull"? What's the overall idea?
>
> > (both for rendering and event handling)
> I'd like to hear more about your event handling. I am finding simple
> mouseover/out click/release to be really problematic.
> The main issue is that events fire so quickly that they can change *during* a
> vital test to measure their states. I have started "locking" a single event
> while the code that figures out what's going on is running. This has made
> things better, but it makes the user's experience of quick clicking really
> slow.
>
> > boost than caching did. In fact currently caching is turned off in my
> > app. Cairo is plenty fast :-)
> I'll have to try my hand at this caching lark, but I'll keep your words in
> mind.
>
> Thanks,
> \d
> (Also in South Africa -- and BTW congrats on your uxPython toolkit -- that's
> some amazing work you got there. I have not had the time to download and play
> with it, but it's on my list!)
>
More information about the cairo
mailing list