Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: webkit/tools/npapi_pepper_test_plugin/pepper_3d_test.cc

Issue 1529005: New experimental Pepper device API.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/tools/npapi_pepper_test_plugin/pepper_3d_test.cc
===================================================================
--- webkit/tools/npapi_pepper_test_plugin/pepper_3d_test.cc (revision 44555)
+++ webkit/tools/npapi_pepper_test_plugin/pepper_3d_test.cc (working copy)
@@ -14,8 +14,13 @@
: PluginTest(id, host_functions),
pepper_extensions_(NULL),
device_3d_(NULL),
+#if defined(ENABLE_NEW_NPDEVICE_API)
+ context_3d_(NULL),
+#endif
pgl_context_(PGL_NO_CONTEXT) {
+#if !defined(ENABLE_NEW_NPDEVICE_API)
memset(&context_3d_, 0, sizeof(context_3d_));
+#endif
esInitContext(&es_context_);
memset(&es_data_, 0, sizeof(es_data_));
@@ -70,6 +75,25 @@
}
// Initialize a 3D context.
+#if defined(ENABLE_NEW_NPDEVICE_API)
+ int32 attrib_list[] = {
+ NP3DAttrib_CommandBufferSize, kCommandBufferSize,
+ NPAttrib_End
+ };
+ if (device_3d_->createContext(id(), 0, attrib_list,
+ reinterpret_cast<NPDeviceContext**>(&context_3d_)) != NPERR_NO_ERROR) {
+ SetError("Could not initialize 3D context");
+ SignalTestCompleted();
+ return;
+ }
+
+ device_3d_->registerCallback(
+ id(),
+ context_3d_,
+ NP3DCallback_Repaint,
+ reinterpret_cast<NPDeviceGenericCallbackPtr>(RepaintCallback),
+ NULL);
+#else
NPDeviceContext3DConfig config;
config.commandBufferSize = kCommandBufferSize;
if (device_3d_->initializeContext(id(), &config, &context_3d_)
@@ -79,6 +103,7 @@
return;
}
context_3d_.repaintCallback = RepaintCallback;
+#endif // ENABLE_NEW_NPDEVICE_API
// Initialize PGL and create a PGL context.
if (!pglInitialize()) {
@@ -86,7 +111,11 @@
SignalTestCompleted();
return;
}
+#if defined(ENABLE_NEW_NPDEVICE_API)
+ pgl_context_ = pglCreateContext(id(), device_3d_, context_3d_);
+#else
pgl_context_ = pglCreateContext(id(), device_3d_, &context_3d_);
+#endif
if (pgl_context_ == PGL_NO_CONTEXT) {
SetError("Could not initialize PGL context");
SignalTestCompleted();
@@ -110,9 +139,15 @@
}
pgl_context_ = PGL_NO_CONTEXT;
+#if defined(ENABLE_NEW_NPDEVICE_API)
+ if (device_3d_->destroyContext(id(), context_3d_) != NPERR_NO_ERROR) {
+ SetError("Could not destroy 3D context");
+ }
+#else
if (device_3d_->destroyContext(id(), &context_3d_) != NPERR_NO_ERROR) {
SetError("Could not destroy 3D context");
}
+#endif
}
void Pepper3DTest::MakeContextCurrent() {

Powered by Google App Engine
This is Rietveld 408576698