summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
authortschmelcher@google.com <tschmelcher@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 01:18:33 +0000
committertschmelcher@google.com <tschmelcher@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 01:18:33 +0000
commitb4b294118ecb4c959d68f8998d825196d87dd248 (patch)
tree127aaae9a52bba9bb6ec3bba544a684923f8a06d /o3d/plugin
parent459e32f2cd2a693b38b6f1d2967b7624bbbfeab9 (diff)
downloadchromium_src-b4b294118ecb4c959d68f8998d825196d87dd248.zip
chromium_src-b4b294118ecb4c959d68f8998d825196d87dd248.tar.gz
chromium_src-b4b294118ecb4c959d68f8998d825196d87dd248.tar.bz2
O2D Mac FF: Fix issue where we sometimes rendered a single frame to the wrong spot on-screen. This occurred because FF sometimes changes our CGContextRef and then changes it back again, and we weren't updating the renderer with the changes when using the Carbon event model, so we briefly rendered to the wrong CGContextRef.
TEST=O2D in FF BUG=none Review URL: http://codereview.chromium.org/6650013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin')
-rw-r--r--o3d/plugin/mac/main_mac.mm18
1 files changed, 16 insertions, 2 deletions
diff --git a/o3d/plugin/mac/main_mac.mm b/o3d/plugin/mac/main_mac.mm
index eb08571..1d53afd 100644
--- a/o3d/plugin/mac/main_mac.mm
+++ b/o3d/plugin/mac/main_mac.mm
@@ -977,6 +977,8 @@ NPError PlatformNPPSetWindow(NPP instance,
obj->last_plugin_loc_.h = window->x;
obj->last_plugin_loc_.v = window->y;
+ bool mac_cg_context_ref_changed = false;
+
switch (obj->drawing_model_) {
case NPDrawingModelCoreAnimation: {
O3DLayer* o3dLayer = ObjO3DLayer(obj);
@@ -995,7 +997,11 @@ NPError PlatformNPPSetWindow(NPP instance,
} else {
new_window = static_cast<OpaqueWindowPtr*>(np_cg->window);
}
- obj->mac_cg_context_ref_ = np_cg->context;
+ CGContextRef new_mac_cg_context_ref = np_cg->context;
+ if (new_mac_cg_context_ref != obj->mac_cg_context_ref_) {
+ obj->mac_cg_context_ref_ = new_mac_cg_context_ref;
+ mac_cg_context_ref_changed = true;
+ }
}
break;
}
@@ -1196,7 +1202,8 @@ NPError PlatformNPPSetWindow(NPP instance,
window->clipRect.right == 0);
if (is_empty_cliprect && (!is_null_cliprect) &&
- had_a_window && (!window_changed) && !obj->ScrollIsInProgress()) {
+ had_a_window && (!window_changed) && !obj->ScrollIsInProgress() &&
+ !mac_cg_context_ref_changed) {
return NPERR_NO_ERROR;
}
@@ -1252,6 +1259,13 @@ NPError PlatformNPPSetWindow(NPP instance,
if (!obj->renderer()->SupportsCoreGraphics()) {
obj->EnableOffscreenRendering();
}
+ if (mac_cg_context_ref_changed) {
+ o3d::DisplayWindowMac display;
+ display.set_agl_context(obj->mac_agl_context_);
+ display.set_cgl_context(obj->mac_cgl_context_);
+ display.set_cg_context_ref(obj->mac_cg_context_ref_);
+ obj->renderer()->ChangeDisplayWindow(display);
+ }
obj->Resize(window->width, window->height);
} else if (had_a_window) {
obj->renderer()->SetClientOriginOffset(gl_x_origin, gl_y_origin);