Re: efficient use of canvas lines



Following up on the discussion of a week ago:

>Repeat after me:
>  "The customer always has more data than memory..."  (or common sense(?))
>:-)

 [ ... ]

>We're not using GNOME - Just GTK.
>Partially to minimize the number of dependencies, and partially because
>we're using GTK on Windows  (Getting GTK on windows working is bad enough-
>I wouldn't want to even think about GNOME (if it's even possible)...)

Well, I managed to do precisely what I wanted to by using the
GtkCanvas "backport" and writing a new CanvasItem. Its hyper-efficient
in the sense that the item makes no calls to any GDK/X calls to render
the data onto the screen - everything is done with direct RGB-drawing
methods that write into an RGB buffer which is later passed to the X
server in one shot (well, sort of; those familiar with the internals
of the canvas will know that this is not quite true).

It wasn't trivial to figure out how to do this, but as usual, my
source in GPL'ed and the code will emerge as part of ardour/quasimodo
CVS soon. the item is called a CanvasWaveView and it uses an
abstracted GObject (actually, a GtkObject for now) to supply it with
data on an as-needed basis.

I can now drag an 800-line waveform around the screen with full alpha
transparency. The CPU(s) are pretty busy, but its way faster than with
gdk_draw_line()/gdk_draw_point{,s}().

--p




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