| 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 { |
| 11 | 11 |
| 12 SkColorType ResourceFormatToSkColorType(ResourceFormat format) { | 12 SkColorType ResourceFormatToClosestSkColorType(ResourceFormat format) { |
| 13 // Use kN32_SkColorType if there is no corresponding SkColorType. |
| 13 switch (format) { | 14 switch (format) { |
| 14 case RGBA_4444: | 15 case RGBA_4444: |
| 15 return kARGB_4444_SkColorType; | 16 return kARGB_4444_SkColorType; |
| 16 case RGBA_8888: | 17 case RGBA_8888: |
| 17 case BGRA_8888: | 18 case BGRA_8888: |
| 18 return kN32_SkColorType; | 19 return kN32_SkColorType; |
| 20 case ALPHA_8: |
| 21 return kAlpha_8_SkColorType; |
| 22 case RGB_565: |
| 23 return kRGB_565_SkColorType; |
| 24 case LUMINANCE_8: |
| 25 return kGray_8_SkColorType; |
| 19 case ETC1: | 26 case ETC1: |
| 20 case ALPHA_8: | |
| 21 case LUMINANCE_8: | |
| 22 case RGB_565: | |
| 23 case RED_8: | 27 case RED_8: |
| 24 case LUMINANCE_F16: | 28 case LUMINANCE_F16: |
| 25 NOTREACHED(); | 29 return kN32_SkColorType; |
| 26 break; | |
| 27 } | 30 } |
| 28 NOTREACHED(); | 31 NOTREACHED(); |
| 29 return kN32_SkColorType; | 32 return kN32_SkColorType; |
| 30 } | 33 } |
| 31 | 34 |
| 32 int BitsPerPixel(ResourceFormat format) { | 35 int BitsPerPixel(ResourceFormat format) { |
| 33 switch (format) { | 36 switch (format) { |
| 34 case BGRA_8888: | 37 case BGRA_8888: |
| 35 case RGBA_8888: | 38 case RGBA_8888: |
| 36 return 32; | 39 return 32; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 case ETC1: | 132 case ETC1: |
| 130 case RED_8: | 133 case RED_8: |
| 131 case LUMINANCE_F16: | 134 case LUMINANCE_F16: |
| 132 return false; | 135 return false; |
| 133 } | 136 } |
| 134 NOTREACHED(); | 137 NOTREACHED(); |
| 135 return false; | 138 return false; |
| 136 } | 139 } |
| 137 | 140 |
| 138 } // namespace cc | 141 } // namespace cc |
| OLD | NEW |