Thank you very much for you answers they are more or less what I feared.

Unfortunately here stops my knowledge of good c++ design.

I'm a hardware ASIC design engineer who wants to write a small and fast viewer 
to display graphically the cell placement of ASIC standard cells.

In simply gluing together already existing widgets I got the program working 
for smaller designs for to 100.000 cells (a surprisingly short time thanks to 
FLTK and the support).

Maybe if Greg has the time (and it's not too difficult) could you send me some 
code snippets of the suggestions by you?

Thanks,
Jens

> Wow, this program is basically creating 1.2 million widgets
> that act like buttons. (I guess they might as well be toggle buttons)
>
> It probably isn't the drawing time of the visible rectangles that's
> at issue here, it's the time spent ignoring the rectangles that are
> NOT visible.
>
> Since you're making so many widgets, fltk is going to consider all
> of them.
>
> You can probably optimize things quite a bit by only considering widgets
> that are in the viewing area at the time. So if you're zoomed way in to
> only view 2000 of the widgets, then only tell FLTK about those.
>
> One approach would be, instead of creating an FLTK widget for each box,
> create a non-fltk class for the boxes, and create a 'desk' widget that
> only draws the boxes that are visible by always knowing where the
> visible start/end columns and rows are.
>
> This way your draw() method for the desk could be optimized to
> only loop through boxes that are visible, and call fl_rectf() to
> draw them, avoiding the FLTK widget overhead. Then when your desk
> receives events, you can use fltk's event tester to see if the
> event occurred within the xywh region of one of the visible boxes.
>
> So whenever you change your zoom or scrollbars, you would update
> variables that keep track of the start/end columns, and a list
> of the start/end row positions for each column. Then loop through
> only those in your draw() loop to fl_rectf() draw the boxes.
>
>
> imm wrote:
> > On 7 Jan 2008, at 17:07, Jens Grunert wrote:
> >
> >> thanks for the tips, I did a quick modification doing the redrawing
> >> of all rectangle within one container in the draw() function but
> >> it's even slower.
> >>
> >> I did also play with the return values from the handler in the
> >> original program but could not notice any differenze.
> >>
> >> Are there any other ways to make it faster (I can't use opengl
> >> since the graphic card does  not support it).
> >
> > A couple of things come to mind:
> >
> > - Any timings you make of code that has print output is quite
> > possibly meaningless, since the i/o stream will mess up your timings.
> > You need to time your code with the cout's removed. File or terminal
> > i/o is generally slow compared to graphics i/o.
> >
> > - Rendering a scene this complex on a graphics card that can't even
> > do OpenGL seems like a difficult place to be. Pretty much all
> > "reasonably powerful" graphics cards have some accelerated OpenGL
> > driver these days I thought?
> >
> > - rendering a scene this complex directly with a widget per item is
> > not the way to do it. When you are zoomed out, each widget could be
> > less than a single pixel, yet you still need the full widget
> > rendering overhead. That simply makes no sense. Similarly, when you
> > are zoomed right in, you have a great many widgets to process that
> > are dimply not visible on the screen, yet you still need to process
> > their positions so you can tell whether they need to be rendered or
> > not. Rather, what you need is an abstract representation of the
> > objects in your scene which you can easily search to determine which
> > are visible or not - then you decide what to draw... If you are very
> > zoomed out, you need some way of determining which pixels to fill,
> > simply rendering all the widgets and hoping that will somehow dither
> > to produce the correct scene is unlikely to work satisfactorily. In
> > effect, when zoomed out, you need a mechanism for determining what a
> > standard eye could discern on a standard monitor, and render only
> > that...
> >
> > - It would probably help if you could tell us what you are actually
> > trying to achieve, rather than what you have done or how you have
> > gone about doing it. Then perhaps someone here could suggest how best
> > to do it. There are folk here from many different backgrounds,
> > there's a good chance someone will have worked on something similar
> > in the past.
> >
> >
> >
> >
> >

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to