| 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 (format == RED_8) ? GL_R8_EXT : GLDataFormat(format); | 91 return GLDataFormat(format); |
| 92 } | 92 } |
| 93 | 93 |
| 94 gfx::BufferFormat BufferFormat(ResourceFormat format) { | 94 gfx::BufferFormat BufferFormat(ResourceFormat format) { |
| 95 switch (format) { | 95 switch (format) { |
| 96 case BGRA_8888: | 96 case BGRA_8888: |
| 97 return gfx::BufferFormat::BGRA_8888; | 97 return gfx::BufferFormat::BGRA_8888; |
| 98 case RED_8: | 98 case RED_8: |
| 99 return gfx::BufferFormat::R_8; | 99 return gfx::BufferFormat::R_8; |
| 100 case RGBA_4444: | 100 case RGBA_4444: |
| 101 return gfx::BufferFormat::RGBA_4444; | 101 return gfx::BufferFormat::RGBA_4444; |
| 102 case RGBA_8888: | 102 case RGBA_8888: |
| 103 return gfx::BufferFormat::RGBA_8888; | 103 return gfx::BufferFormat::RGBA_8888; |
| 104 case ALPHA_8: | 104 case ALPHA_8: |
| 105 case LUMINANCE_8: | 105 case LUMINANCE_8: |
| 106 case RGB_565: | 106 case RGB_565: |
| 107 case ETC1: | 107 case ETC1: |
| 108 case LUMINANCE_F16: | 108 case LUMINANCE_F16: |
| 109 break; | 109 break; |
| 110 } | 110 } |
| 111 NOTREACHED(); | 111 NOTREACHED(); |
| 112 return gfx::BufferFormat::RGBA_8888; | 112 return gfx::BufferFormat::RGBA_8888; |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace cc | 115 } // namespace cc |
| OLD | NEW |