mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
BufferView::Pimpl::updateMetrics(): Simple optimization; avoid looking in the coord cache map and the paragraph vector multiple time.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14409 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c9c6ed0b7f
commit
7e81f3f99a
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user