po: update French translation
[xcsoar.git] / src / DrawThread.cpp
blob47f367795c77ec5c4ed1c1e3fb0b7249e7b6af6b
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "DrawThread.hpp"
25 #include "MapWindow/GlueMapWindow.hpp"
27 #ifndef ENABLE_OPENGL
29 /**
30 * Main loop of the DrawThread
32 void
33 DrawThread::Run()
35 SetLowPriority();
37 // bounds_dirty maintains the status of whether the map
38 // bounds have changed and there are pending idle calls
39 // to be run in the map.
41 // wait until the startup is finished
42 if (CheckStoppedOrSuspended())
43 return;
45 // Get data from the DeviceBlackboard
46 map.ExchangeBlackboard();
48 bool bounds_dirty = true;
50 // circle until application is closed
51 while (true) {
52 if (!bounds_dirty)
53 trigger.Wait();
55 if (!bounds_dirty || trigger.Wait(MIN_WAIT_TIME)) {
56 /* got the "stop" trigger? */
57 if (CheckStoppedOrSuspended())
58 break;
60 trigger.Reset();
62 if (IsCommandPending()) {
63 /* just in case we got another suspend/stop command after
64 CheckStoppedOrSuspended() returned and before the trigger
65 got reset: restore the trigger and skip this iteration, to
66 fix the race condition */
67 trigger.Signal();
68 continue;
71 // Get data from the DeviceBlackboard
72 map.ExchangeBlackboard();
74 // Draw the moving map
75 map.Repaint();
77 if (trigger.Test()) {
78 // interrupt re-calculation of bounds if there was a
79 // request made. Since we will re-enter, we know the remainder
80 // of this code will be called anyway.
81 continue;
84 bounds_dirty = map.Idle();
85 } else if (bounds_dirty) {
86 /* got the "stop" trigger? */
87 if (CheckStoppedOrSuspended())
88 break;
90 bounds_dirty = map.Idle();
95 #endif