Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl.cc

Issue 1024113003: Add multi-planar functions to GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return false; 104 return false;
105 105
106 *stride_in_bytes = s.ValueOrDie(); 106 *stride_in_bytes = s.ValueOrDie();
107 return true; 107 return true;
108 } 108 }
109 109
110 NOTREACHED(); 110 NOTREACHED();
111 return false; 111 return false;
112 } 112 }
113 113
114 // static
115 size_t GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(
116 gfx::GpuMemoryBuffer::Format format) {
117 switch (format) {
118 case gfx::GpuMemoryBuffer::Format::ATC:
119 case gfx::GpuMemoryBuffer::Format::ATCIA:
120 case gfx::GpuMemoryBuffer::Format::DXT1:
121 case gfx::GpuMemoryBuffer::Format::DXT5:
122 case gfx::GpuMemoryBuffer::Format::ETC1:
123 case gfx::GpuMemoryBuffer::Format::RGBA_8888:
124 case gfx::GpuMemoryBuffer::Format::RGBX_8888:
125 case gfx::GpuMemoryBuffer::Format::BGRA_8888:
126 return 1;
127 default:
128 NOTREACHED();
129 return 0;
130 }
131 }
132
114 gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const { 133 gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const {
115 return format_; 134 return format_;
116 } 135 }
117 136
118 bool GpuMemoryBufferImpl::IsMapped() const { 137 bool GpuMemoryBufferImpl::IsMapped() const {
119 return mapped_; 138 return mapped_;
120 } 139 }
121 140
122 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { 141 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() {
123 return reinterpret_cast<ClientBuffer>(this); 142 return reinterpret_cast<ClientBuffer>(this);
124 } 143 }
125 144
126 } // namespace content 145 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl.h ('k') | content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698