On Wed, Mar 19, 2003 at 05:12:56PM +0000, John Levon wrote:
> > Give the insets a small cache of width/ascent/descent (you could steal from
> > math_diminset I suppose), fill the cache of an inset in the first stage
> > according to the size of the contents of the inset, and do all the drawing
> > in the second stage...
> 
> I'm not sure the actual drawing is slowest, it's not showing up big time
> in the profiles. Things like singleWidth() are.

I am not suggesting otherwise. But by clearly separating metrics computation
and actual drawing we make sure that "things like singleWitdh()" are called
only once per redraw.

> I'm not really sure how I'd implement what you're suggesting anyway. We
> already have inset->width() ...

Look at what mathed does: At a very high level (i.e InsetFormula::draw) the
work is split. The first call to width() calls metrics()  [ok, this is
messy, but currently the easiest way to make sure that metrics() is called
after loading of a buffer, too]. Afterwards, the real draw part is done, by
calling the nested inset's draw() [which do not contain metrics
computations anymore]

We should move this separation to a higher level. I.e. whatever calls
InsetFormula::draw() should first call InsetFormula::metrics() and the only
the drawing part. At this point probably all insets need the separation of
their individual draw() functions into metrics() and [real] draw(). 

> And I seriously doubt I have enough understanding to do it. I have never
> worked out what the hell Inset::scroll() does, for example.
> Or the exact semantics of InsetCollapsable::need_update.

Neither have I...

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to