aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/EditView.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-20 16:25:35 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-20 16:25:35 +1100
commit434ea41aa400557964d73867008cfa8b1f64d8c4 (patch)
tree7a6981a28f521391a97cdbd4224fd81b2035bf24 /src/EditView.cxx
parent3d45c4bf974b6fdcce9712bbd3f0071a9618b89f (diff)
downloadscintilla-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/EditView.cxx')
-rw-r--r--src/EditView.cxx34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 8243169d0..a835ab0a0 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -251,28 +251,10 @@ void EditView::LinesAddedOrRemoved(Sci::Line lineOfPos, Sci::Line linesAdded) {
}
}
-void EditView::DropGraphics(bool freeObjects) noexcept {
- if (freeObjects) {
- pixmapLine.reset();
- pixmapIndentGuide.reset();
- pixmapIndentGuideHighlight.reset();
- } else {
- if (pixmapLine)
- pixmapLine->Release();
- if (pixmapIndentGuide)
- pixmapIndentGuide->Release();
- if (pixmapIndentGuideHighlight)
- pixmapIndentGuideHighlight->Release();
- }
-}
-
-void EditView::AllocateGraphics(const ViewStyle &vsDraw) {
- if (!pixmapLine)
- pixmapLine = Surface::Allocate(vsDraw.technology);
- if (!pixmapIndentGuide)
- pixmapIndentGuide = Surface::Allocate(vsDraw.technology);
- if (!pixmapIndentGuideHighlight)
- pixmapIndentGuideHighlight = Surface::Allocate(vsDraw.technology);
+void EditView::DropGraphics() noexcept {
+ pixmapLine.reset();
+ pixmapIndentGuide.reset();
+ pixmapIndentGuideHighlight.reset();
}
static const char *ControlCharacterString(unsigned char ch) noexcept {
@@ -311,11 +293,11 @@ static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const Vie
}
}
-void EditView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) {
- if (!pixmapIndentGuide->Initialised()) {
+void EditView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) {
+ if (!pixmapIndentGuide) {
// 1 extra pixel in height so can handle odd/even positions and so produce a continuous line
- pixmapIndentGuide->InitPixMap(1, vsDraw.lineHeight + 1, surfaceWindow, wid);
- pixmapIndentGuideHighlight->InitPixMap(1, vsDraw.lineHeight + 1, surfaceWindow, wid);
+ pixmapIndentGuide = surfaceWindow->AllocatePixMap(1, vsDraw.lineHeight + 1);
+ pixmapIndentGuideHighlight = surfaceWindow->AllocatePixMap(1, vsDraw.lineHeight + 1);
const PRectangle rcIG = PRectangle::FromInts(0, 0, 1, vsDraw.lineHeight);
pixmapIndentGuide->FillRectangle(rcIG, vsDraw.styles[STYLE_INDENTGUIDE].back);
pixmapIndentGuideHighlight->FillRectangle(rcIG, vsDraw.styles[STYLE_BRACELIGHT].back);