[comp.windows.interviews] Big effiency problem with Composition in 3.0

ckeskin@hal.ulowell.edu (Can Keskin) (06/26/91)

Hello,
I have posted a similar question a while ago about scrolling but got no 
answers. Maybe if I try to explain my problem better ... 
I was trying to scroll some text using InterViews 3.0. I can scroll 
text now but I have an efficiency problem. The text is in the form
of an LRComposition (page) made of Character Glyphs.  I wrap my composition
in a Patch and every time I scroll I have to do a patch->reallocate().

Is this the wrong way to do it?

What should I do?

Why is it so slow?

If it is because the composition is recomputing the breaks, can I stop it
from doing that?

Here are bits and pieces of the code.  If anybody is willing to help me
but cannot understand the problem because of my inadequacy to explain,
I can provide some more information. I'm DESPERATE.

Anyways here it goes:


// Here is what my composition looks like

Composition* page = 
             new LRComposition(new TBBox, new SimpleCompositor(), nil, w);

// I do some clipping.  This also alleviates the efficiency problem

int first_line =0;
int last_line = 56;
page->view(page->beginning_of(first_line), page->end_of(last_line));


// I have my page in a patch 

Patch *patch = new Patch(page);

// Let's assume that I have cached in my canvas and extension
// during method `allocate()' furthermore I have

Allocation allc = patch->allocation();
Allotment ally = allc.allotment(Dimension_Y);

// So now when I call the following method, the scrolling is very slow

inline void TextView::scroll_forward(DimensionName dn){

  if(dn == Dimension_Y){
    first_line+=2;last_line+=2; 
    page->view(page->beginning_of(first_line), page->end_of(last_line)); 
    ally.offset(font_size); 
    allc.allot(dn, _ally);    
    patch->allocate(_canvas ,allc ,_extension);   
    patch->redraw();
  }

}

Thanx.
Can Keskin.