/** * This idle function allows progressive scanning of visibility etc */ bool GlueMapWindow::Idle() { bool still_dirty; bool topography_dirty = true; /* scan topography in every Idle() call */ bool terrain_dirty = true; bool weather_dirty = true; // StartTimer(); do { idle_robin = (idle_robin + 1) % 3; switch (idle_robin) { case 0: topography_dirty = UpdateTopography(1) > 0; break; case 1: terrain_dirty = UpdateTerrain(); break; case 2: weather_dirty = UpdateWeather(); break; } still_dirty = terrain_dirty || topography_dirty || weather_dirty; } while (RenderTimeAvailable() && #ifndef ENABLE_OPENGL !draw_thread->IsTriggered() && #endif still_dirty); return still_dirty; }
/** * This idle function allows progressive scanning of visibility etc */ bool GlueMapWindow::Idle() { if (!render_projection.IsValid()) return false; if (idle_robin == unsigned(-1)) { /* draw the first frame as quickly as possible, so the user can start interacting with XCSoar immediately */ idle_robin = 2; return true; } if (!IsUserIdle(2500)) /* don't hold back the UI thread while the user is interacting */ return true; PeriodClock clock; clock.Update(); bool still_dirty; bool topography_dirty = true; /* scan topography in every Idle() call */ bool terrain_dirty = true; bool weather_dirty = true; do { idle_robin = (idle_robin + 1) % 3; switch (idle_robin) { case 0: topography_dirty = UpdateTopography(1) > 0; break; case 1: terrain_dirty = UpdateTerrain(); break; case 2: weather_dirty = UpdateWeather(); break; } still_dirty = terrain_dirty || topography_dirty || weather_dirty; } while (!clock.Check(700) && /* stop after 700ms */ #ifndef ENABLE_OPENGL !draw_thread->IsTriggered() && #endif IsUserIdle(2500) && still_dirty); return still_dirty; }
void UpdateAll() { UpdateTopography(); UpdateTerrain(); UpdateWeather(); }