diff options
author | tschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 00:04:18 +0000 |
---|---|---|
committer | tschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 00:04:18 +0000 |
commit | 316b50f28156e2d6a33f874a83cb07b25850d322 (patch) | |
tree | 9ef14cf8538174f3463b3debe4d0d1d883ba51bf /o3d | |
parent | 8069898eb2c5511ed83ed6677380f14cfd04d3a0 (diff) | |
download | chromium_src-316b50f28156e2d6a33f874a83cb07b25850d322.zip chromium_src-316b50f28156e2d6a33f874a83cb07b25850d322.tar.gz chromium_src-316b50f28156e2d6a33f874a83cb07b25850d322.tar.bz2 |
Fix ON_DEMAND_RENDER mode on Mac OSX.
Submitting on behalf of pthatcher@google.com
Review URL: http://codereview.chromium.org/5843001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/cross/client.cc | 4 | ||||
-rw-r--r-- | o3d/core/cross/client.h | 3 | ||||
-rw-r--r-- | o3d/plugin/linux/main_linux.cc | 8 | ||||
-rw-r--r-- | o3d/plugin/mac/o3d_layer.mm | 1 | ||||
-rw-r--r-- | o3d/plugin/mac/plugin_mac.mm | 8 |
5 files changed, 14 insertions, 10 deletions
diff --git a/o3d/core/cross/client.cc b/o3d/core/cross/client.cc index a4160df..2d4a644 100644 --- a/o3d/core/cross/client.cc +++ b/o3d/core/cross/client.cc @@ -386,6 +386,10 @@ bool Client::IsRendering() { return (renderer_.IsAvailable() && renderer_->rendering()); } +bool Client::NeedsRender() { + return NeedsContinuousRender() || renderer_->need_to_render(); +} + bool Client::NeedsContinuousRender() { bool needRender = false; // Only may happen in RENDERMODE_CONTINUOUS mode. diff --git a/o3d/core/cross/client.h b/o3d/core/cross/client.h index eebc586..19cc45e 100644 --- a/o3d/core/cross/client.h +++ b/o3d/core/cross/client.h @@ -264,6 +264,9 @@ class Client { // the plugin to become reentrant. Detect this at a higher level. bool IsRendering(); + // Needs either ONDEMAND or CONTINOUS render. + bool NeedsRender(); + // If Renderer::max_fps has been set in RENDERMODE_CONTINUOUS mode, we don't // draw on each tick but just let new textures drive the rendering. There is // only one exception: if we haven't received any new textures for a while, we diff --git a/o3d/plugin/linux/main_linux.cc b/o3d/plugin/linux/main_linux.cc index 846acc6..767dad7 100644 --- a/o3d/plugin/linux/main_linux.cc +++ b/o3d/plugin/linux/main_linux.cc @@ -82,9 +82,7 @@ void LinuxTimer(XtPointer data, XtIntervalId* id) { obj->client()->Tick(); obj->draw_ = true; if (obj->renderer()) { - if (obj->client()->NeedsContinuousRender() || - obj->renderer()->need_to_render()) { - + if (obj->client()->NeedsRender()) { // NOTE: this draws no matter what instead of just invalidating the // region, which means it will execute even if the plug-in window is // invisible. @@ -605,9 +603,7 @@ static gboolean GtkTimeoutCallback(gpointer user_data) { obj->draw_ = true; obj->client()->Tick(); if (obj->renderer()) { - if (obj->client()->NeedsContinuousRender() || - obj->renderer()->need_to_render()) { - + if (obj->client()->NeedsRender()) { GtkWidget *widget; if (obj->fullscreen()) { widget = obj->gtk_fullscreen_container_; diff --git a/o3d/plugin/mac/o3d_layer.mm b/o3d/plugin/mac/o3d_layer.mm index f872603..05364ab3 100644 --- a/o3d/plugin/mac/o3d_layer.mm +++ b/o3d/plugin/mac/o3d_layer.mm @@ -96,7 +96,6 @@ using o3d::DisplayWindowMac; if (obj_) { - obj_->client()->Tick(); obj_->client()->RenderClient(true); } diff --git a/o3d/plugin/mac/plugin_mac.mm b/o3d/plugin/mac/plugin_mac.mm index 58195a2..9fb57a5 100644 --- a/o3d/plugin/mac/plugin_mac.mm +++ b/o3d/plugin/mac/plugin_mac.mm @@ -251,7 +251,10 @@ void RenderTimer::TimerCallback(CFRunLoopTimerRef timer, void* info) { O3DLayer* o3dLayer = static_cast<O3DLayer*>(obj->gl_layer_); if (o3dLayer) { obj->client()->Tick(); - [o3dLayer setNeedsDisplay]; + + if (obj->client()->NeedsRender()) { + [o3dLayer setNeedsDisplay]; + } } continue; } @@ -280,8 +283,7 @@ void RenderTimer::TimerCallback(CFRunLoopTimerRef timer, void* info) { obj->IsOffscreenRenderingEnabled(); if (plugin_visible && obj->renderer()) { - if (obj->client()->NeedsContinuousRender() || - obj->renderer()->need_to_render()) { + if (obj->client()->NeedsRender()) { // Force a sync to the VBL (once per timer callback) // to avoid tearing GLint sync = (i == 0); |