]> git.lyx.org Git - lyx.git/commitdiff
Remove some redundant calls to updatePosCache
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 24 Jul 2023 13:35:16 +0000 (15:35 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Apr 2024 14:45:58 +0000 (16:45 +0200)
The setting of insets positions was done twice in updateMetrics.
When one of the paragraph is a huge branch, this can be very expensive.

This leads to a 17% improvement on updateMetrics time on a scrolling test.

Part of bug #12297

(cherry picked from commit d19ade9a611d3ecf6840c5eb43291cb268ad6f4f)

src/BufferView.cpp

index 4065a464b6beb82d59f38a42e2cabbf175915f0e..27ad1ad8f2ee2d3e54f25370a4f87f6c7d6db3f8 100644 (file)
@@ -3216,7 +3216,6 @@ void BufferView::updateMetrics(Update::flags & update_flags)
                }
        }
        anchor_pm.setPosition(d->anchor_ypos_);
-       tm.updatePosCache(d->anchor_pit_);
 
        LYXERR(Debug::PAINTING, "metrics: "
                << " anchor pit = " << d->anchor_pit_
@@ -3232,7 +3231,6 @@ void BufferView::updateMetrics(Update::flags & update_flags)
                y1 -= pm.descent();
                // Save the paragraph position in the cache.
                pm.setPosition(y1);
-               tm.updatePosCache(pit1);
                y1 -= pm.ascent();
        }
 
@@ -3246,7 +3244,6 @@ void BufferView::updateMetrics(Update::flags & update_flags)
                y2 += pm.ascent();
                // Save the paragraph position in the cache.
                pm.setPosition(y2);
-               tm.updatePosCache(pit2);
                y2 += pm.descent();
        }