From a383e75c6f6a7b561889d480fd205512bf9f7020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Fri, 14 Feb 2014 11:21:03 +0200 Subject: [PATCH] Refactor|libappfw|Client: Control timer loop from BaseWindow during draw --- doomsday/client/src/clientapp.cpp | 4 +++- doomsday/libappfw/src/basewindow.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doomsday/client/src/clientapp.cpp b/doomsday/client/src/clientapp.cpp index c7d1f9b160..5a75049b8c 100644 --- a/doomsday/client/src/clientapp.cpp +++ b/doomsday/client/src/clientapp.cpp @@ -450,8 +450,10 @@ void ClientApp::postFrame() S_EndFrame(); + // This is a good time to recycle unneeded memory allocations, as we're just + // finished and shown a frame and there might be free time before we have to + // begin drawing the next frame. Garbage_Recycle(); - loop().resume(); } void ClientApp::alert(String const &msg, LogEntry::Level level) diff --git a/doomsday/libappfw/src/basewindow.cpp b/doomsday/libappfw/src/basewindow.cpp index a2de18e35f..a680e07849 100644 --- a/doomsday/libappfw/src/basewindow.cpp +++ b/doomsday/libappfw/src/basewindow.cpp @@ -150,6 +150,9 @@ void BaseWindow::preDraw() {} void BaseWindow::postDraw() -{} +{ + // The timer loop was paused when the frame was requested to be drawn. + DENG2_GUI_APP->loop().resume(); +} } // namespace de