| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "content/common/android/surface_texture_manager.h" | 9 #include "content/common/android/surface_texture_manager.h" |
| 10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ANativeWindow_release(native_window_); | 51 ANativeWindow_release(native_window_); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 scoped_ptr<GpuMemoryBufferImpl> | 55 scoped_ptr<GpuMemoryBufferImpl> |
| 56 GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( | 56 GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( |
| 57 const gfx::GpuMemoryBufferHandle& handle, | 57 const gfx::GpuMemoryBufferHandle& handle, |
| 58 const gfx::Size& size, | 58 const gfx::Size& size, |
| 59 gfx::BufferFormat format, | 59 gfx::BufferFormat format, |
| 60 const DestructionCallback& callback) { | 60 const DestructionCallback& callback) { |
| 61 ANativeWindow* native_window = SurfaceTextureManager::GetInstance()-> | 61 ANativeWindow* native_window = |
| 62 AcquireNativeWidgetForSurfaceTexture(handle.id); | 62 SurfaceTextureManager::GetInstance() |
| 63 ->AcquireNativeWidgetForSurfaceTexture(handle.id.id); |
| 63 if (!native_window) | 64 if (!native_window) |
| 64 return scoped_ptr<GpuMemoryBufferImpl>(); | 65 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 65 | 66 |
| 66 ANativeWindow_setBuffersGeometry( | 67 ANativeWindow_setBuffersGeometry( |
| 67 native_window, size.width(), size.height(), WindowFormat(format)); | 68 native_window, size.width(), size.height(), WindowFormat(format)); |
| 68 | 69 |
| 69 return make_scoped_ptr<GpuMemoryBufferImpl>( | 70 return make_scoped_ptr<GpuMemoryBufferImpl>( |
| 70 new GpuMemoryBufferImplSurfaceTexture( | 71 new GpuMemoryBufferImplSurfaceTexture( |
| 71 handle.id, size, format, callback, native_window)); | 72 handle.id, size, format, callback, native_window)); |
| 72 } | 73 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 110 |
| 110 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() | 111 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() |
| 111 const { | 112 const { |
| 112 gfx::GpuMemoryBufferHandle handle; | 113 gfx::GpuMemoryBufferHandle handle; |
| 113 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 114 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
| 114 handle.id = id_; | 115 handle.id = id_; |
| 115 return handle; | 116 return handle; |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace content | 119 } // namespace content |
| OLD | NEW |