traverso-devel
[Top][All Lists]
Advanced

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

Re: [Traverso-devel] playhead cpu usage, crosshair like implementation n


From: Jonatan Liljedahl
Subject: Re: [Traverso-devel] playhead cpu usage, crosshair like implementation needed ?
Date: Wed, 07 Feb 2007 20:10:18 +0100
User-agent: Thunderbird 1.5 (X11/20051025)

Remon wrote:
>> I don't know if this could help, but in my app KyCE I use cairo to
>> render my graphics (curves and all that, and playhead) to a GdkDrawable.
>>  I do the actual drawing of all items to offscreen cairo surfaces, and
>> then I just paint these surfaces onto the GdkDrawable (the actual X11
>> window) in the expose callback, and draw the simple playcursor on top of
>> that. So, I only need to do actual redraw when any item (curves,
>> timegrid, etc..) changes. The expose routine is fast, since it only
>> paints the already-drawn surfaces onto the screen.
> 
> 
> So, what you do is painting on something like an offscreen 'pixmap', and 
> paint 
> the parts that are exposed from these pixmaps to the screen ?

Yes, but it's not real pixmaps but cairo surfaces. One can do lots with
cairo surfaces, combining them in different ways, using them as source
patterns to fill other shapes with, transparency, etc...

> That of course works, but e.g. when audioclips are very large, how do you 
> gonna know which part to paint on the pixmap?

I draw only the part of the curves which I know is visible: starting at
current horizontal scroll position and ending at that plus the window
width. So when the visible part of the curve changes (the user edits the
curve, or zooms or scrolls) then it's redrawn to the offscreen surface.

> What bothers me a little with this approach, all these offscreen pixmaps 
> gonna 
> consume tons of memory.. ?

Not really. Each curve has a surface that is only as large as that
curves visible part on screen.

> If I understand you correctly, this indeed works, but means a true triple 
> buffering approach ?
> 
> My proposed solution would only triple buffer the playhead canvas item....

It sounds really overkill to triplebuffer a simple vertical straight
line! =)
The thing is, if you have all other things ready-drawn in buffers, you
don't need to redraw them, only repaint them. (where the difference is
that redrawing is going through the process of how to render something
to graphics, and painting is putting this graphics on the screen)

> Oh well, after some cleanups the canvas painting has halved in cpu usage, and 
> Nicola's ppc can keep up with it nicely now, so I would say, let's not spend 
> to much time into this :-)
> (CPU usage during playback on my pc == 0.5 % cpu usage, no big deal lol, 
> animated flip page ~ 10- 15 %)

Sure, 0.5% is not even a small deal! =)

-- 
/Jonatan    -=( http://kymatica.com )=-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]