From 85441d442a67ecae557e7ec74409d0dc1e3c1cac Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 7 Aug 2013 15:52:25 +1000 Subject: Optimize performance with many control characters such as when opening a binary file. Simplify use of BreakFinder and use for layout as well as drawing. --- src/PositionCache.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/PositionCache.h') diff --git a/src/PositionCache.h b/src/PositionCache.h index 10afbd972..a0b805743 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -134,6 +134,15 @@ public: void Clear(); }; +struct TextSegment { + int start; + int length; + Representation *repr; + TextSegment(int start_=0, int length_=0, Representation *repr_=0) : + start(start_), length(length_), repr(repr_) { + } +}; + // Class to break a line of text into shorter runs at sensible places. class BreakFinder { LineLayout *ll; @@ -146,6 +155,7 @@ class BreakFinder { int saeNext; int subBreak; Document *pdoc; + EncodingFamily encodingFamily; SpecialRepresentations *preprs; void Insert(int val); // Private so BreakFinder objects can not be copied @@ -159,8 +169,8 @@ public: BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_); ~BreakFinder(); - int First() const; - int Next(); + TextSegment Next(); + bool More() const; }; class PositionCache { -- cgit v1.2.3