aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/EditView.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-01-20 08:36:24 +1100
committerNeil <nyamatongwe@gmail.com>2022-01-20 08:36:24 +1100
commita3fff53a48e63064b14f7a1842b20f260bc5a9bc (patch)
tree6d2ce6b1c61e94a0a708a3442977776f07a1d3f1 /src/EditView.cxx
parent5aff87386c21d5a345eff5b1982f4171577a922c (diff)
downloadscintilla-mirror-a3fff53a48e63064b14f7a1842b20f260bc5a9bc.tar.gz
Hide details of PositionCache.
Move class declarations of PositionCache and PositionCacheEntry into cxx file and only define IPositionCache interface and CreatePositionCache factory function in header.
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r--src/EditView.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 444fb3283..527b829bf 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -191,7 +191,8 @@ EditView::EditView() {
additionalCaretsVisible = true;
imeCaretBlockOverride = false;
llc.SetLevel(LineCache::Caret);
- posCache.SetSize(0x400);
+ posCache = CreatePositionCache();
+ posCache->SetSize(0x400);
tabArrowHeight = 4;
customDrawTabArrow = nullptr;
customDrawWrapMarker = nullptr;
@@ -484,7 +485,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
// ts.representation->stringRep is UTF-8 which only matches cache if document is UTF-8
// or it only contains ASCII which is a subset of all currently supported encodings.
if ((CpUtf8 == model.pdoc->dbcsCodePage) || ViewIsASCII(ts.representation->stringRep)) {
- posCache.MeasureWidths(surface, vstyle, StyleControlChar, ts.representation->stringRep,
+ posCache->MeasureWidths(surface, vstyle, StyleControlChar, ts.representation->stringRep,
positionsRepr);
} else {
surface->MeasureWidthsUTF8(vstyle.styles[StyleControlChar].font.get(), ts.representation->stringRep, positionsRepr);
@@ -502,7 +503,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
// Over half the segments are single characters and of these about half are space characters.
ll->positions[ts.start + 1] = vstyle.styles[ll->styles[ts.start]].spaceWidth;
} else {
- posCache.MeasureWidths(surface, vstyle, ll->styles[ts.start],
+ posCache->MeasureWidths(surface, vstyle, ll->styles[ts.start],
std::string_view(&ll->chars[ts.start], ts.length), &ll->positions[ts.start + 1]);
}
}
@@ -2587,7 +2588,7 @@ static ColourRGBA InvertedLight(ColourRGBA orig) noexcept {
Sci::Position EditView::FormatRange(bool draw, const RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure,
const EditModel &model, const ViewStyle &vs) {
// Can't use measurements cached for screen
- posCache.Clear();
+ posCache->Clear();
ViewStyle vsPrint(vs);
vsPrint.technology = Technology::Default;
@@ -2756,7 +2757,7 @@ Sci::Position EditView::FormatRange(bool draw, const RangeToFormat *pfr, Surface
}
// Clear cache so measurements are not used for screen
- posCache.Clear();
+ posCache->Clear();
return nPrintPos;
}