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

Side by Side Diff: gpu/demos/framework/pepper.cc

Issue 7782020: Revert 99855 - Move PPAPI graphics3d and opengles interfaces out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | ppapi/c/dev/pp_graphics_3d_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 6
7 #include "gpu/demos/framework/demo.h" 7 #include "gpu/demos/framework/demo.h"
8 #include "gpu/demos/framework/demo_factory.h" 8 #include "gpu/demos/framework/demo_factory.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/graphics_3d.h"
11 #include "ppapi/cpp/instance.h" 10 #include "ppapi/cpp/instance.h"
12 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module.h"
13 #include "ppapi/cpp/rect.h" 12 #include "ppapi/cpp/rect.h"
14 #include "ppapi/cpp/size.h" 13 #include "ppapi/cpp/size.h"
14 #include "ppapi/cpp/dev/graphics_3d_dev.h"
15 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h" 15 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
16 16
17 namespace gpu { 17 namespace gpu {
18 namespace demos { 18 namespace demos {
19 19
20 class PluginInstance : public pp::Instance { 20 class PluginInstance : public pp::Instance {
21 public: 21 public:
22 PluginInstance(PP_Instance instance, pp::Module* module) 22 PluginInstance(PP_Instance instance, pp::Module* module)
23 : pp::Instance(instance), 23 : pp::Instance(instance),
24 module_(module), 24 module_(module),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int32_t attribs[] = { 81 int32_t attribs[] = {
82 PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, 82 PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
83 PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, 83 PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
84 PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, 84 PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
85 PP_GRAPHICS3DATTRIB_SAMPLES, 0, 85 PP_GRAPHICS3DATTRIB_SAMPLES, 0,
86 PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, 86 PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0,
87 PP_GRAPHICS3DATTRIB_WIDTH, size_.width(), 87 PP_GRAPHICS3DATTRIB_WIDTH, size_.width(),
88 PP_GRAPHICS3DATTRIB_HEIGHT, size_.height(), 88 PP_GRAPHICS3DATTRIB_HEIGHT, size_.height(),
89 PP_GRAPHICS3DATTRIB_NONE 89 PP_GRAPHICS3DATTRIB_NONE
90 }; 90 };
91 context_ = pp::Graphics3D(*this, pp::Graphics3D(), attribs); 91 context_ = pp::Graphics3D_Dev(*this, pp::Graphics3D_Dev(), attribs);
92 if (context_.is_null()) 92 if (context_.is_null())
93 return; 93 return;
94 94
95 pp::Instance::BindGraphics(context_); 95 pp::Instance::BindGraphics(context_);
96 96
97 glSetCurrentContextPPAPI(context_.pp_resource()); 97 glSetCurrentContextPPAPI(context_.pp_resource());
98 demo_->InitGL(); 98 demo_->InitGL();
99 demo_->Resize(size_.width(), size_.height()); 99 demo_->Resize(size_.width(), size_.height());
100 glSetCurrentContextPPAPI(0); 100 glSetCurrentContextPPAPI(0);
101 } 101 }
102 102
103 void OnSwap(int32_t) { 103 void OnSwap(int32_t) {
104 swap_pending_ = false; 104 swap_pending_ = false;
105 if (paint_needed_ || demo_->IsAnimated()) { 105 if (paint_needed_ || demo_->IsAnimated()) {
106 paint_needed_ = false; 106 paint_needed_ = false;
107 Paint(); 107 Paint();
108 } 108 }
109 } 109 }
110 110
111 pp::Module* module_; 111 pp::Module* module_;
112 Demo* demo_; 112 Demo* demo_;
113 pp::Graphics3D context_; 113 pp::Graphics3D_Dev context_;
114 pp::Size size_; 114 pp::Size size_;
115 bool swap_pending_; 115 bool swap_pending_;
116 bool paint_needed_; 116 bool paint_needed_;
117 bool resize_needed_; 117 bool resize_needed_;
118 pp::CompletionCallbackFactory<PluginInstance> callback_factory_; 118 pp::CompletionCallbackFactory<PluginInstance> callback_factory_;
119 }; 119 };
120 120
121 class PluginModule : public pp::Module { 121 class PluginModule : public pp::Module {
122 public: 122 public:
123 PluginModule() {} 123 PluginModule() {}
(...skipping 14 matching lines...) Expand all
138 } // namespace gpu 138 } // namespace gpu
139 139
140 namespace pp { 140 namespace pp {
141 141
142 Module* CreateModule() { 142 Module* CreateModule() {
143 return new gpu::demos::PluginModule(); 143 return new gpu::demos::PluginModule();
144 } 144 }
145 145
146 } // namespace pp 146 } // namespace pp
147 147
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | ppapi/c/dev/pp_graphics_3d_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698