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 "ui/gl/gl_bindings.h" |
8 #include "third_party/khronos/GLES2/gl2ext.h" | |
9 | 8 |
10 namespace cc { | 9 namespace cc { |
11 | 10 |
12 SkColorType ResourceFormatToSkColorType(ResourceFormat format) { | 11 SkColorType ResourceFormatToSkColorType(ResourceFormat format) { |
13 switch (format) { | 12 switch (format) { |
14 case RGBA_4444: | 13 case RGBA_4444: |
15 return kARGB_4444_SkColorType; | 14 return kARGB_4444_SkColorType; |
16 case RGBA_8888: | 15 case RGBA_8888: |
17 case BGRA_8888: | 16 case BGRA_8888: |
18 return kN32_SkColorType; | 17 return kN32_SkColorType; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 static_assert(arraysize(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1), | 79 static_assert(arraysize(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1), |
81 "format_gl_data_format does not handle all cases."); | 80 "format_gl_data_format does not handle all cases."); |
82 | 81 |
83 return format_gl_data_format[format]; | 82 return format_gl_data_format[format]; |
84 } | 83 } |
85 | 84 |
86 GLenum GLInternalFormat(ResourceFormat format) { | 85 GLenum GLInternalFormat(ResourceFormat format) { |
87 return GLDataFormat(format); | 86 return GLDataFormat(format); |
88 } | 87 } |
89 | 88 |
89 GLenum GLImageFormat(ResourceFormat format) { | |
90 if (format == RED_8) | |
91 return GL_R8_EXT; | |
reveman
2015/11/05 13:46:01
Can we have normal textures use GL_R8_EXT as well?
ccameron
2015/11/05 19:09:20
That was the first thing that I tried, but GL_R8_E
| |
92 return GLInternalFormat(format); | |
93 } | |
94 | |
90 gfx::BufferFormat BufferFormat(ResourceFormat format) { | 95 gfx::BufferFormat BufferFormat(ResourceFormat format) { |
91 switch (format) { | 96 switch (format) { |
97 case BGRA_8888: | |
98 return gfx::BufferFormat::BGRA_8888; | |
99 case RED_8: | |
100 return gfx::BufferFormat::R_8; | |
101 case RGBA_4444: | |
102 return gfx::BufferFormat::RGBA_4444; | |
92 case RGBA_8888: | 103 case RGBA_8888: |
93 return gfx::BufferFormat::RGBA_8888; | 104 return gfx::BufferFormat::RGBA_8888; |
94 case BGRA_8888: | |
95 return gfx::BufferFormat::BGRA_8888; | |
96 case RGBA_4444: | |
97 return gfx::BufferFormat::RGBA_4444; | |
98 case ALPHA_8: | 105 case ALPHA_8: |
99 case LUMINANCE_8: | 106 case LUMINANCE_8: |
100 case RGB_565: | 107 case RGB_565: |
101 case ETC1: | 108 case ETC1: |
102 case RED_8: | |
103 break; | 109 break; |
104 } | 110 } |
105 NOTREACHED(); | 111 NOTREACHED(); |
106 return gfx::BufferFormat::RGBA_8888; | 112 return gfx::BufferFormat::RGBA_8888; |
107 } | 113 } |
108 | 114 |
109 } // namespace cc | 115 } // namespace cc |
OLD | NEW |