| 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 #include "ui/gfx/gpu_memory_buffer.h" | 9 #include "ui/gfx/gpu_memory_buffer.h" |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 case ALPHA_8: | 119 case ALPHA_8: |
| 120 case LUMINANCE_8: | 120 case LUMINANCE_8: |
| 121 case RGB_565: | 121 case RGB_565: |
| 122 case LUMINANCE_F16: | 122 case LUMINANCE_F16: |
| 123 break; | 123 break; |
| 124 } | 124 } |
| 125 NOTREACHED(); | 125 NOTREACHED(); |
| 126 return gfx::BufferFormat::RGBA_8888; | 126 return gfx::BufferFormat::RGBA_8888; |
| 127 } | 127 } |
| 128 | 128 |
| 129 GrPixelConfig ToGrPixelConfig(ResourceFormat format) { |
| 130 switch (format) { |
| 131 case RGBA_8888: |
| 132 return kRGBA_8888_GrPixelConfig; |
| 133 case BGRA_8888: |
| 134 return kBGRA_8888_GrPixelConfig; |
| 135 case RGBA_4444: |
| 136 return kRGBA_4444_GrPixelConfig; |
| 137 case RGBA_F16: |
| 138 return kRGBA_half_GrPixelConfig; |
| 139 default: |
| 140 break; |
| 141 } |
| 142 DCHECK(false) << "Unsupported resource format."; |
| 143 return kSkia8888_GrPixelConfig; |
| 144 } |
| 145 |
| 129 bool IsResourceFormatCompressed(ResourceFormat format) { | 146 bool IsResourceFormatCompressed(ResourceFormat format) { |
| 130 return format == ETC1; | 147 return format == ETC1; |
| 131 } | 148 } |
| 132 | 149 |
| 133 bool DoesResourceFormatSupportAlpha(ResourceFormat format) { | 150 bool DoesResourceFormatSupportAlpha(ResourceFormat format) { |
| 134 switch (format) { | 151 switch (format) { |
| 135 case RGBA_4444: | 152 case RGBA_4444: |
| 136 case RGBA_8888: | 153 case RGBA_8888: |
| 137 case BGRA_8888: | 154 case BGRA_8888: |
| 138 case ALPHA_8: | 155 case ALPHA_8: |
| 139 case RGBA_F16: | 156 case RGBA_F16: |
| 140 return true; | 157 return true; |
| 141 case LUMINANCE_8: | 158 case LUMINANCE_8: |
| 142 case RGB_565: | 159 case RGB_565: |
| 143 case ETC1: | 160 case ETC1: |
| 144 case RED_8: | 161 case RED_8: |
| 145 case LUMINANCE_F16: | 162 case LUMINANCE_F16: |
| 146 return false; | 163 return false; |
| 147 } | 164 } |
| 148 NOTREACHED(); | 165 NOTREACHED(); |
| 149 return false; | 166 return false; |
| 150 } | 167 } |
| 151 | 168 |
| 152 } // namespace cc | 169 } // namespace cc |
| OLD | NEW |