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 "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "gpu/ipc/common/android/surface_texture_manager.h" | 10 #include "gpu/ipc/common/android/surface_texture_manager.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 return buffer_.bits; | 128 return buffer_.bits; |
129 } | 129 } |
130 | 130 |
131 void GpuMemoryBufferImplSurfaceTexture::Unmap() { | 131 void GpuMemoryBufferImplSurfaceTexture::Unmap() { |
132 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Unmap"); | 132 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Unmap"); |
133 DCHECK(mapped_); | 133 DCHECK(mapped_); |
134 ANativeWindow_unlockAndPost(native_window_); | 134 ANativeWindow_unlockAndPost(native_window_); |
135 mapped_ = false; | 135 mapped_ = false; |
136 } | 136 } |
137 | 137 |
138 int GpuMemoryBufferImplSurfaceTexture::stride(size_t plane) const { | 138 uint32_t GpuMemoryBufferImplSurfaceTexture::stride(size_t plane) const { |
139 DCHECK(mapped_); | 139 DCHECK(mapped_); |
140 DCHECK_EQ(0u, plane); | 140 DCHECK_EQ(0u, plane); |
141 return gfx::RowSizeForBufferFormat(buffer_.stride, format_, 0); | 141 return gfx::RowSizeForBufferFormat(buffer_.stride, format_, 0); |
142 } | 142 } |
143 | 143 |
144 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() | 144 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() |
145 const { | 145 const { |
146 gfx::GpuMemoryBufferHandle handle; | 146 gfx::GpuMemoryBufferHandle handle; |
147 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 147 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
148 handle.id = id_; | 148 handle.id = id_; |
149 return handle; | 149 return handle; |
150 } | 150 } |
151 | 151 |
152 } // namespace gpu | 152 } // namespace gpu |
OLD | NEW |