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 "cc/resources/resource_format.h" | 5 #include "cc/resources/resource_format.h" |
6 | 6 |
7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/GLES2/gl2.h" |
8 #include "third_party/khronos/GLES2/gl2ext.h" | 8 #include "third_party/khronos/GLES2/gl2ext.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 GL_RED_EXT, // RED_8 | 81 GL_RED_EXT, // RED_8 |
82 GL_LUMINANCE, // LUMINANCE_F16 | 82 GL_LUMINANCE, // LUMINANCE_F16 |
83 }; | 83 }; |
84 static_assert(arraysize(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1), | 84 static_assert(arraysize(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1), |
85 "format_gl_data_format does not handle all cases."); | 85 "format_gl_data_format does not handle all cases."); |
86 | 86 |
87 return format_gl_data_format[format]; | 87 return format_gl_data_format[format]; |
88 } | 88 } |
89 | 89 |
90 GLenum GLInternalFormat(ResourceFormat format) { | 90 GLenum GLInternalFormat(ResourceFormat format) { |
91 return GLDataFormat(format); | 91 if (format == RED_8) |
reveman
2016/02/20 01:07:55
nit: return (format == RED_8) ? GL_R8_EXT : GLData
Daniele Castagna
2016/02/20 01:16:16
Done.
| |
92 return GL_R8_EXT; | |
93 else | |
94 return GLDataFormat(format); | |
92 } | 95 } |
93 | 96 |
94 gfx::BufferFormat BufferFormat(ResourceFormat format) { | 97 gfx::BufferFormat BufferFormat(ResourceFormat format) { |
95 switch (format) { | 98 switch (format) { |
96 case BGRA_8888: | 99 case BGRA_8888: |
97 return gfx::BufferFormat::BGRA_8888; | 100 return gfx::BufferFormat::BGRA_8888; |
98 case RED_8: | 101 case RED_8: |
99 return gfx::BufferFormat::R_8; | 102 return gfx::BufferFormat::R_8; |
100 case RGBA_4444: | 103 case RGBA_4444: |
101 return gfx::BufferFormat::RGBA_4444; | 104 return gfx::BufferFormat::RGBA_4444; |
102 case RGBA_8888: | 105 case RGBA_8888: |
103 return gfx::BufferFormat::RGBA_8888; | 106 return gfx::BufferFormat::RGBA_8888; |
104 case ALPHA_8: | 107 case ALPHA_8: |
105 case LUMINANCE_8: | 108 case LUMINANCE_8: |
106 case RGB_565: | 109 case RGB_565: |
107 case ETC1: | 110 case ETC1: |
108 case LUMINANCE_F16: | 111 case LUMINANCE_F16: |
109 break; | 112 break; |
110 } | 113 } |
111 NOTREACHED(); | 114 NOTREACHED(); |
112 return gfx::BufferFormat::RGBA_8888; | 115 return gfx::BufferFormat::RGBA_8888; |
113 } | 116 } |
114 | 117 |
115 } // namespace cc | 118 } // namespace cc |
OLD | NEW |