]> git.lyx.org Git - features.git/commitdiff
Remove workaround that is not necessary anymore.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 23 Jul 2017 13:50:35 +0000 (15:50 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 15 Feb 2018 11:29:25 +0000 (12:29 +0100)
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.

development/PAINTING_ANALYSIS
src/BufferView.cpp
src/BufferView.h
src/Cursor.cpp
src/Cursor.h

index 9d625934bb9f6e4d272f48296968f06f6dd3070f..f734edb3b012aea63443808e1aa3fdbf4ecfdab7 100644 (file)
@@ -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
index 3c6adfcd74bbfdd6fc601360dc239c581783ece8..68ba3d7475f52209f46d84ef366e658555fbd957 100644 (file)
@@ -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_) {
 
index eed408dae7e56245272507bd957af337b088291d..1c155685a5fe9e42b18277b768d6112847de97dd 100644 (file)
@@ -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.
index 2e8060509de0dbfd40af8033640bfc971463314e..11ee5ea535b9848c7b79fe31096c20191e530e7a 100644 (file)
@@ -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);
index 8a8c71996d52a959b4cae283a5bf8014cd9a814d..5fb52638b7120f899db36d569cdf5300562b0be4 100644 (file)
@@ -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