]> git.lyx.org Git - features.git/commitdiff
BufferView::Pimpl::updateMetrics(): Simple optimization; avoid looking in the coord...
authorAbdelrazak Younes <younes@lyx.org>
Mon, 10 Jul 2006 14:32:11 +0000 (14:32 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 10 Jul 2006 14:32:11 +0000 (14:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14409 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C

index 95d85786b47a2fe0ef245df6485545dd28a63489..cb423532a311a1010b0fdb9b46ba461398a5a808 100644 (file)
@@ -1413,16 +1413,18 @@ void BufferView::Pimpl::updateMetrics(bool singlepar)
 
        // The coordinates of all these paragraphs are correct, cache them
        int y = y1;
+       CoordCache::InnerParPosCache parPos = theCoords.parPos()[text];
        for (lyx::pit_type pit = pit1; pit <= pit2; ++pit) {
-               y += text->getPar(pit).ascent();
-               theCoords.parPos()[text][pit] = Point(0, y);
+               Paragraph & par = text->getPar(pit);
+               y += par.ascent();
+               parPos[pit] = Point(0, y);
                if (singlepar && pit == cursor_.bottom().pit()) {
                        // In Single Paragraph mode, collect here the
                        // y1 and y2 of the (one) paragraph the cursor is in
-                       y1 = y - text->getPar(pit).ascent();
-                       y2 = y + text->getPar(pit).descent();
+                       y1 = y - par.ascent();
+                       y2 = y + par.descent();
                }
-               y += text->getPar(pit).descent();
+               y += par.descent();
        }
 
        if (singlepar) {