| 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 "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
| 9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 // static | 72 // static |
| 73 GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( | 73 GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( |
| 74 ClientBuffer buffer) { | 74 ClientBuffer buffer) { |
| 75 return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); | 75 return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 size_t GpuMemoryBufferImpl::BytesPerPixel(Format format) { | 79 size_t GpuMemoryBufferImpl::BitsPerPixel(Format format) { |
| 80 switch (format) { | 80 switch (format) { |
| 81 case RGBA_8888: | 81 case RGBA_8888: |
| 82 case RGBX_8888: | 82 case RGBX_8888: |
| 83 case BGRA_8888: | 83 case BGRA_8888: |
| 84 return 32; |
| 85 case ATCIA: |
| 86 case DXT5: |
| 87 return 8; |
| 88 case ATC: |
| 89 case DXT1: |
| 90 case ETC1: |
| 84 return 4; | 91 return 4; |
| 85 } | 92 } |
| 86 | 93 |
| 87 NOTREACHED(); | 94 NOTREACHED(); |
| 88 return 0; | 95 return 0; |
| 89 } | 96 } |
| 90 | 97 |
| 91 gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const { | 98 gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const { |
| 92 return format_; | 99 return format_; |
| 93 } | 100 } |
| 94 | 101 |
| 95 bool GpuMemoryBufferImpl::IsMapped() const { | 102 bool GpuMemoryBufferImpl::IsMapped() const { |
| 96 return mapped_; | 103 return mapped_; |
| 97 } | 104 } |
| 98 | 105 |
| 99 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 106 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
| 100 return reinterpret_cast<ClientBuffer>(this); | 107 return reinterpret_cast<ClientBuffer>(this); |
| 101 } | 108 } |
| 102 | 109 |
| 103 } // namespace content | 110 } // namespace content |
| OLD | NEW |