OLD | NEW |
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 "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
9 #include "webkit/plugins/ppapi/plugin_module.h" | 9 #include "webkit/plugins/ppapi/plugin_module.h" |
10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::FlushSyncFast( | 135 PP_Graphics3DTrustedState PPB_Graphics3D_Impl::FlushSyncFast( |
136 int32_t put_offset, | 136 int32_t put_offset, |
137 int32_t last_known_get) { | 137 int32_t last_known_get) { |
138 return PPStateFromGPUState( | 138 return PPStateFromGPUState( |
139 GetCommandBuffer()->FlushSync(put_offset, last_known_get)); | 139 GetCommandBuffer()->FlushSync(put_offset, last_known_get)); |
140 } | 140 } |
141 | 141 |
142 bool PPB_Graphics3D_Impl::BindToInstance(bool bind) { | 142 bool PPB_Graphics3D_Impl::BindToInstance(bool bind) { |
143 bound_to_instance_ = bind; | 143 bound_to_instance_ = bind; |
| 144 if (bind && gles2_impl()) { |
| 145 // Resize the backing texture to the size of the instance when it is bound. |
| 146 // TODO(alokp): This should be the responsibility of plugins. |
| 147 const gfx::Size& size = instance()->position().size(); |
| 148 gles2_impl()->ResizeCHROMIUM(size.width(), size.height()); |
| 149 } |
144 return true; | 150 return true; |
145 } | 151 } |
146 | 152 |
147 unsigned int PPB_Graphics3D_Impl::GetBackingTextureId() { | 153 unsigned int PPB_Graphics3D_Impl::GetBackingTextureId() { |
148 return platform_context_->GetBackingTextureId(); | 154 return platform_context_->GetBackingTextureId(); |
149 } | 155 } |
150 | 156 |
151 void PPB_Graphics3D_Impl::ViewInitiatedPaint() { | 157 void PPB_Graphics3D_Impl::ViewInitiatedPaint() { |
152 } | 158 } |
153 | 159 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 const PPP_Graphics3D_Dev* ppp_graphics_3d = | 249 const PPP_Graphics3D_Dev* ppp_graphics_3d = |
244 static_cast<const PPP_Graphics3D_Dev*>( | 250 static_cast<const PPP_Graphics3D_Dev*>( |
245 instance()->module()->GetPluginInterface( | 251 instance()->module()->GetPluginInterface( |
246 PPP_GRAPHICS_3D_DEV_INTERFACE)); | 252 PPP_GRAPHICS_3D_DEV_INTERFACE)); |
247 if (ppp_graphics_3d) | 253 if (ppp_graphics_3d) |
248 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); | 254 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); |
249 } | 255 } |
250 | 256 |
251 } // namespace ppapi | 257 } // namespace ppapi |
252 } // namespace webkit | 258 } // namespace webkit |
OLD | NEW |