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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ETC1: |
| 105 return gfx::BufferFormat::ETC1; |
104 case ALPHA_8: | 106 case ALPHA_8: |
105 case LUMINANCE_8: | 107 case LUMINANCE_8: |
106 case RGB_565: | 108 case RGB_565: |
107 case ETC1: | |
108 case LUMINANCE_F16: | 109 case LUMINANCE_F16: |
109 break; | 110 break; |
110 } | 111 } |
111 NOTREACHED(); | 112 NOTREACHED(); |
112 return gfx::BufferFormat::RGBA_8888; | 113 return gfx::BufferFormat::RGBA_8888; |
113 } | 114 } |
114 | 115 |
| 116 bool IsResourceFormatCompressed(ResourceFormat format) { |
| 117 return format == ETC1; |
| 118 } |
| 119 |
| 120 bool DoesResourceFormatSupportAlpha(ResourceFormat format) { |
| 121 switch (format) { |
| 122 case RGBA_4444: |
| 123 case RGBA_8888: |
| 124 case BGRA_8888: |
| 125 case ALPHA_8: |
| 126 return true; |
| 127 case LUMINANCE_8: |
| 128 case RGB_565: |
| 129 case ETC1: |
| 130 case RED_8: |
| 131 case LUMINANCE_F16: |
| 132 return false; |
| 133 } |
| 134 NOTREACHED(); |
| 135 return false; |
| 136 } |
| 137 |
115 } // namespace cc | 138 } // namespace cc |
OLD | NEW |