On Fri, Nov 21, 2003 at 03:56:16PM +0100, Andre' Poenitz wrote:
>
> still sluggish...
Wrong patch...
Andre'
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.91
diff -u -p -r1.91 rowpainter.C
--- rowpainter.C 21 Nov 2003 08:35:13 -0000 1.91
+++ rowpainter.C 21 Nov 2003 14:48:02 -0000
@@ -970,69 +970,48 @@ void RowPainter::paint()
paintText();
}
+} // namespace anon
+
-int paintRows(BufferView const & bv, LyXText const & text,
- ParagraphList::iterator pit, RowList::iterator rit,
- int xo, int y, int yf, int yo)
+int paintText(BufferView & bv)
{
- //lyxerr << " paintRows: rit: " << &*rit << endl;
- int const yy = yf - y;
- int const y2 = bv.painter().paperHeight();
+ RowList::iterator rit = bv.text->firstRow();
+ return paintTextInset(bv, *bv.text, 0, - bv.top_y() + rit->ascent_of_text());
+}
+
+
+int paintTextInset(BufferView & bv, LyXText & text, int xo, int baseline)
+{
+ RowList::iterator rit = text.firstRow();
+ baseline -= rit->ascent_of_text();
+ // search first par to be drawn
+ ParagraphList::iterator pit = text.ownerParagraphs().begin();
ParagraphList::iterator end = text.ownerParagraphs().end();
- bool active = false;
+ for ( ; pit != end; ++pit)
+ if (pit->y > baseline)
+ break;
+ if (pit != text.ownerParagraphs().begin())
+ --pit;
+ int const yo = baseline - pit->y;
+ int const y2 = bv.painter().paperHeight();
+
+ int y = 0;
for ( ; pit != end; ++pit) {
RowList::iterator row = pit->rows.begin();
RowList::iterator rend = pit->rows.end();
for ( ; row != rend; ++row) {
- if (row == rit)
- active = true;
- if (active) {
- RowPainter painter(bv, text, pit, row, y + yo, xo, y +
bv.top_y());
- painter.paint();
- y += row->height();
- } else {
- //lyxerr << " paintRows: row: " << &*row << "
ignored" << endl;
- }
+ RowPainter painter(bv, text, pit, row, y + yo, xo, y +
bv.top_y());
+ painter.paint();
+ y += row->height();
}
- if (yy + y >= y2)
+ if (yo + y >= y2)
return y;
}
return y;
-}
-
-} // namespace anon
-
-
-int paintText(BufferView & bv)
-{
- int const topy = bv.top_y();
- ParagraphList::iterator pit;
- RowList::iterator rit = bv.text->getRowNearY(topy, pit);
- int const y = pit->y + rit->y_offset() - topy;
- return paintRows(bv, *bv.text, pit, rit, 0, y, y, 0);
-}
-
-
-void paintTextInset(BufferView & bv, LyXText & text, int x, int baseline)
-{
- RowList::iterator rit = text.firstRow();
- RowList::iterator end = text.endRow();
- ParagraphList::iterator pit = text.ownerParagraphs().begin();
-
- int y_offset = baseline - rit->ascent_of_text();
- int y = y_offset;
- while (rit != end && y + rit->height() <= 0) {
- y += rit->height();
- text.nextRow(pit, rit);
- }
- if (y_offset < 0)
- paintRows(bv, text, pit, rit, x, 0, y, y);
- else
- paintRows(bv, text, pit, rit, x, 0, y_offset, y_offset);
}
Index: rowpainter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.h,v
retrieving revision 1.15
diff -u -p -r1.15 rowpainter.h
--- rowpainter.h 27 Aug 2003 14:55:17 -0000 1.15
+++ rowpainter.h 21 Nov 2003 14:48:02 -0000
@@ -24,6 +24,6 @@ int getLengthMarkerHeight(BufferView con
int paintText(BufferView & bv);
/// paint the rows of a text inset
-void paintTextInset(BufferView & bv, LyXText & text, int x, int y);
+int paintTextInset(BufferView & bv, LyXText & text, int x, int y);
#endif // ROWPAINTER_H