summaryrefslogtreecommitdiffstats
path: root/gpu/demos/framework/plugin.cc
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-20 01:20:47 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-20 01:20:47 +0000
commit024e9386c24b862cae3a4cf4bd22fd4651b02cc5 (patch)
tree12f9a2c80e2a142856c1adefc3253f66a491f0bb /gpu/demos/framework/plugin.cc
parent9cf005d236d090fb18d8a5b6c6c630a94e893ef4 (diff)
downloadchromium_src-024e9386c24b862cae3a4cf4bd22fd4651b02cc5.zip
chromium_src-024e9386c24b862cae3a4cf4bd22fd4651b02cc5.tar.gz
chromium_src-024e9386c24b862cae3a4cf4bd22fd4651b02cc5.tar.bz2
Revert 39530 - GPU plugin forwards repaint events to Pepper plugin.
WM_PAINT results in a call to Pepper repaint callback. Implemented WM_ERASEBKGND to prevent flickering on repaint. Implemented PGL_NO_CONTEXT (copied from EGL spec). This is already reviewed by alokp but unfortunately got entangled with this CL. TEST=none BUG=none Review URL: http://codereview.chromium.org/571018 TBR=alokp@chromium.org Review URL: http://codereview.chromium.org/650100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/demos/framework/plugin.cc')
-rw-r--r--gpu/demos/framework/plugin.cc35
1 files changed, 10 insertions, 25 deletions
diff --git a/gpu/demos/framework/plugin.cc b/gpu/demos/framework/plugin.cc
index 9ba01d4..0514f81 100644
--- a/gpu/demos/framework/plugin.cc
+++ b/gpu/demos/framework/plugin.cc
@@ -74,13 +74,8 @@ NPClass plugin_class = {
PluginSetProperty,
};
-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();
+void PaintCallback(void* data) {
+ reinterpret_cast<gpu::demos::Plugin*>(data)->Paint();
}
}
@@ -101,7 +96,7 @@ Plugin::~Plugin() {
// Destroy demo while GL context is current and before it is destroyed.
pglMakeCurrent(pgl_context_);
demo_.reset();
- pglMakeCurrent(PGL_NO_CONTEXT);
+ pglMakeCurrent(NULL);
DestroyContext();
}
@@ -126,22 +121,10 @@ void Plugin::SetWindow(const NPWindow& window) {
if (!pgl_context_) {
CreateContext();
-
- // Schedule first call to Tick.
- if (demo_->IsAnimated())
- g_browser->pluginthreadasynccall(npp_, TickCallback, this);
}
-}
-int32 Plugin::HandleEvent(const NPPepperEvent& event) {
- return 0;
-}
-
-void Plugin::Tick() {
- Paint();
-
- // Schedule another call to Tick.
- g_browser->pluginthreadasynccall(npp_, TickCallback, this);
+ // Schedule the first call to Draw.
+ g_browser->pluginthreadasynccall(npp_, PaintCallback, this);
}
void Plugin::Paint() {
@@ -153,7 +136,10 @@ void Plugin::Paint() {
demo_->Draw();
pglSwapBuffers();
- pglMakeCurrent(PGL_NO_CONTEXT);
+ pglMakeCurrent(NULL);
+
+ // Schedule another call to Paint.
+ g_browser->pluginthreadasynccall(npp_, PaintCallback, this);
}
void Plugin::CreateContext() {
@@ -163,7 +149,6 @@ 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_);
@@ -171,7 +156,7 @@ void Plugin::CreateContext() {
// Initialize demo.
pglMakeCurrent(pgl_context_);
CHECK(demo_->InitGL());
- pglMakeCurrent(PGL_NO_CONTEXT);
+ pglMakeCurrent(NULL);
}
void Plugin::DestroyContext() {