| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <stdint.h> |
| 6 | 7 |
| 7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" | 8 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "content/plugin/webplugin_proxy.h" | 12 #include "content/plugin/webplugin_proxy.h" |
| 12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 13 #include "ui/surface/accelerated_surface_mac.h" | 14 #include "ui/surface/accelerated_surface_mac.h" |
| 14 #include "ui/surface/transport_dib.h" | 15 #include "ui/surface/transport_dib.h" |
| 15 | 16 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 46 surface_->Destroy(); | 47 surface_->Destroy(); |
| 47 delete surface_; | 48 delete surface_; |
| 48 surface_ = NULL; | 49 surface_ = NULL; |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 | 52 |
| 52 void WebPluginAcceleratedSurfaceProxy::SetSize(const gfx::Size& size) { | 53 void WebPluginAcceleratedSurfaceProxy::SetSize(const gfx::Size& size) { |
| 53 if (!surface_) | 54 if (!surface_) |
| 54 return; | 55 return; |
| 55 | 56 |
| 56 uint32 io_surface_id = surface_->SetSurfaceSize(size); | 57 uint32_t io_surface_id = surface_->SetSurfaceSize(size); |
| 57 // If allocation fails for some reason, still inform the plugin proxy. | 58 // If allocation fails for some reason, still inform the plugin proxy. |
| 58 plugin_proxy_->AcceleratedPluginAllocatedIOSurface( | 59 plugin_proxy_->AcceleratedPluginAllocatedIOSurface( |
| 59 size.width(), size.height(), io_surface_id); | 60 size.width(), size.height(), io_surface_id); |
| 60 } | 61 } |
| 61 | 62 |
| 62 CGLContextObj WebPluginAcceleratedSurfaceProxy::context() { | 63 CGLContextObj WebPluginAcceleratedSurfaceProxy::context() { |
| 63 return surface_ ? surface_->context() : NULL; | 64 return surface_ ? surface_->context() : NULL; |
| 64 } | 65 } |
| 65 | 66 |
| 66 void WebPluginAcceleratedSurfaceProxy::StartDrawing() { | 67 void WebPluginAcceleratedSurfaceProxy::StartDrawing() { |
| 67 if (!surface_) | 68 if (!surface_) |
| 68 return; | 69 return; |
| 69 | 70 |
| 70 surface_->MakeCurrent(); | 71 surface_->MakeCurrent(); |
| 71 surface_->Clear(gfx::Rect(surface_->GetSize())); | 72 surface_->Clear(gfx::Rect(surface_->GetSize())); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { | 75 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { |
| 75 if (!surface_) | 76 if (!surface_) |
| 76 return; | 77 return; |
| 77 | 78 |
| 78 surface_->SwapBuffers(); | 79 surface_->SwapBuffers(); |
| 79 plugin_proxy_->AcceleratedPluginSwappedIOSurface(); | 80 plugin_proxy_->AcceleratedPluginSwappedIOSurface(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace content | 83 } // namespace content |
| OLD | NEW |