aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/MarginView.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/MarginView.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/MarginView.cxx')
-rw-r--r--src/MarginView.cxx34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 4d040776d..913fd0e2d 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -109,35 +109,17 @@ MarginView::MarginView() noexcept {
customDrawWrapMarker = nullptr;
}
-void MarginView::DropGraphics(bool freeObjects) noexcept {
- if (freeObjects) {
- pixmapSelMargin.reset();
- pixmapSelPattern.reset();
- pixmapSelPatternOffset1.reset();
- } else {
- if (pixmapSelMargin)
- pixmapSelMargin->Release();
- if (pixmapSelPattern)
- pixmapSelPattern->Release();
- if (pixmapSelPatternOffset1)
- pixmapSelPatternOffset1->Release();
- }
-}
-
-void MarginView::AllocateGraphics(const ViewStyle &vsDraw) {
- if (!pixmapSelMargin)
- pixmapSelMargin = Surface::Allocate(vsDraw.technology);
- if (!pixmapSelPattern)
- pixmapSelPattern = Surface::Allocate(vsDraw.technology);
- if (!pixmapSelPatternOffset1)
- pixmapSelPatternOffset1 = Surface::Allocate(vsDraw.technology);
+void MarginView::DropGraphics() noexcept {
+ pixmapSelMargin.reset();
+ pixmapSelPattern.reset();
+ pixmapSelPatternOffset1.reset();
}
-void MarginView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) {
- if (!pixmapSelPattern->Initialised()) {
+void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) {
+ if (!pixmapSelPattern) {
const int patternSize = 8;
- pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wid);
- pixmapSelPatternOffset1->InitPixMap(patternSize, patternSize, surfaceWindow, wid);
+ pixmapSelPattern = surfaceWindow->AllocatePixMap(patternSize, patternSize);
+ pixmapSelPatternOffset1 = surfaceWindow->AllocatePixMap(patternSize, patternSize);
// This complex procedure is to reproduce the checkerboard dithered pattern used by windows
// for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half
// way between the chrome colour and the chrome highlight colour making a nice transition