From: Jean-Marc Lasgouttes Date: Sun, 23 Jul 2017 13:50:35 +0000 (+0200) Subject: Remove workaround that is not necessary anymore. X-Git-Tag: 2.3.1~133^2~88^2~17 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=410605385f1f40d3381fc7236dfb468d100d94f8;p=features.git Remove workaround that is not necessary anymore. This code was necessary to handle cases where the insets positions were not yet in cache. This cannot happen anymore thanks to the nodraw stage. --- diff --git a/development/PAINTING_ANALYSIS b/development/PAINTING_ANALYSIS index 9d625934bb..f734edb3b0 100644 --- a/development/PAINTING_ANALYSIS +++ b/development/PAINTING_ANALYSIS @@ -67,11 +67,6 @@ drawing from metrics. Other changes are only clean-ups. ** When a paragraph ends with a newline, compute correctly the height of the extra row. -** Cleanup after complete metrics - Then the following can be done: - + remove hack in InsetMathNest::drawSelection - + remove Cursor::inCoordCache? - ** Merging bv::updateMetrics and tm::metrics While the full metrics computation tries hard to limit the number of diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 3c6adfcd74..68ba3d7475 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2982,7 +2982,7 @@ bool BufferView::needRepaint(Text const * text, Row const & row) const } -void BufferView::checkCursorScrollOffset(PainterInfo & pi) +void BufferView::checkCursorScrollOffset() { CursorSlice rowSlice = d->cursor_.bottom(); TextMetrics const & tm = textMetrics(rowSlice.text()); @@ -2999,34 +2999,6 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi) // Set the row on which the cursor lives. setCurrentRowSlice(rowSlice); - // If insets referred to by cursor are not all in the cache, the positions - // need to be recomputed. - if (!d->cursor_.inCoordCache()) { - /** FIXME: the code below adds an extraneous computation of - * inset positions, and can therefore be bad for performance - * (think for example about a very large tabular inset. - * Redawing the row where it is means redrawing the whole - * screen). - * - * The bug that this fixes is the following: assume that there - * is a very large math inset. Upon entering the inset, when - * pressing `End', the row is not scrolled and the cursor is - * not visible. The extra row computation makes sure that the - * inset positions are correctly computed and set in the - * cache. This would not happen if we did not have two-stage - * drawing. - * - * A proper fix would be to always have proper inset positions - * at this point. - */ - // Force the recomputation of inset positions - frontend::NullPainter np; - PainterInfo(this, np); - // No need to care about vertical position. - RowPainter rp(pi, buffer().text(), row, -d->horiz_scroll_offset_, 0); - rp.paintText(); - } - // Current x position of the cursor in pixels int cur_x = getPos(d->cursor_).x_; @@ -3093,7 +3065,7 @@ void BufferView::draw(frontend::Painter & pain, bool paint_caret) // Check whether the row where the cursor lives needs to be scrolled. // Update the drawing strategy if needed. - checkCursorScrollOffset(pi); + checkCursorScrollOffset(); switch (d->update_strategy_) { diff --git a/src/BufferView.h b/src/BufferView.h index eed408dae7..1c155685a5 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -42,7 +42,6 @@ class FuncStatus; class Intl; class Inset; class Length; -class PainterInfo; class ParIterator; class ParagraphMetrics; class Point; @@ -374,7 +373,7 @@ private: // Check whether the row where the cursor lives needs to be scrolled. // Update the drawing strategy if needed. - void checkCursorScrollOffset(PainterInfo & pi); + void checkCursorScrollOffset(); /// The minimal size of the document that is visible. Used /// when it is allowed to scroll below the document. diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 2e8060509d..11ee5ea535 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -453,19 +453,6 @@ int Cursor::currentMode() } -bool Cursor::inCoordCache() const -{ - // the root inset is not in cache, but we do not need it. - if (depth() == 1) - return true; - CoordCache::Insets const & icache = bv_->coordCache().getInsets(); - for (size_t i = 1 ; i < depth() ; ++i) - if (!icache.has(&(*this)[i].inset())) - return false; - return true; -} - - void Cursor::getPos(int & x, int & y) const { Point p = bv().getPos(*this); diff --git a/src/Cursor.h b/src/Cursor.h index 8a8c71996d..5fb52638b7 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -215,8 +215,6 @@ public: /// are we entering a macro name? bool & macromode() { return macromode_; } - /// returns true when all insets in cursor stack are in cache - bool inCoordCache() const; /// returns x,y position void getPos(int & x, int & y) const; /// return logical positions between which the cursor is situated