From 77342b3ad85c1b3d9d96aa0ff7f66e6a941fb735 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 15 Oct 2014 09:22:41 +0200 Subject: [PATCH] Chart: clear view when switiching to BDirectWindow Even when BDirectWindow is used, the back buffer data can be copied to the front buffer. This happens when resizing or moving the window, and when moving the cursor above it. Since Charts does not touch the whole window when redrawing (it only erases previous stars and draws new ones) this led to the last frame drawn on the back buffer to stay visible until stars erased it. Clearing the back buffer view with the current "sapce color" makes this much less visible. Fixes #96. --- src/tests/kits/game/chart/ChartWindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tests/kits/game/chart/ChartWindow.cpp b/src/tests/kits/game/chart/ChartWindow.cpp index c75dc6058c..bd08da2cf0 100644 --- a/src/tests/kits/game/chart/ChartWindow.cpp +++ b/src/tests/kits/game/chart/ChartWindow.cpp @@ -1504,6 +1504,13 @@ ChartWindow::ChangeSetting(setting new_set) /* this need to be atomic in regard of DirectConnected */ while (acquire_sem(fDrawingLock) == B_INTERRUPTED) ; + + // Clear the non-direct view, which may still be drawn + fChartView->LockLooper(); + fChartView->SetHighColor(fCurrentSettings.back_color); + fChartView->FillRect(fChartView->Bounds()); + fChartView->UnlockLooper(); + /* synchronise the camera geometry and the direct buffer geometry */ SetGeometry(fDirectBuffer.buffer_width, fDirectBuffer.buffer_height); /* cancel erasing of stars not in visible part of the direct window */