OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_io_surface.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gl/gl_bindings.h" | 8 #include "ui/gl/gl_bindings.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 switch (internalformat) { | 48 switch (internalformat) { |
49 case GL_BGRA8_EXT: | 49 case GL_BGRA8_EXT: |
50 return 'BGRA'; | 50 return 'BGRA'; |
51 default: | 51 default: |
52 NOTREACHED(); | 52 NOTREACHED(); |
53 return 0; | 53 return 0; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 bool GpuMemoryBufferImplIOSurface::InitializeFromHandle( | 57 bool GpuMemoryBufferImplIOSurface::InitializeFromHandle( |
58 gfx::GpuMemoryBufferHandle handle) { | 58 const gfx::GpuMemoryBufferHandle& handle) { |
59 DCHECK(IsFormatSupported(internalformat_)); | 59 DCHECK(IsFormatSupported(internalformat_)); |
60 io_surface_.reset(IOSurfaceLookup(handle.io_surface_id)); | 60 io_surface_.reset(IOSurfaceLookup(handle.io_surface_id)); |
61 if (!io_surface_) { | 61 if (!io_surface_) { |
62 VLOG(1) << "IOSurface lookup failed"; | 62 VLOG(1) << "IOSurface lookup failed"; |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 return true; | 66 return true; |
67 } | 67 } |
68 | 68 |
(...skipping 15 matching lines...) Expand all Loading... |
84 } | 84 } |
85 | 85 |
86 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 86 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
87 gfx::GpuMemoryBufferHandle handle; | 87 gfx::GpuMemoryBufferHandle handle; |
88 handle.type = gfx::IO_SURFACE_BUFFER; | 88 handle.type = gfx::IO_SURFACE_BUFFER; |
89 handle.io_surface_id = IOSurfaceGetID(io_surface_); | 89 handle.io_surface_id = IOSurfaceGetID(io_surface_); |
90 return handle; | 90 return handle; |
91 } | 91 } |
92 | 92 |
93 } // namespace content | 93 } // namespace content |
OLD | NEW |