| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <OpenGL/OpenGL.h> | 5 #import <OpenGL/OpenGL.h> |
| 6 | 6 |
| 7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" | 7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" |
| 8 | 8 |
| 9 #include "app/surface/accelerated_surface_mac.h" | 9 #include "app/surface/accelerated_surface_mac.h" |
| 10 #include "app/surface/transport_dib.h" | 10 #include "app/surface/transport_dib.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void WebPluginAcceleratedSurfaceProxy::SetSize(const gfx::Size& size) { | 45 void WebPluginAcceleratedSurfaceProxy::SetSize(const gfx::Size& size) { |
| 46 if (!surface_) | 46 if (!surface_) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 uint64 io_surface_id = surface_->SetSurfaceSize(size); | 49 uint64 io_surface_id = surface_->SetSurfaceSize(size); |
| 50 if (io_surface_id) { | 50 if (io_surface_id) { |
| 51 plugin_proxy_->SetAcceleratedSurface(window_handle_, size, io_surface_id); | 51 plugin_proxy_->SetAcceleratedSurface(window_handle_, size, io_surface_id); |
| 52 } else { | 52 } else { |
| 53 TransportDIB::Handle transport_dib = surface_->SetTransportDIBSize(size); | 53 TransportDIB::Handle transport_dib = surface_->SetTransportDIBSize(size); |
| 54 if (TransportDIB::is_valid(transport_dib)) { | 54 if (TransportDIB::is_valid_handle(transport_dib)) { |
| 55 plugin_proxy_->SetAcceleratedDIB(window_handle_, size, transport_dib); | 55 plugin_proxy_->SetAcceleratedDIB(window_handle_, size, transport_dib); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 CGLContextObj WebPluginAcceleratedSurfaceProxy::context() { | 60 CGLContextObj WebPluginAcceleratedSurfaceProxy::context() { |
| 61 return surface_ ? surface_->context() : NULL; | 61 return surface_ ? surface_->context() : NULL; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void WebPluginAcceleratedSurfaceProxy::StartDrawing() { | 64 void WebPluginAcceleratedSurfaceProxy::StartDrawing() { |
| 65 if (!surface_) | 65 if (!surface_) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 surface_->MakeCurrent(); | 68 surface_->MakeCurrent(); |
| 69 surface_->Clear(gfx::Rect(surface_->GetSize())); | 69 surface_->Clear(gfx::Rect(surface_->GetSize())); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { | 72 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { |
| 73 if (!surface_) | 73 if (!surface_) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 surface_->SwapBuffers(); | 76 surface_->SwapBuffers(); |
| 77 plugin_proxy_->AcceleratedFrameBuffersDidSwap( | 77 plugin_proxy_->AcceleratedFrameBuffersDidSwap( |
| 78 window_handle_, surface_->GetSurfaceId()); | 78 window_handle_, surface_->GetSurfaceId()); |
| 79 } | 79 } |
| OLD | NEW |