diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-20 16:25:35 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-20 16:25:35 +1100 |
commit | 434ea41aa400557964d73867008cfa8b1f64d8c4 (patch) | |
tree | 7a6981a28f521391a97cdbd4224fd81b2035bf24 /src/Editor.cxx | |
parent | 3d45c4bf974b6fdcce9712bbd3f0071a9618b89f (diff) | |
download | scintilla-mirror-434ea41aa400557964d73867008cfa8b1f64d8c4.tar.gz |
Use Surface::AllocatePixMap instead of changing an existing surface with
InitPixMap. Changed DropGraphics from releasing surfaces to deleting them.
This simplifies code and the added cost of allocating a new Surface is small.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 15936e150..44c80451b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -199,7 +199,7 @@ Editor::Editor() : durationWrapOneLine(0.00001, 0.000001, 0.0001) { Editor::~Editor() { pdoc->RemoveWatcher(this, 0); - DropGraphics(true); + DropGraphics(); } void Editor::Finalise() { @@ -262,21 +262,15 @@ void Editor::SetRepresentations() { } } -void Editor::DropGraphics(bool freeObjects) noexcept { - marginView.DropGraphics(freeObjects); - view.DropGraphics(freeObjects); -} - -void Editor::AllocateGraphics() { - marginView.AllocateGraphics(vs); - view.AllocateGraphics(vs); +void Editor::DropGraphics() noexcept { + marginView.DropGraphics(); + view.DropGraphics(); } void Editor::InvalidateStyleData() { stylesValid = false; vs.technology = technology; - DropGraphics(false); - AllocateGraphics(); + DropGraphics(); view.llc.Invalidate(LineLayout::ValidLevel::invalid); view.posCache.Clear(); } @@ -1677,7 +1671,6 @@ void Editor::PaintSelMargin(Surface *surfaceWindow, const PRectangle &rc) { if (vs.fixedColumnWidth == 0) return; - AllocateGraphics(); RefreshStyleData(); RefreshPixMaps(surfaceWindow); @@ -1719,18 +1712,16 @@ void Editor::PaintSelMargin(Surface *surfaceWindow, const PRectangle &rc) { } void Editor::RefreshPixMaps(Surface *surfaceWindow) { - view.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); - marginView.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); + view.RefreshPixMaps(surfaceWindow, vs); + marginView.RefreshPixMaps(surfaceWindow, vs); if (view.bufferedDraw) { const PRectangle rcClient = GetClientRectangle(); - if (!view.pixmapLine->Initialised()) { - - view.pixmapLine->InitPixMap(static_cast<int>(rcClient.Width()), vs.lineHeight, - surfaceWindow, wMain.GetID()); + if (!view.pixmapLine) { + view.pixmapLine = surfaceWindow->AllocatePixMap(static_cast<int>(rcClient.Width()), vs.lineHeight); } - if (!marginView.pixmapSelMargin->Initialised()) { - marginView.pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, - static_cast<int>(rcClient.Height()), surfaceWindow, wMain.GetID()); + if (!marginView.pixmapSelMargin) { + marginView.pixmapSelMargin = surfaceWindow->AllocatePixMap(vs.fixedColumnWidth, + static_cast<int>(rcClient.Height())); } } } @@ -1738,7 +1729,6 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) { void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); - AllocateGraphics(); RefreshStyleData(); if (paintState == PaintState::abandoned) @@ -1882,7 +1872,7 @@ void Editor::SetScrollBars() { } void Editor::ChangeSize() { - DropGraphics(false); + DropGraphics(); SetScrollBars(); if (Wrapping()) { PRectangle rcTextArea = GetClientRectangle(); |