History

fix throttled rendering for the 2D display plugin

ZappoMan committed 11 years ago

Commit 6a7f3671 parent 5a442bd9 files · +64 −69Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+24−3
@@ -175,8 +175,6 @@ public: · 174 unmodified lines
175using namespace std;175using namespace std;
176 176
177// Starfield information177// Starfield information
178static uint8_t THROTTLED_IDLE_TIMER_DELAY = 10;
179
180const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB178const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB
181 179
182static QTimer* locationUpdateTimer = NULL;180static QTimer* locationUpdateTimer = NULL;
@@ -737,6 +735,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 554 unmodified lines
737 _keyboardFocusHighlight->setVisible(false);735 _keyboardFocusHighlight->setVisible(false);
738 }736 }
739 });737 });
738
739 connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
740}740}
741 741
742void Application::aboutToQuit() {742void Application::aboutToQuit() {
@@ -2108,8 +2108,11 @@ void Application::idle() { · 1365 unmodified lines
2108 // Once rendering is off on another thread we should be able to have Application::idle run at start(0) in2108 // Once rendering is off on another thread we should be able to have Application::idle run at start(0) in
2109 // perpetuity and not expect events to get backed up.2109 // perpetuity and not expect events to get backed up.
2110 2110
2111 bool isThrottled = getActiveDisplayPlugin()->isThrottled();
2112 static const int THROTTLED_IDLE_TIMER_DELAY = MSECS_PER_SECOND / 15;
2111 static const int IDLE_TIMER_DELAY_MS = 2;2113 static const int IDLE_TIMER_DELAY_MS = 2;
2112 int desiredInterval = getActiveDisplayPlugin()->isThrottled() ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS;2114 int desiredInterval = isThrottled ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS;
2115 //qDebug() << "isThrottled:" << isThrottled << "desiredInterval:" << desiredInterval;
2113 2116
2114 if (idleTimer->interval() != desiredInterval) {2117 if (idleTimer->interval() != desiredInterval) {
2115 idleTimer->start(desiredInterval);2118 idleTimer->start(desiredInterval);
@@ -4612,6 +4615,24 @@ void Application::checkSkeleton() { · 2496 unmodified lines
4612 }4615 }
4613}4616}
4614 4617
4618bool Application::isForeground() {
4619 return _isForeground && !getWindow()->isMinimized();
4620}
4621
4622void Application::activeChanged(Qt::ApplicationState state) {
4623 switch (state) {
4624 case Qt::ApplicationActive:
4625 _isForeground = true;
4626 break;
4627
4628 case Qt::ApplicationSuspended:
4629 case Qt::ApplicationHidden:
4630 case Qt::ApplicationInactive:
4631 default:
4632 _isForeground = false;
4633 break;
4634 }
4635}
4615void Application::showFriendsWindow() {4636void Application::showFriendsWindow() {
4616 const QString FRIENDS_WINDOW_TITLE = "Add/Remove Friends";4637 const QString FRIENDS_WINDOW_TITLE = "Add/Remove Friends";
4617 const QString FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";4638 const QString FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t