diff --git a/map/framework.cpp b/map/framework.cpp index 452cf66bf5..e4f3fcd356 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -283,7 +283,8 @@ void Framework::SetMaxWorldRect() bool Framework::NeedRedraw() const { - return m_renderPolicy->NeedRedraw(); + // Checking this here allows to avoid many dummy "IsInitialized" flags in client code. + return (m_renderPolicy && m_renderPolicy->NeedRedraw()); } void Framework::SetNeedRedraw(bool flag) diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 7285aa9ac0..91760156e8 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -17,8 +17,6 @@ using namespace storage; namespace qt { - bool s_isExiting = false; - QtVideoTimer::QtVideoTimer(DrawWidget * w, TFrameFn frameFn) : ::VideoTimer(frameFn), m_widget(w) {} @@ -71,8 +69,6 @@ namespace qt void DrawWidget::PrepareShutdown() { - s_isExiting = true; - m_framework->PrepareToShutdown(); m_videoTimer.reset(); } @@ -209,7 +205,7 @@ namespace qt void DrawWidget::initializeGL() { - /// we'll perform swap by ourselves, see issue #333 + // we'll perform swap by ourselves, see issue #333 setAutoBufferSwap(false); if (!m_isInitialized) @@ -231,7 +227,7 @@ namespace qt catch (yg::gl::platform_unsupported const & e) { LOG(LERROR, ("OpenGL platform is unsupported, reason: ", e.what())); - /// TODO: Show "Please Update Drivers" dialog and close the program. + /// @todo Show "Please Update Drivers" dialog and close the program. } m_isInitialized = true; @@ -242,8 +238,10 @@ namespace qt { m_framework->OnSize(w, h); m_framework->Invalidate(); + if (m_isInitialized && m_isTimerStarted) DrawFrame(); + UpdateScaleControl(); emit ViewportChanged(); } @@ -252,10 +250,9 @@ namespace qt { if (m_isInitialized && !m_isTimerStarted) { - /// timer should be started upon the first repaint - /// request to fully initialized GLWidget. + // timer should be started upon the first repaint request to fully initialized GLWidget. m_isTimerStarted = true; - m_framework->SetUpdatesEnabled(true); + (void)m_framework->SetUpdatesEnabled(true); } m_framework->Invalidate(); @@ -263,9 +260,6 @@ namespace qt void DrawWidget::DrawFrame() { - if (s_isExiting) - return; - if (m_framework->NeedRedraw()) { makeCurrent(); @@ -276,7 +270,7 @@ namespace qt m_framework->BeginPaint(paintEvent); m_framework->DoPaint(paintEvent); - /// swapping buffers before ending the frame, see issue #333 + // swapping buffers before ending the frame, see issue #333 swapBuffers(); m_framework->EndPaint(paintEvent); diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp index 08e719920f..a8726d8593 100644 --- a/qt/draw_widget.hpp +++ b/qt/draw_widget.hpp @@ -22,12 +22,10 @@ namespace qt class QtVideoTimer : public ::VideoTimer { private: - QTimer * m_timer; DrawWidget * m_widget; public: - QtVideoTimer(DrawWidget * w, ::VideoTimer::TFrameFn frameFn); void resume(); @@ -98,13 +96,9 @@ namespace qt Framework & GetFramework() { return *m_framework.get(); } protected: - VideoTimer * CreateVideoTimer(); - static const uint32_t ini_file_version = 0; - protected: - /// @name Overriden from base_type. //@{ virtual void initializeGL();