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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/common/android/surface_texture_lookup.h" | 9 #include "content/common/android/surface_texture_lookup.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 switch (internalformat) { | 56 switch (internalformat) { |
57 case GL_RGBA8_OES: | 57 case GL_RGBA8_OES: |
58 return WINDOW_FORMAT_RGBA_8888; | 58 return WINDOW_FORMAT_RGBA_8888; |
59 default: | 59 default: |
60 NOTREACHED(); | 60 NOTREACHED(); |
61 return 0; | 61 return 0; |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 bool GpuMemoryBufferImplSurfaceTexture::InitializeFromHandle( | 65 bool GpuMemoryBufferImplSurfaceTexture::InitializeFromHandle( |
66 gfx::GpuMemoryBufferHandle handle) { | 66 const gfx::GpuMemoryBufferHandle& handle) { |
67 TRACE_EVENT0("gpu", | 67 TRACE_EVENT0("gpu", |
68 "GpuMemoryBufferImplSurfaceTexture::InitializeFromHandle"); | 68 "GpuMemoryBufferImplSurfaceTexture::InitializeFromHandle"); |
69 | 69 |
70 DCHECK(IsFormatSupported(internalformat_)); | 70 DCHECK(IsFormatSupported(internalformat_)); |
71 DCHECK(!native_window_); | 71 DCHECK(!native_window_); |
72 native_window_ = SurfaceTextureLookup::GetInstance()->AcquireNativeWidget( | 72 native_window_ = SurfaceTextureLookup::GetInstance()->AcquireNativeWidget( |
73 handle.surface_texture_id.primary_id, | 73 handle.surface_texture_id.primary_id, |
74 handle.surface_texture_id.secondary_id); | 74 handle.surface_texture_id.secondary_id); |
75 if (!native_window_) | 75 if (!native_window_) |
76 return false; | 76 return false; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() | 115 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() |
116 const { | 116 const { |
117 gfx::GpuMemoryBufferHandle handle; | 117 gfx::GpuMemoryBufferHandle handle; |
118 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 118 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
119 handle.surface_texture_id = surface_texture_id_; | 119 handle.surface_texture_id = surface_texture_id_; |
120 return handle; | 120 return handle; |
121 } | 121 } |
122 | 122 |
123 } // namespace content | 123 } // namespace content |
OLD | NEW |