diff options
author | Neil <nyamatongwe@gmail.com> | 2014-06-22 12:50:03 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-06-22 12:50:03 +1000 |
commit | 068bfb9213d810b1551cdc48fdfd216060253103 (patch) | |
tree | 961424276d263ea442f98112aa3bc26dafa92bef /src/PositionCache.cxx | |
parent | 318fb4b54beb34a036bfe405127c9329b67ea95f (diff) | |
download | scintilla-mirror-068bfb9213d810b1551cdc48fdfd216060253103.tar.gz |
Drawing and measuring should not change ViewStyle which is set by the container
so mark ViewStyle parameters as const.
Provide a FontAlias copy constructor and use it to work around non-const Font
arguments to Surface when sourced from const ViewStyle.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 0d2033bb9..2badeffbc 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -637,7 +637,7 @@ void PositionCache::SetSize(size_t size_) { pces.resize(size_); } -void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, +void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) { allClear = false; @@ -667,7 +667,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned XYPOSITION xStartSegment = 0; while (startSegment < len) { unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision); - surface->MeasureWidths(vstyle.styles[styleNumber].font, s + startSegment, lenSegment, positions + startSegment); + FontAlias fontStyle = vstyle.styles[styleNumber].font; + surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment); for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) { positions[startSegment + inSeg] += xStartSegment; } @@ -675,7 +676,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned startSegment += lenSegment; } } else { - surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions); + FontAlias fontStyle = vstyle.styles[styleNumber].font; + surface->MeasureWidths(fontStyle, s, len, positions); } if (probe < pces.size()) { // Store into cache |