Angus Leeming wrote:

> In 1.3 we have a row cache and redraw only those rows that have changed.
> In 1.4 we redraw the entire document on every single key press. If the row
> is 'on screen' then the real painter is called. If not, then the painting
> is performed by the null painter.

I think you are reading the code wrongly. We don't paint the entire
document, just entire paragraphs. (So the difference from 1.3 is the
portion of the first par and last par that are off-screen)

Moreover, the optimisation in 1.3 was not exactly fine-grained to the level
of single arbitrary rows, but just remembered "the last unchanged row" and
painted from there. So when typing at the top of the screen, there was no
improvement at all (and in average, say we got 2x improvement wrt 1.4). 

I don't think that these two amount to the difference between 1.3 and 1.4.
But if they are, I'm sure they can be reintroduced in some encapsulated,
clean way. (and anyway these assertions are free ;-))

Regards, Alfredo
 
> RowPainter.C:
> 
> void paintPar
>         (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int
> y)
> {
> //      lyxerr << "  paintPar: pit: " << pit << " at y: " << y << endl;
>         static NullPainter nop;
>         static PainterInfo nullpi(pi.base.bv, nop);
>         int const ww = pi.base.bv->workHeight();
> 
>         Paragraph & par = text.paragraphs()[pit];
> 
>         RowList::const_iterator const rb = par.rows().begin();
>         RowList::const_iterator const re = par.rows().end();
>         theCoords.parPos()[&text][pit] = Point(x, y);
> 
>         y -= rb->ascent();
>         for (RowList::const_iterator rit = rb; rit != re; ++rit) {
>                 y += rit->ascent();
>                 bool const inside = (y + rit->descent() >= 0
>                                        && y - rit->ascent() < ww);
>                 RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x,
>                 y);
> 
>                 y += rit->descent();
>                 rp.paintAppendix();
>                 rp.paintDepthBar();
>                 rp.paintChangeBar();
>                 if (rit == rb)
>                         rp.paintFirst();
>                 if (rit + 1 == re)
>                         rp.paintLast();
>                 rp.paintText();
>         }
> }
> 
> 


Reply via email to