From 8000e97a8c7a07253e83e6be645a87b725600487 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Thu, 13 Aug 2015 17:59:56 -0400 Subject: [PATCH] force waterfall to throttle by client dc paint from appframe idle - Attempting to improve waterfall jitter between platforms --- src/AppFrame.cpp | 6 +++++- src/visual/WaterfallCanvas.cpp | 12 +++++++++--- src/visual/WaterfallCanvas.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 1e621dd..42f7cf0 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -768,7 +768,11 @@ void AppFrame::OnIdle(wxIdleEvent& event) { #ifndef _WIN32 usleep(5000); #endif - + + if (this->IsVisible()) { + waterfallCanvas->DoPaint(); + demodWaterfallCanvas->DoPaint(); + } event.RequestMore(); } diff --git a/src/visual/WaterfallCanvas.cpp b/src/visual/WaterfallCanvas.cpp index 2a52a11..00bc773 100644 --- a/src/visual/WaterfallCanvas.cpp +++ b/src/visual/WaterfallCanvas.cpp @@ -88,7 +88,12 @@ void WaterfallCanvas::processInputQueue() { } void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { - wxPaintDC dc(this); +// event.Skip(); +} + +void WaterfallCanvas::DoPaint() { + wxClientDC dc(this); + // wxPaintDC dc(this); const wxSize ClientSize = GetClientSize(); long double currentZoom = zoom; @@ -354,8 +359,9 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) { } } void WaterfallCanvas::OnIdle(wxIdleEvent &event) { - Refresh(); - event.RequestMore(); +// Refresh(); +// event.RequestMore(); + event.Skip(); } void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) { diff --git a/src/visual/WaterfallCanvas.h b/src/visual/WaterfallCanvas.h index 2f51ec3..1b59e35 100644 --- a/src/visual/WaterfallCanvas.h +++ b/src/visual/WaterfallCanvas.h @@ -28,6 +28,7 @@ public: void attachSpectrumCanvas(SpectrumCanvas *canvas_in); void processInputQueue(); SpectrumVisualDataQueue *getVisualDataQueue(); + void DoPaint(); private: void OnPaint(wxPaintEvent& event);