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.
This commit is contained in:
Adrien Destugues 2014-10-15 09:22:41 +02:00
parent 1431a56f33
commit 77342b3ad8

View File

@ -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 */