summaryrefslogtreecommitdiffstats
path: root/o3d/core/cross/client.cc
diff options
context:
space:
mode:
authorkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 01:26:00 +0000
committerkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 01:26:00 +0000
commit8a304130d6d53bae89ae6023e64b261624ed5ddf (patch)
tree1b58beab34926aa5eab2f5b2ce866d9a31a6925a /o3d/core/cross/client.cc
parentb93cc8295f42e55bb2bec5e444918a8cd20da069 (diff)
downloadchromium_src-8a304130d6d53bae89ae6023e64b261624ed5ddf.zip
chromium_src-8a304130d6d53bae89ae6023e64b261624ed5ddf.tar.gz
chromium_src-8a304130d6d53bae89ae6023e64b261624ed5ddf.tar.bz2
Added support for O3D in Chrome on Mac OS X using CoreGraphics drawing
model by rendering offscreen, reading back the frame buffer, and drawing the rendering results into the CGContextRef. This code path is currently Chrome-specific, but could be used for any browser with similar characteristics. This will require refactoring of the drawing and event model selection code, which may be done in a subsequent bug. Changed the RenderSurface APIs to allow the Bitmap for readback to be passed in. Added Client::SetOffscreenRenderingSurfaces so that the entry point Client::RenderClient() can be used unchanged. Fixed problem with plugin_enable_fullscreen_msg gyp variable which needs to be in top-level gypi so #define is consistent throughout project. Fixed minor issue in Cocoa key event handling. Fixed log message causing crashes when render target attachment fails. Chrome currently blacklists the O3D plugin's MIME type, so to enable support for O3D this blacklist entry needs to be removed from Chrome. Ran nearly all O3D samples in Chrome on Mac OS X. There are a couple of failures which will be fixed in subsequent bugs. Also ran samples in Safari and Firefox on Mac and verified no performance regressions. BUG=http://code.google.com/p/o3d/issues/detail?id=215 TEST=ran O3D samples in Chrome, Safari and Firefox Review URL: http://codereview.chromium.org/669220 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41233 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core/cross/client.cc')
-rw-r--r--o3d/core/cross/client.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/o3d/core/cross/client.cc b/o3d/core/cross/client.cc
index a7f5924..c63c940 100644
--- a/o3d/core/cross/client.cc
+++ b/o3d/core/cross/client.cc
@@ -304,7 +304,25 @@ void Client::RenderClient(bool send_callback) {
if (!renderer_.IsAvailable())
return;
- RenderClientInner(true, send_callback);
+ bool have_offscreen_surfaces =
+ !(offscreen_render_surface_.IsNull() ||
+ offscreen_depth_render_surface_.IsNull());
+
+ if (have_offscreen_surfaces) {
+ if (!renderer_->StartRendering()) {
+ return;
+ }
+ renderer_->SetRenderSurfaces(offscreen_render_surface_,
+ offscreen_depth_render_surface_,
+ true);
+ }
+
+ RenderClientInner(!have_offscreen_surfaces, send_callback);
+
+ if (have_offscreen_surfaces) {
+ renderer_->SetRenderSurfaces(NULL, NULL, false);
+ renderer_->FinishRendering();
+ }
}
// Executes draw calls for all visible shapes in a subtree
@@ -503,6 +521,13 @@ String Client::GetMessageQueueAddress() const {
}
}
+void Client::SetOffscreenRenderingSurfaces(
+ RenderSurface::Ref surface,
+ RenderDepthStencilSurface::Ref depth_surface) {
+ offscreen_render_surface_ = surface;
+ offscreen_depth_render_surface_ = depth_surface;
+}
+
// Error Related methods -------------------------------------------------------
void Client::SetErrorCallback(ErrorCallback* callback) {