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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // by the block size. | 128 // by the block size. |
129 return size.width() % 4 == 0 && size.height() % 4 == 0; | 129 return size.width() % 4 == 0 && size.height() % 4 == 0; |
130 case gfx::BufferFormat::R_8: | 130 case gfx::BufferFormat::R_8: |
131 case gfx::BufferFormat::RG_88: | 131 case gfx::BufferFormat::RG_88: |
132 case gfx::BufferFormat::BGR_565: | 132 case gfx::BufferFormat::BGR_565: |
133 case gfx::BufferFormat::RGBA_4444: | 133 case gfx::BufferFormat::RGBA_4444: |
134 case gfx::BufferFormat::RGBA_8888: | 134 case gfx::BufferFormat::RGBA_8888: |
135 case gfx::BufferFormat::RGBX_8888: | 135 case gfx::BufferFormat::RGBX_8888: |
136 case gfx::BufferFormat::BGRA_8888: | 136 case gfx::BufferFormat::BGRA_8888: |
137 case gfx::BufferFormat::BGRX_8888: | 137 case gfx::BufferFormat::BGRX_8888: |
| 138 case gfx::BufferFormat::RGBA_F16: |
138 return true; | 139 return true; |
139 case gfx::BufferFormat::YVU_420: | 140 case gfx::BufferFormat::YVU_420: |
140 case gfx::BufferFormat::YUV_420_BIPLANAR: { | 141 case gfx::BufferFormat::YUV_420_BIPLANAR: { |
141 size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format); | 142 size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format); |
142 for (size_t i = 0; i < num_planes; ++i) { | 143 for (size_t i = 0; i < num_planes; ++i) { |
143 size_t factor = gfx::SubsamplingFactorForBufferFormat(format, i); | 144 size_t factor = gfx::SubsamplingFactorForBufferFormat(format, i); |
144 if (size.width() % factor || size.height() % factor) | 145 if (size.width() % factor || size.height() % factor) |
145 return false; | 146 return false; |
146 } | 147 } |
147 return true; | 148 return true; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 gfx::GpuMemoryBufferHandle handle; | 205 gfx::GpuMemoryBufferHandle handle; |
205 handle.type = gfx::SHARED_MEMORY_BUFFER; | 206 handle.type = gfx::SHARED_MEMORY_BUFFER; |
206 handle.id = id_; | 207 handle.id = id_; |
207 handle.offset = offset_; | 208 handle.offset = offset_; |
208 handle.stride = stride_; | 209 handle.stride = stride_; |
209 handle.handle = shared_memory_->handle(); | 210 handle.handle = shared_memory_->handle(); |
210 return handle; | 211 return handle; |
211 } | 212 } |
212 | 213 |
213 } // namespace gpu | 214 } // namespace gpu |
OLD | NEW |