OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #define PEPPER_APIS_ENABLED 1 | 5 #define PEPPER_APIS_ENABLED 1 |
6 | 6 |
7 #include "chrome/renderer/webplugin_delegate_pepper.h" | 7 #include "chrome/renderer/webplugin_delegate_pepper.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 SkBitmap new_committed; | 145 SkBitmap new_committed; |
146 new_committed.setConfig(SkBitmap::kARGB_8888_Config, | 146 new_committed.setConfig(SkBitmap::kARGB_8888_Config, |
147 window_rect_.width(), window_rect.height()); | 147 window_rect_.width(), window_rect.height()); |
148 new_committed.allocPixels(); | 148 new_committed.allocPixels(); |
149 committed_bitmap_ = new_committed; | 149 committed_bitmap_ = new_committed; |
150 | 150 |
151 // Forward the new geometry to the nested plugin instance. | 151 // Forward the new geometry to the nested plugin instance. |
152 if (nested_delegate_) | 152 if (nested_delegate_) |
153 nested_delegate_->UpdateGeometry(window_rect, clip_rect); | 153 nested_delegate_->UpdateGeometry(window_rect, clip_rect); |
154 | 154 |
| 155 #if defined(ENABLE_GPU) |
| 156 #if defined(OS_MACOSX) |
| 157 // Send the new window size to the command buffer service code so it |
| 158 // can allocate a new backing store. The handle to the new backing |
| 159 // store is sent back to the browser asynchronously. |
| 160 if (command_buffer_.get()) { |
| 161 command_buffer_->SetWindowSize(window_rect_.width(), |
| 162 window_rect_.height()); |
| 163 } |
| 164 #endif // OS_MACOSX |
| 165 #endif // ENABLE_GPU |
| 166 |
155 if (!instance()) | 167 if (!instance()) |
156 return; | 168 return; |
157 | 169 |
158 // TODO(sehr): do we need all this? | 170 // TODO(sehr): do we need all this? |
159 window_.clipRect.top = clip_rect_.y(); | 171 window_.clipRect.top = clip_rect_.y(); |
160 window_.clipRect.left = clip_rect_.x(); | 172 window_.clipRect.left = clip_rect_.x(); |
161 window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); | 173 window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); |
162 window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); | 174 window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); |
163 window_.height = window_rect_.height(); | 175 window_.height = window_rect_.height(); |
164 window_.width = window_rect_.width(); | 176 window_.width = window_rect_.width(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 355 |
344 // Initialize the 3D context. | 356 // Initialize the 3D context. |
345 context->reserved = NULL; | 357 context->reserved = NULL; |
346 Buffer ring_buffer = command_buffer_->GetRingBuffer(); | 358 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
347 context->commandBuffer = ring_buffer.ptr; | 359 context->commandBuffer = ring_buffer.ptr; |
348 context->commandBufferSize = state.size; | 360 context->commandBufferSize = state.size; |
349 Synchronize3DContext(context, state); | 361 Synchronize3DContext(context, state); |
350 | 362 |
351 // Ensure the service knows the window size before rendering anything. | 363 // Ensure the service knows the window size before rendering anything. |
352 nested_delegate_->UpdateGeometry(window_rect_, clip_rect_); | 364 nested_delegate_->UpdateGeometry(window_rect_, clip_rect_); |
| 365 #if defined(OS_MACOSX) |
| 366 command_buffer_->SetWindowSize(window_rect_.width(), |
| 367 window_rect_.height()); |
| 368 #endif // OS_MACOSX |
353 // Save the implementation information (the CommandBuffer). | 369 // Save the implementation information (the CommandBuffer). |
354 Device3DImpl* impl = new Device3DImpl; | 370 Device3DImpl* impl = new Device3DImpl; |
355 impl->command_buffer = command_buffer_.get(); | 371 impl->command_buffer = command_buffer_.get(); |
356 context->reserved = impl; | 372 context->reserved = impl; |
357 | 373 |
358 return NPERR_NO_ERROR; | 374 return NPERR_NO_ERROR; |
359 } | 375 } |
360 } | 376 } |
361 | 377 |
362 command_buffer_.reset(); | 378 command_buffer_.reset(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 #if defined(ENABLE_GPU) | 712 #if defined(ENABLE_GPU) |
697 void WebPluginDelegatePepper::Synchronize3DContext( | 713 void WebPluginDelegatePepper::Synchronize3DContext( |
698 NPDeviceContext3D* context, | 714 NPDeviceContext3D* context, |
699 gpu::CommandBuffer::State state) { | 715 gpu::CommandBuffer::State state) { |
700 context->getOffset = state.get_offset; | 716 context->getOffset = state.get_offset; |
701 context->putOffset = state.put_offset; | 717 context->putOffset = state.put_offset; |
702 context->token = state.token; | 718 context->token = state.token; |
703 context->error = static_cast<NPDeviceContext3DError>(state.error); | 719 context->error = static_cast<NPDeviceContext3DError>(state.error); |
704 } | 720 } |
705 #endif // ENABLE_GPU | 721 #endif // ENABLE_GPU |
OLD | NEW |