| 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.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/numerics/safe_math.h" | 8 #include "base/numerics/safe_math.h" |
| 9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
| 10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 checked_stride *= 4; | 128 checked_stride *= 4; |
| 129 if (!checked_stride.IsValid()) | 129 if (!checked_stride.IsValid()) |
| 130 return false; | 130 return false; |
| 131 *stride_in_bytes = checked_stride.ValueOrDie(); | 131 *stride_in_bytes = checked_stride.ValueOrDie(); |
| 132 return true; | 132 return true; |
| 133 case YUV_420: | 133 case YUV_420: |
| 134 DCHECK_EQ(width % 2, 0u); | 134 DCHECK_EQ(width % 2, 0u); |
| 135 *stride_in_bytes = width / SubsamplingFactor(format, plane); | 135 *stride_in_bytes = width / SubsamplingFactor(format, plane); |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | |
| 139 NOTREACHED(); | 138 NOTREACHED(); |
| 140 return false; | 139 return false; |
| 141 } | 140 } |
| 142 | 141 |
| 143 // static | 142 // static |
| 144 size_t GpuMemoryBufferImpl::SubsamplingFactor( | 143 size_t GpuMemoryBufferImpl::SubsamplingFactor( |
| 145 Format format, | 144 Format format, |
| 146 int plane) { | 145 int plane) { |
| 147 switch (format) { | 146 switch (format) { |
| 148 case ATC: | 147 case ATC: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 171 | 170 |
| 172 bool GpuMemoryBufferImpl::IsMapped() const { | 171 bool GpuMemoryBufferImpl::IsMapped() const { |
| 173 return mapped_; | 172 return mapped_; |
| 174 } | 173 } |
| 175 | 174 |
| 176 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 175 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
| 177 return reinterpret_cast<ClientBuffer>(this); | 176 return reinterpret_cast<ClientBuffer>(this); |
| 178 } | 177 } |
| 179 | 178 |
| 180 } // namespace content | 179 } // namespace content |
| OLD | NEW |