From 50b8ee61c46bced3866f2646f37cbf9879d07027 Mon Sep 17 00:00:00 2001 From: "ericu@google.com" Date: Tue, 16 Jun 2009 02:43:24 +0000 Subject: Polish full-screen mode a bit: * Add a just-use-the-current-display-mode flag. * Make the sample use more parts of the API. * Correct the spelling of full-screen as per Google's policy. * Check for valid mode when the user gives it to us. * Expose clearFullscreenClickRegion to JS. * Fix a typo in convolution while I'm in there. Review URL: http://codereview.chromium.org/126034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18477 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/plugin/cross/o3d_glue.cc | 16 ++++++++++++++++ o3d/plugin/cross/o3d_glue.h | 12 +++--------- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'o3d/plugin/cross') diff --git a/o3d/plugin/cross/o3d_glue.cc b/o3d/plugin/cross/o3d_glue.cc index f760e1b..e14bb00 100644 --- a/o3d/plugin/cross/o3d_glue.cc +++ b/o3d/plugin/cross/o3d_glue.cc @@ -669,6 +669,22 @@ int PluginObject::height() const { return 0; } +bool PluginObject::SetFullscreenClickRegion(int x, int y, int width, int height, + int mode_id) { + bool success = false; + o3d::DisplayMode mode; + // Make sure it's a valid ID first. + if (renderer()->GetDisplayMode(mode_id, &mode)) { + fullscreen_region_valid_ = true; + fullscreen_region_x_ = x; + fullscreen_region_y_ = y; + fullscreen_region_width_ = width; + fullscreen_region_height_ = height; + fullscreen_region_mode_id_ = mode_id; + success = true; + } + return success; +} // On Mac there is a different implementation in plugin_mac.mm. #ifndef OS_MACOSX diff --git a/o3d/plugin/cross/o3d_glue.h b/o3d/plugin/cross/o3d_glue.h index ebe2a44..1b49e02 100644 --- a/o3d/plugin/cross/o3d_glue.h +++ b/o3d/plugin/cross/o3d_glue.h @@ -306,15 +306,9 @@ class PluginObject: public NPObject { // user, as this region has no visible marker. The user is also responsible // for updating this region if the plugin gets resized, as we don't know // whether or how to scale it. - void SetFullscreenClickRegion(int x, int y, int width, int height, - int mode_id) { - fullscreen_region_valid_ = true; - fullscreen_region_x_ = x; - fullscreen_region_y_ = y; - fullscreen_region_width_ = width; - fullscreen_region_height_ = height; - fullscreen_region_mode_id_ = mode_id; - } + // Fails if the mode_id supplied isn't valid. Returns true on success. + bool SetFullscreenClickRegion(int x, int y, int width, int height, + int mode_id); void ClearFullscreenClickRegion() { fullscreen_region_valid_ = false; } -- cgit v1.1