In article <515e8cdf.5010...@lyx.org>, Jean-Marc Lasgouttes <lasgout...@lyx.org> wrote:
> Le 29/03/2013 20:52, pdv a écrit : > > I didn't know about rowBreakPoint(). > > At some point I thought about keeping a list of positions, but discarded > > the idea somehow. Even with this new code the scrolling is still not > > ideal, so anything that could save some more time could be useful. > > I'll take a look at rowBreakPoint(). > > Note that the only parts that need to be fast AFAIU are the row breaking > and the row painting. You may need to define a TextMetrics::textWidth > that caches results (like singleWidth does, but with a std::map). This > has a big cost in terms of memory, but might be a big win in general. > > You might want to investigate QTextBoundaryFinder to so the breaking, > but I doubt it would really help us, since we have insets in our text. > > The important property would be to have the code that detect word > separators and line separators in only one place (rowBreakPoint). > > JMarc I've adapted rowBreakPoint() and also removed the following call to rowWidth(), where the same calculations are done again. The on screen layout is now OK, except for a small remaining issue with RTL-languages. Unfortunately the extra time taken to calculate the correct widths in rowBreakPoint() eats too much of the time gained gained by avoiding single_character_painting and although still somewhat faster than before I find the scrolling speed again no longer acceptable. It looks indeed that this can only be solved by caching the widths. Regards, P. De Visschere