From 922a70ac051ac097632bc26e56c23fffb65aa43d Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 29 May 2025 10:37:25 +1000 Subject: Recreate all pixmaps if any null as this may better handle cases where some allocations succeed and others fail. --- src/EditView.cxx | 2 +- src/Editor.cxx | 12 ++++-------- src/MarginView.cxx | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/EditView.cxx b/src/EditView.cxx index e8c8562ec..dddd84d94 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -277,7 +277,7 @@ void EditView::DropGraphics() noexcept { } void EditView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) { - if (!pixmapIndentGuide) { + if (!(pixmapIndentGuide && pixmapIndentGuideHighlight)) { // 1 extra pixel in height so can handle odd/even positions and so produce a continuous line pixmapIndentGuide = surfaceWindow->AllocatePixMap(1, vsDraw.lineHeight + 1); pixmapIndentGuideHighlight = surfaceWindow->AllocatePixMap(1, vsDraw.lineHeight + 1); diff --git a/src/Editor.cxx b/src/Editor.cxx index d081c989e..4c35093db 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1846,15 +1846,11 @@ void Editor::PaintSelMargin(Surface *surfaceWindow, const PRectangle &rc) { void Editor::RefreshPixMaps(Surface *surfaceWindow) { view.RefreshPixMaps(surfaceWindow, vs); marginView.RefreshPixMaps(surfaceWindow, vs); - if (view.bufferedDraw) { + if (view.bufferedDraw && !(view.pixmapLine && marginView.pixmapSelMargin)) { const PRectangle rcClient = GetClientRectangle(); - if (!view.pixmapLine) { - view.pixmapLine = surfaceWindow->AllocatePixMap(static_cast(rcClient.Width()), vs.lineHeight); - } - if (!marginView.pixmapSelMargin) { - marginView.pixmapSelMargin = surfaceWindow->AllocatePixMap(vs.fixedColumnWidth, - static_cast(rcClient.Height())); - } + view.pixmapLine = surfaceWindow->AllocatePixMap(static_cast(rcClient.Width()), vs.lineHeight); + marginView.pixmapSelMargin = surfaceWindow->AllocatePixMap(vs.fixedColumnWidth, + static_cast(rcClient.Height())); } } diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 09b01959e..18c1b33b0 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -124,7 +124,7 @@ void MarginView::DropGraphics() noexcept { } void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) { - if (!pixmapSelPattern) { + if (!(pixmapSelPattern && pixmapSelPatternOffset1)) { constexpr int patternSize = 8; pixmapSelPattern = surfaceWindow->AllocatePixMap(patternSize, patternSize); pixmapSelPatternOffset1 = surfaceWindow->AllocatePixMap(patternSize, patternSize); -- cgit v1.2.3