diff options
Diffstat (limited to 'o3d/plugin')
-rw-r--r-- | o3d/plugin/cross/o3d_glue.cc | 12 | ||||
-rw-r--r-- | o3d/plugin/plugin.gyp | 1 | ||||
-rw-r--r-- | o3d/plugin/win/main_win.cc | 46 |
3 files changed, 52 insertions, 7 deletions
diff --git a/o3d/plugin/cross/o3d_glue.cc b/o3d/plugin/cross/o3d_glue.cc index d041907..c52e242 100644 --- a/o3d/plugin/cross/o3d_glue.cc +++ b/o3d/plugin/cross/o3d_glue.cc @@ -29,7 +29,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include <build/build_config.h> #ifdef OS_WIN #include <windows.h> @@ -40,12 +39,12 @@ #include <algorithm> #include "core/cross/renderer.h" #include "core/cross/client_info.h" +#include "gpu_plugin/np_utils/np_headers.h" #include "plugin/cross/o3d_glue.h" #include "plugin/cross/config.h" #include "plugin/cross/stream_manager.h" #include "client_glue.h" #include "globals_glue.h" -#include "third_party/nixysa/static_glue/npapi/common.h" #ifdef OS_MACOSX #include "plugin_mac.h" @@ -659,14 +658,15 @@ void PluginObject::Resize(int width, int height) { if (prev_width_ != width || prev_height_ != height) { prev_width_ = width; prev_height_ = height; + if (renderer_ && !fullscreen_) { // Tell the renderer and client that our window has been resized. // If we're in fullscreen mode when this happens, we don't want to pass // the information through; the renderer will pick it up when we switch // back to plugin mode. - renderer_->Resize(width, height); + renderer_->Resize(prev_width_, prev_height_); // This is just so that the client can send an event to the user. - client()->SendResizeEvent(width, height, fullscreen_); + client()->SendResizeEvent(prev_width_, prev_height_, fullscreen_); } } } @@ -721,8 +721,8 @@ void PluginObject::RedirectToFile(const char *url) { NPObject *global_object; NPN_GetValue(npp(), NPNVWindowNPObject, &global_object); NPString string; - string.utf8characters = full_cmd.get(); - string.utf8length = strlen(string.utf8characters); + string.UTF8Characters = full_cmd.get(); + string.UTF8Length = strlen(string.UTF8Characters); NPVariant result; bool temp = NPN_Evaluate(npp(), global_object, &string, &result); if (temp) { diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp index 45d3fe2..27248dc 100644 --- a/o3d/plugin/plugin.gyp +++ b/o3d/plugin/plugin.gyp @@ -50,6 +50,7 @@ '../../v8/tools/gyp/v8.gyp:v8', '../core/core.gyp:o3dCore', '../core/core.gyp:o3dCorePlatform', + '../gpu_plugin/gpu_plugin.gyp:np_utils', '../import/archive.gyp:o3dArchive', '../utils/utils.gyp:o3dUtils', '../../native_client/src/shared/imc/imc.gyp:google_nacl_imc', diff --git a/o3d/plugin/win/main_win.cc b/o3d/plugin/win/main_win.cc index 9458819..33561c7 100644 --- a/o3d/plugin/win/main_win.cc +++ b/o3d/plugin/win/main_win.cc @@ -42,6 +42,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/ref_counted.h" #include "core/cross/display_mode.h" #include "core/cross/event.h" #include "plugin/cross/plugin_logging.h" @@ -50,14 +51,32 @@ #include "v8/include/v8.h" #include "breakpad/win/bluescreen_detector.h" +#if defined(RENDERER_CB) +#include "core/cross/command_buffer/renderer_cb.h" +#include "core/cross/command_buffer/display_window_cb.h" +#include "gpu_plugin/command_buffer.h" +#endif + using glue::_o3d::PluginObject; using glue::StreamManager; using o3d::DisplayWindowWindows; using o3d::Event; +#if defined(RENDERER_CB) +using o3d::gpu_plugin::CommandBuffer; +using o3d::gpu_plugin::NPObjectPointer; +#endif + namespace { // The instance handle of the O3D DLL. HINSTANCE g_module_instance; + +// TODO(apatrick): We can have an NPBrowser in the other configurations when we +// move over to gyp. This is just to avoid having to write scons files for +// np_utils. +#if defined(RENDERER_CB) +o3d::gpu_plugin::NPBrowser* g_browser; +#endif } // namespace anonymous #if !defined(O3D_INTERNAL_PLUGIN) @@ -717,6 +736,11 @@ extern "C" { NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs) { HANDLE_CRASHES; + +#if defined(RENDERER_CB) + g_browser = new o3d::gpu_plugin::NPBrowser(browserFuncs); +#endif + NPError retval = InitializeNPNApi(browserFuncs); if (retval != NPERR_NO_ERROR) return retval; return InitializePlugin(); @@ -755,6 +779,11 @@ NPError OSCALL NP_Shutdown(void) { g_bluescreen_detector = NULL; } +#if defined(RENDERER_CB) + delete g_browser; + g_browser = NULL; +#endif + #endif // O3D_INTERNAL_PLUGIN return NPERR_NO_ERROR; @@ -887,11 +916,26 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window) { ::ShowWindow(content_window, SW_SHOW); // create and assign the graphics context +#if defined(RENDERER_CB) + const unsigned int kDefaultCommandBufferSize = 256 << 10; + NPObjectPointer<CommandBuffer> command_buffer = + RendererCBLocal::CreateCommandBuffer(instance, + obj->GetHWnd(), + kDefaultCommandBufferSize); + + DisplayWindowCB default_display; + default_display.set_npp(instance); + default_display.set_command_buffer(command_buffer); + + obj->CreateRenderer(default_display); + obj->renderer()->Resize(window->width, window->height); + obj->client()->Init(); +#else DisplayWindowWindows default_display; default_display.set_hwnd(obj->GetHWnd()); - obj->CreateRenderer(default_display); obj->client()->Init(); +#endif // we set the timer to 10ms or 100fps. At the time of this comment // the renderer does a vsync the max fps it will run will be the refresh |