diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:27:04 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:27:04 +0000 |
commit | 8ceb44c74fc375df749b60acc6fc01b5327c6d18 (patch) | |
tree | 0512ef018e445f45d142e8a79ed4a19b9390b6d3 /gpu/demos/framework/plugin.cc | |
parent | c16b5958cc9a47992e6c24473258582773036af5 (diff) | |
download | chromium_src-8ceb44c74fc375df749b60acc6fc01b5327c6d18.zip chromium_src-8ceb44c74fc375df749b60acc6fc01b5327c6d18.tar.gz chromium_src-8ceb44c74fc375df749b60acc6fc01b5327c6d18.tar.bz2 |
I just put the code that does not compile on ARM. Trybots will fail because I had to remove these from the CL to make gcl upload properly accept it.
A + base\scoped_open_process.h
A + chrome\plugin\command_buffer_stub_win.cc
TEST=try
BUG=none
Review URL: http://codereview.chromium.org/661022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/demos/framework/plugin.cc')
-rw-r--r-- | gpu/demos/framework/plugin.cc | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/gpu/demos/framework/plugin.cc b/gpu/demos/framework/plugin.cc index 0514f81..9ba01d4 100644 --- a/gpu/demos/framework/plugin.cc +++ b/gpu/demos/framework/plugin.cc @@ -74,8 +74,13 @@ NPClass plugin_class = { PluginSetProperty, }; -void PaintCallback(void* data) { - reinterpret_cast<gpu::demos::Plugin*>(data)->Paint(); +void TickCallback(void* data) { + reinterpret_cast<gpu::demos::Plugin*>(data)->Tick(); +} + +void RepaintCallback(NPP npp, NPDeviceContext3D* /* context */) { + Plugin* plugin = static_cast<Plugin*>(npp->pdata); + plugin->Paint(); } } @@ -96,7 +101,7 @@ Plugin::~Plugin() { // Destroy demo while GL context is current and before it is destroyed. pglMakeCurrent(pgl_context_); demo_.reset(); - pglMakeCurrent(NULL); + pglMakeCurrent(PGL_NO_CONTEXT); DestroyContext(); } @@ -121,10 +126,22 @@ void Plugin::SetWindow(const NPWindow& window) { if (!pgl_context_) { CreateContext(); + + // Schedule first call to Tick. + if (demo_->IsAnimated()) + g_browser->pluginthreadasynccall(npp_, TickCallback, this); } +} - // Schedule the first call to Draw. - g_browser->pluginthreadasynccall(npp_, PaintCallback, this); +int32 Plugin::HandleEvent(const NPPepperEvent& event) { + return 0; +} + +void Plugin::Tick() { + Paint(); + + // Schedule another call to Tick. + g_browser->pluginthreadasynccall(npp_, TickCallback, this); } void Plugin::Paint() { @@ -136,10 +153,7 @@ void Plugin::Paint() { demo_->Draw(); pglSwapBuffers(); - pglMakeCurrent(NULL); - - // Schedule another call to Paint. - g_browser->pluginthreadasynccall(npp_, PaintCallback, this); + pglMakeCurrent(PGL_NO_CONTEXT); } void Plugin::CreateContext() { @@ -149,6 +163,7 @@ void Plugin::CreateContext() { NPDeviceContext3DConfig config; config.commandBufferSize = kCommandBufferSize; device3d_->initializeContext(npp_, &config, &context3d_); + context3d_.repaintCallback = RepaintCallback; // Create a PGL context. pgl_context_ = pglCreateContext(npp_, device3d_, &context3d_); @@ -156,7 +171,7 @@ void Plugin::CreateContext() { // Initialize demo. pglMakeCurrent(pgl_context_); CHECK(demo_->InitGL()); - pglMakeCurrent(NULL); + pglMakeCurrent(PGL_NO_CONTEXT); } void Plugin::DestroyContext() { |