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

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

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 10 matching lines...) Expand all
21 switch (internalformat) { 21 switch (internalformat) {
22 case GL_BGRA8_EXT: 22 case GL_BGRA8_EXT:
23 case GL_RGBA8_OES: 23 case GL_RGBA8_OES:
24 return true; 24 return true;
25 default: 25 default:
26 return false; 26 return false;
27 } 27 }
28 } 28 }
29 29
30 // static 30 // static
31 bool GpuMemoryBufferImpl::IsUsageValid(unsigned usage) {
32 switch (usage) {
33 case GL_IMAGE_MAP_CHROMIUM:
34 case GL_IMAGE_SCANOUT_CHROMIUM:
35 return true;
36 default:
37 return false;
38 }
39 }
40
41 // static
42 bool GpuMemoryBufferImpl::IsUsageSupportedForSharedMemory(unsigned usage) {
43 switch (usage) {
44 case GL_IMAGE_MAP_CHROMIUM:
45 return true;
46 default:
47 return false;
48 }
49 }
50
51 // static
31 size_t GpuMemoryBufferImpl::BytesPerPixel(unsigned internalformat) { 52 size_t GpuMemoryBufferImpl::BytesPerPixel(unsigned internalformat) {
32 switch (internalformat) { 53 switch (internalformat) {
33 case GL_BGRA8_EXT: 54 case GL_BGRA8_EXT:
34 case GL_RGBA8_OES: 55 case GL_RGBA8_OES:
35 return 4; 56 return 4;
36 default: 57 default:
37 NOTREACHED(); 58 NOTREACHED();
38 return 0; 59 return 0;
39 } 60 }
40 } 61 }
41 62
42 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; } 63 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; }
43 64
44 uint32 GpuMemoryBufferImpl::GetStride() const { 65 uint32 GpuMemoryBufferImpl::GetStride() const {
45 return size_.width() * BytesPerPixel(internalformat_); 66 return size_.width() * BytesPerPixel(internalformat_);
46 } 67 }
47 68
48 } // namespace content 69 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698