aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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
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')
-rw-r--r--src/EditView.cxx2
-rw-r--r--src/PositionCache.cxx19
-rw-r--r--src/PositionCache.h2
3 files changed, 4 insertions, 19 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 80edd31c6..5d69c1345 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -489,7 +489,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
ll->positions[ts.start + 1] = vstyle.styles[ll->styles[ts.start]].spaceWidth;
} else {
posCache.MeasureWidths(surface, vstyle, ll->styles[ts.start], &ll->chars[ts.start],
- ts.length, &ll->positions[ts.start + 1], model.pdoc);
+ ts.length, &ll->positions[ts.start + 1]);
}
}
lastSegItalics = (!ts.representation) && ((ll->chars[ts.end() - 1] != ' ') && vstyle.styles[ll->styles[ts.start]].italic);
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++;
diff --git a/src/PositionCache.h b/src/PositionCache.h
index b3e87bcd5..030b16504 100644
--- a/src/PositionCache.h
+++ b/src/PositionCache.h
@@ -281,7 +281,7 @@ public:
void SetSize(size_t size_);
size_t GetSize() const noexcept { return pces.size(); }
void 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);
};
}