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_shared_memory.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 case gfx::BufferFormat::YUV_420_BIPLANAR: { | 139 case gfx::BufferFormat::YUV_420_BIPLANAR: { |
140 size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format); | 140 size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format); |
141 for (size_t i = 0; i < num_planes; ++i) { | 141 for (size_t i = 0; i < num_planes; ++i) { |
142 size_t factor = gfx::SubsamplingFactorForBufferFormat(format, i); | 142 size_t factor = gfx::SubsamplingFactorForBufferFormat(format, i); |
143 if (size.width() % factor || size.height() % factor) | 143 if (size.width() % factor || size.height() % factor) |
144 return false; | 144 return false; |
145 } | 145 } |
146 return true; | 146 return true; |
147 } | 147 } |
148 case gfx::BufferFormat::UYVY_422: | 148 case gfx::BufferFormat::UYVY_422: |
| 149 case gfx::BufferFormat::YUYV_422: |
149 return size.width() % 2 == 0; | 150 return size.width() % 2 == 0; |
150 } | 151 } |
151 | 152 |
152 NOTREACHED(); | 153 NOTREACHED(); |
153 return false; | 154 return false; |
154 } | 155 } |
155 | 156 |
156 // static | 157 // static |
157 base::Closure GpuMemoryBufferImplSharedMemory::AllocateForTesting( | 158 base::Closure GpuMemoryBufferImplSharedMemory::AllocateForTesting( |
158 const gfx::Size& size, | 159 const gfx::Size& size, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 gfx::GpuMemoryBufferHandle handle; | 204 gfx::GpuMemoryBufferHandle handle; |
204 handle.type = gfx::SHARED_MEMORY_BUFFER; | 205 handle.type = gfx::SHARED_MEMORY_BUFFER; |
205 handle.id = id_; | 206 handle.id = id_; |
206 handle.offset = offset_; | 207 handle.offset = offset_; |
207 handle.stride = stride_; | 208 handle.stride = stride_; |
208 handle.handle = shared_memory_->handle(); | 209 handle.handle = shared_memory_->handle(); |
209 return handle; | 210 return handle; |
210 } | 211 } |
211 | 212 |
212 } // namespace gpu | 213 } // namespace gpu |
OLD | NEW |