From 07e775f70b5ebeb25a45cfa53e14291e59205a3e Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 23 Dec 2001 01:02:34 +0000 Subject: Optimisation that avoids creating the lines and docLines arrays unless needed because a line has been folded or has a height greater than 1. --- src/ContractionState.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 362dc1ed8..3d2dde3c6 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -225,6 +225,11 @@ bool ContractionState::GetExpanded(int lineDoc) const { bool ContractionState::SetExpanded(int lineDoc, bool expanded) { if (size == 0) { + if (expanded) { + // If in completely expanded state then setting + // one line to expanded has no effect. + return false; + } Grow(linesInDoc + growSize); } if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { @@ -252,6 +257,11 @@ bool ContractionState::SetHeight(int lineDoc, int height) { if (lineDoc > linesInDoc) return false; if (size == 0) { + if (height == 1) { + // If in completely expanded state then all lines + // assumed to have height of one so no effect here. + return false; + } Grow(linesInDoc + growSize); } if (lines[lineDoc].height != height) { -- cgit v1.2.3