On Wed, Jan 15, 2003 at 11:12:26AM +0100, Alfredo Braunstein wrote:
> Sorry for bringing up again this old thread (I wasn't paying attention 
> :). 

I am reading the codes and plan to implement something like 
'progressive-loading'. I am glad this thread is still of interest to 
you.

> 1) Right now all previews are converted to ppm on a first shot at 
> startup ...this time in blocking mode. 

So this part has nothing to be improved.

> 2) Maybe an easy way to improve things would be to load more than one 
> screenful at a time (say two or more). I suppose that this can be 
> achieved by adding a look-ahead factor F, somethig like

>         for (int height = 0; row && height < F*bv_height; row = row->next()) 

> Does this makes sense? 

This is exactly where I am. If I understand correctly, when a 
formula is being drawn for the first time (mathed/formula.C, line 210) , 
it calls imageReady() (graphics/PreviewedInset.C 136). If all bitmaps 
have been generated, pimage_->image() will try to load the image from 
disk.

However, the loading won't get started until checkedLoading 
(graphics/GraphicsLoader.C) finds out that the formula is visible. (I 
have not tried to remove the 'startLoading' line and see if this is the 
only place to start laoding.)

My first idea is to return more visible paragraphs from 
'getVisibleParagraph' by retrieving some next and previous paragraphs
( e.g. Paragraph::next() ). I guess that we can also use your 
'look-forward' idea in this function.

This should not be hard to implement and it works best when user scroll 
down slowly: The next page would be already loaded and lyx will be 
loading the next invisible screen.

> 3) I don't know if a smarter way of loading bitmaps (like the one suggested 
> by Andrè) would improve things that much: bitmap loading is still 
> "blocking"...  I think that the ultimate solution is still to make it 
> non-blocking, i.e. to load on idle time, like Bo Peng suggested.

You are right. Since the loading is blocking, this method means double 
loading work when we go to a new unloaded page. So I am thinking of a 
side loader:  (just idea, details might be totally wrong.)
   1. count the instances of GraphicsLoader (using a static counter)
   2. if there is no instance (all visible insets have been loaded), 
      try to locate a unloaded formula and load it. So this loader will 
      eventually load all bitmaps, not just next screen.
   3. do this every second by a timer or trigger it by some event. 
      Hopefully, loading one bitmap a time will not disturb user 
      interaction very much.

> Sorry if I've misunderstood everything...

me too. I am also in the process of reading codes. :-) Any other idea is 
welcome.

-- 
Bo Peng

Reply via email to