aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-06-10 09:33:22 +1000
committerNeil <nyamatongwe@gmail.com>2021-06-10 09:33:22 +1000
commit6d353d5ced87c554bc1b9abe194f18d585a0aeef (patch)
treee3ac6c084d40c8815952ec7076430db750ef6c92 /src/PositionCache.cxx
parent7ff41a39e0f5d91ccbeb2a5f342daba84785a892 (diff)
downloadscintilla-mirror-6d353d5ced87c554bc1b9abe194f18d585a0aeef.tar.gz
Don't divide input text into segments in PositionCache::MeasureWidths as text
should already have been segmented into reasonable lengths. The Document argument is no longer needed.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 8123552bd..7ea3055d4 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -855,7 +855,7 @@ void PositionCache::SetSize(size_t size_) {
}
void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
- const char *s, unsigned int len, XYPOSITION *positions, const Document *pdoc) {
+ const char *s, unsigned int len, XYPOSITION *positions) {
allClear = false;
size_t probe = pces.size(); // Out of bounds
@@ -879,22 +879,7 @@ void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, uns
}
}
const Font *fontStyle = vstyle.styles[styleNumber].font.get();
- if (len > BreakFinder::lengthStartSubdivision) {
- // Break up into segments
- unsigned int startSegment = 0;
- XYPOSITION xStartSegment = 0;
- while (startSegment < len) {
- const unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
- surface->MeasureWidths(fontStyle, std::string_view(s + startSegment, lenSegment), positions + startSegment);
- for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) {
- positions[startSegment + inSeg] += xStartSegment;
- }
- xStartSegment = positions[startSegment + lenSegment - 1];
- startSegment += lenSegment;
- }
- } else {
- surface->MeasureWidths(fontStyle, std::string_view(s, len), positions);
- }
+ surface->MeasureWidths(fontStyle, std::string_view(s, len), positions);
if (probe < pces.size()) {
// Store into cache
clock++;