summaryrefslogtreecommitdiffstats
path: root/o3d/core/cross/client.cc
diff options
context:
space:
mode:
authortschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 18:41:14 +0000
committertschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 18:41:14 +0000
commit80d05152e2e6e1e1325f27df0ac54bcac2896648 (patch)
tree9eb62a7614cf00cf5ce729cff74984b2e64b6e0b /o3d/core/cross/client.cc
parent4a1267c6213345bb805fe1f737e9e91fc9ba38e5 (diff)
downloadchromium_src-80d05152e2e6e1e1325f27df0ac54bcac2896648.zip
chromium_src-80d05152e2e6e1e1325f27df0ac54bcac2896648.tar.gz
chromium_src-80d05152e2e6e1e1325f27df0ac54bcac2896648.tar.bz2
Add a new message to allow draw on every new texture within given fps limitation.
Submitting on behalf of zhurunz. Original issue @ http://codereview.chromium.org/1627007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core/cross/client.cc')
-rw-r--r--o3d/core/cross/client.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/o3d/core/cross/client.cc b/o3d/core/cross/client.cc
index c63c940..1785d7e1 100644
--- a/o3d/core/cross/client.cc
+++ b/o3d/core/cross/client.cc
@@ -80,6 +80,9 @@ Client::Client(ServiceLocator* service_locator)
evaluation_counter_(service_locator),
render_tree_called_(false),
render_mode_(RENDERMODE_CONTINUOUS),
+#ifdef O3D_PLUGIN_SUPPORT_SET_MAX_FPS
+ texture_on_hold_(false),
+#endif // O3D_PLUGIN_SUPPORT_SET_MAX_FPS
event_manager_(),
last_tick_time_(0),
root_(NULL),
@@ -188,10 +191,11 @@ bool Client::Tick() {
// Processes any incoming message found in the message queue. Note that this
// call does not block if no new messages are found.
bool message_check_ok = true;
+ bool has_new_texture = false;
if (message_queue_.get()) {
profiler_->ProfileStart("CheckForNewMessages");
- message_check_ok = message_queue_->CheckForNewMessages();
+ message_check_ok = message_queue_->CheckForNewMessages(&has_new_texture);
profiler_->ProfileStop("CheckForNewMessages");
}
@@ -202,6 +206,19 @@ bool Client::Tick() {
last_tick_time_ = timer.GetElapsedTimeAndReset();
+#ifdef O3D_PLUGIN_SUPPORT_SET_MAX_FPS
+ texture_on_hold_ |= has_new_texture;
+ int max_fps = renderer_->max_fps();
+ if (max_fps > 0 &&
+ texture_on_hold_ &&
+ render_mode() == RENDERMODE_ON_DEMAND &&
+ render_elapsed_time_timer_.GetElapsedTimeWithoutClearing()
+ > 1.0/max_fps) {
+ renderer_->set_need_to_render(true);
+ texture_on_hold_ = false;
+ }
+#endif // O3D_PLUGIN_SUPPORT_SET_MAX_FPS
+
return message_check_ok;
}