[Patch] speed patch revisited
Please find attach the inside-inset speed patch, which now functions and is as bug-free as I could get it. There are still some rendering artefacts in corner cases, but none of them look bad IMHO. This is a somewhat complex and intrusive patch, and perhaps not for 1.4.0. But for 1.4.1 we should consider this -- together with the inside-paragraph selection speed patch. I feel good about both. Note that the patch was diffed from a dirty tree. It contains a stowaway, the bool multiparsel_cache_ from the selection speed patch, which should not cause trouble here. - Martin Index: BufferView.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v retrieving revision 1.265 diff -u -p -r1.265 BufferView.C --- BufferView.C 19 Dec 2005 11:47:13 - 1.265 +++ BufferView.C 5 Jan 2006 14:33:29 - @@ -369,6 +369,18 @@ void BufferView::putSelectionAt(DocItera } +bool const BufferView::repaintAll() const +{ + return pimpl_-repaintAll(); +} + + +void const BufferView::repaintAll(bool r) const +{ + pimpl_-repaintAll(r); +} + + LCursor BufferView::cursor() { return pimpl_-cursor_; Index: BufferView.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v retrieving revision 1.189 diff -u -p -r1.189 BufferView.h --- BufferView.h 1 Dec 2005 10:28:47 - 1.189 +++ BufferView.h 5 Jan 2006 14:33:29 - @@ -198,7 +199,10 @@ public: */ void putSelectionAt(DocIterator const cur, int length, bool backwards); - + /// + bool const repaintAll() const; + /// + void const repaintAll(bool r) const; private: /// Index: BufferView_pimpl.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.h,v retrieving revision 1.129 diff -u -p -r1.129 BufferView_pimpl.h --- BufferView_pimpl.h 7 Nov 2005 15:06:42 - 1.129 +++ BufferView_pimpl.h 5 Jan 2006 14:33:29 - @@ -103,6 +105,10 @@ public: FuncStatus getStatus(FuncRequest const cmd); /// a function should be executed bool dispatch(FuncRequest const ev); + /// Flag: do a full redraw of inside text of inset + bool repaintAll() { return refresh_inside_; } + /// + void repaintAll(bool r) {refresh_inside_ = r; } private: /// An error list (replaces the error insets) ErrorList errorlist_; @@ -183,13 +189,17 @@ private: /// LCursor cursor_; /// + bool multiparsel_cache_; /// lyx::pit_type anchor_ref_; /// int offset_ref_; /// ViewMetricsInfo metrics(bool singlepar = false); - - + /// Working variable indicating a full screen refresh + mutable bool refresh_; + /// Inside insets + mutable bool refresh_inside_; + }; #endif // BUFFERVIEW_PIMPL_H Index: rowpainter.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.162 diff -u -p -r1.162 rowpainter.C --- rowpainter.C 1 Jan 2006 23:06:23 - 1.162 +++ rowpainter.C 5 Jan 2006 14:33:30 - @@ -164,7 +164,11 @@ void RowPainter::paintInset(pos_type con pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0); pi.erased_ = erased_ || isDeletedText(par_, pos); theCoords.insets().add(inset, int(x_), yo_); - inset-drawSelection(pi, int(x_), yo_); + InsetText const * in = static_castInsetText const*(inset); + if (in in-isTextInset() !in-wide_inset_) + bv_.repaintAll(true); + if (bv_.repaintAll()) + inset-drawSelection(pi, int(x_), yo_); inset-draw(pi, int(x_), yo_); x_ += inset-width(); } @@ -729,8 +733,9 @@ lyx::size_type calculateRowSignature(Row } -bool isCursorOnRow(PainterInfo pi, pit_type pit, RowList::const_iterator rit) +bool CursorOnRow(PainterInfo pi, pit_type pit, RowList::const_iterator rit) { + // Is there a cursor on this row (or inside inset on row) LCursor cur = pi.base.bv-cursor(); for (lyx::size_type d = 0; d cur.depth(); d++) if (cur[d].pit() == pit @@ -741,6 +746,20 @@ bool isCursorOnRow(PainterInfo pi, pit } +bool innerCursorOnRow(PainterInfo pi, pit_type pit, RowList::const_iterator rit) +{ + // Is there a cursor inside an inset on this row, and is this inset + // the only character on this row + LCursor cur = pi.base.bv-cursor(); + if (rit-pos() + 1 != rit-endpos()) + return false; + for (lyx::size_type d = 0; d cur.depth(); d++) + if (cur[d].pit() == pit cur[d].pos() == rit-pos()) + return d cur.depth() - 1; + return false; +} + + void paintPar (PainterInfo pi, LyXText const text, pit_type pit, int x, int y, bool repaintAll) @@ -763,14 +782,25 @@ void paintPar // Row signature; has row changed since last paint? lyx::size_type const row_sig = calculateRowSignature(*rit, par); + bool row_has_changed = par.rowSignature()[rowno] != row_sig; + + bool cursor_on_row = CursorOnRow(pi, pit, rit); + bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit); + + // If this is the only
Re: [Patch] speed patch revisited
Martin Vermeer [EMAIL PROTECTED] writes: | Please find attach the inside-inset speed patch, which now functions and | is as bug-free as I could get it. | | There are still some rendering artefacts in corner cases, but none of | them look bad IMHO. | | This is a somewhat complex and intrusive patch, and perhaps not for | 1.4.0. But for 1.4.1 we should consider this -- together with the | inside-paragraph selection speed patch. I feel good about both. IMHO, not for 1.4.0 but can be considered for 1.4.1. (just to make my position clear) -- Lgb
[Patch] speed patch revisited
Please find attach the inside-inset speed patch, which now functions and is as bug-free as I could get it. There are still some rendering artefacts in corner cases, but none of them look bad IMHO. This is a somewhat complex and intrusive patch, and perhaps not for 1.4.0. But for 1.4.1 we should consider this -- together with the inside-paragraph selection speed patch. I feel good about both. Note that the patch was diffed from a dirty tree. It contains a stowaway, the bool multiparsel_cache_ from the selection speed patch, which should not cause trouble here. - Martin Index: BufferView.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v retrieving revision 1.265 diff -u -p -r1.265 BufferView.C --- BufferView.C 19 Dec 2005 11:47:13 - 1.265 +++ BufferView.C 5 Jan 2006 14:33:29 - @@ -369,6 +369,18 @@ void BufferView::putSelectionAt(DocItera } +bool const BufferView::repaintAll() const +{ + return pimpl_->repaintAll(); +} + + +void const BufferView::repaintAll(bool r) const +{ + pimpl_->repaintAll(r); +} + + LCursor & BufferView::cursor() { return pimpl_->cursor_; Index: BufferView.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v retrieving revision 1.189 diff -u -p -r1.189 BufferView.h --- BufferView.h 1 Dec 2005 10:28:47 - 1.189 +++ BufferView.h 5 Jan 2006 14:33:29 - @@ -198,7 +199,10 @@ public: */ void putSelectionAt(DocIterator const & cur, int length, bool backwards); - + /// + bool const repaintAll() const; + /// + void const repaintAll(bool r) const; private: /// Index: BufferView_pimpl.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.h,v retrieving revision 1.129 diff -u -p -r1.129 BufferView_pimpl.h --- BufferView_pimpl.h 7 Nov 2005 15:06:42 - 1.129 +++ BufferView_pimpl.h 5 Jan 2006 14:33:29 - @@ -103,6 +105,10 @@ public: FuncStatus getStatus(FuncRequest const & cmd); /// a function should be executed bool dispatch(FuncRequest const & ev); + /// Flag: do a full redraw of inside text of inset + bool repaintAll() { return refresh_inside_; } + /// + void repaintAll(bool r) {refresh_inside_ = r; } private: /// An error list (replaces the error insets) ErrorList errorlist_; @@ -183,13 +189,17 @@ private: /// LCursor cursor_; /// + bool multiparsel_cache_; /// lyx::pit_type anchor_ref_; /// int offset_ref_; /// ViewMetricsInfo metrics(bool singlepar = false); - - + /// Working variable indicating a full screen refresh + mutable bool refresh_; + /// Inside insets + mutable bool refresh_inside_; + }; #endif // BUFFERVIEW_PIMPL_H Index: rowpainter.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.162 diff -u -p -r1.162 rowpainter.C --- rowpainter.C 1 Jan 2006 23:06:23 - 1.162 +++ rowpainter.C 5 Jan 2006 14:33:30 - @@ -164,7 +164,11 @@ void RowPainter::paintInset(pos_type con pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0); pi.erased_ = erased_ || isDeletedText(par_, pos); theCoords.insets().add(inset, int(x_), yo_); - inset->drawSelection(pi, int(x_), yo_); + InsetText const * in = static_cast(inset); + if (in && in->isTextInset() && !in->wide_inset_) + bv_.repaintAll(true); + if (bv_.repaintAll()) + inset->drawSelection(pi, int(x_), yo_); inset->draw(pi, int(x_), yo_); x_ += inset->width(); } @@ -729,8 +733,9 @@ lyx::size_type calculateRowSignature(Row } -bool isCursorOnRow(PainterInfo & pi, pit_type pit, RowList::const_iterator rit) +bool CursorOnRow(PainterInfo & pi, pit_type pit, RowList::const_iterator rit) { + // Is there a cursor on this row (or inside inset on row) LCursor & cur = pi.base.bv->cursor(); for (lyx::size_type d = 0; d < cur.depth(); d++) if (cur[d].pit() == pit @@ -741,6 +746,20 @@ bool isCursorOnRow(PainterInfo & pi, pit } +bool innerCursorOnRow(PainterInfo & pi, pit_type pit, RowList::const_iterator rit) +{ + // Is there a cursor inside an inset on this row, and is this inset + // the only "character" on this row + LCursor & cur = pi.base.bv->cursor(); + if (rit->pos() + 1 != rit->endpos()) + return false; + for (lyx::size_type d = 0; d < cur.depth(); d++) + if (cur[d].pit() == pit && cur[d].pos() == rit->pos()) + return d < cur.depth() - 1; + return false; +} + + void paintPar (PainterInfo & pi, LyXText const & text, pit_type pit, int x, int y, bool repaintAll) @@ -763,14 +782,25 @@ void paintPar // Row signature; has row changed since last paint? lyx::size_type const row_sig = calculateRowSignature(*rit, par); + bool row_has_changed = par.rowSignature()[rowno] != row_sig; + + bool cursor_on_row = CursorOnRow(pi, pit, rit); + bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit); + + // If
Re: [Patch] speed patch revisited
Martin Vermeer <[EMAIL PROTECTED]> writes: | Please find attach the inside-inset speed patch, which now functions and | is as bug-free as I could get it. | | There are still some rendering artefacts in corner cases, but none of | them look bad IMHO. | | This is a somewhat complex and intrusive patch, and perhaps not for | 1.4.0. But for 1.4.1 we should consider this -- together with the | inside-paragraph selection speed patch. I feel good about both. IMHO, not for 1.4.0 but can be considered for 1.4.1. (just to make my position clear) -- Lgb