On Tue, Dec 06, 2005 at 02:30:11PM -0500, Bennett Helm wrote: > I'm happy to do whatever I can to help figure out where the > bottleneck is on the Mac, but I'll need to be pointed in the right > direction: what information would be useful? How can I get it? ...
Bennett, could you try the attached patch? It implements "single-row rendering" as discussed earlier on the list. It's still buggy, but I just want to know if this produces the speed-up we are seeking. - Martin
Index: paragraph.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v retrieving revision 1.417 diff -u -p -r1.417 paragraph.C --- paragraph.C 25 Nov 2005 14:40:34 -0000 1.417 +++ paragraph.C 7 Dec 2005 20:54:54 -0000 @@ -71,7 +71,7 @@ ParagraphList::ParagraphList() Paragraph::Paragraph() - : begin_of_body_(0), pimpl_(new Paragraph::Pimpl(this)) + : row_sig_(0), begin_of_body_(0), pimpl_(new Paragraph::Pimpl(this)) { itemdepth = 0; params().clear(); @@ -80,8 +80,8 @@ Paragraph::Paragraph() Paragraph::Paragraph(Paragraph const & par) : itemdepth(par.itemdepth), insetlist(par.insetlist), - dim_(par.dim_), - rows_(par.rows_), layout_(par.layout_), + dim_(par.dim_), rows_(par.rows_), + row_sig_(par.row_sig_), layout_(par.layout_), text_(par.text_), begin_of_body_(par.begin_of_body_), pimpl_(new Paragraph::Pimpl(*par.pimpl_, this)) { @@ -110,7 +110,8 @@ Paragraph & Paragraph::operator=(Paragra layout_ = par.layout(); text_ = par.text_; begin_of_body_ = par.begin_of_body_; - + row_sig_ = par.row_sig_; + delete pimpl_; pimpl_ = new Pimpl(*par.pimpl_, this); } Index: paragraph.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v retrieving revision 1.157 diff -u -p -r1.157 paragraph.h --- paragraph.h 7 Sep 2005 10:36:59 -0000 1.157 +++ paragraph.h 7 Dec 2005 20:54:54 -0000 @@ -391,7 +391,9 @@ public: RowList & rows() { return rows_; } /// The painter and others use this RowList const & rows() const { return rows_; } - + /// + std::vector<lyx::pos_type> & row_sig() const { return row_sig_; } + /// LyXText::redoParagraph updates this Dimension & dim() { return dim_; } @@ -408,6 +410,9 @@ private: /// mutable RowList rows_; + /// + mutable std::vector<lyx::pos_type> row_sig_; + /// LyXLayout_ptr layout_; /** Index: rowpainter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.159 diff -u -p -r1.159 rowpainter.C --- rowpainter.C 2 Dec 2005 13:20:26 -0000 1.159 +++ rowpainter.C 7 Dec 2005 20:54:54 -0000 @@ -727,6 +727,7 @@ void paintPar theCoords.parPos()[&text][pit] = Point(x, y); y -= rb->ascent(); + unsigned rowno = 0; for (RowList::const_iterator rit = rb; rit != re; ++rit) { y += rit->ascent(); bool const inside = (y + rit->descent() >= 0 @@ -734,14 +735,30 @@ void paintPar 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(); + // Row has not changed since last paint + unsigned row_sig = rit->endpos() - rit->pos() + y; + if (!(rowno < par.row_sig().size() + && par.row_sig()[rowno] == row_sig)) { + if (rowno >= par.row_sig().size()) + par.row_sig().push_back(row_sig); + else + par.row_sig()[rowno] = row_sig; + if (par.inInset()->lyxCode() == InsetBase::TEXT_CODE) { + int ht = rit->ascent() + rit->descent(); + pi.pain.fillRectangle(0, y - ht, + pi.base.bv->workWidth(), ht, + LColor::background); + } + rp.paintAppendix(); + rp.paintDepthBar(); + rp.paintChangeBar(); + if (rit == rb) + rp.paintFirst(); + if (rit + 1 == re) + rp.paintLast(); + rp.paintText(); + } + ++rowno; } } @@ -752,10 +769,6 @@ void paintText(BufferView const & bv, Vi { Painter & pain = bv.painter(); LyXText * const text = bv.text(); - - // clear background - pain.fillRectangle(0, vi.y1, bv.workWidth(), vi.y2 - vi.y1, - LColor::background); // draw selection PainterInfo pi(const_cast<BufferView *>(&bv), pain);
pgphguGegFpua.pgp
Description: PGP signature