OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 /** | 135 /** |
136 * Flags used for bitfields of color components. They are defined so that the bi
t order reflects the | 136 * Flags used for bitfields of color components. They are defined so that the bi
t order reflects the |
137 * GrColor shift order. | 137 * GrColor shift order. |
138 */ | 138 */ |
139 enum GrColorComponentFlags { | 139 enum GrColorComponentFlags { |
140 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8), | 140 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8), |
141 kG_GrColorComponentFlag = 1 << (GrColor_SHIFT_G / 8), | 141 kG_GrColorComponentFlag = 1 << (GrColor_SHIFT_G / 8), |
142 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8), | 142 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8), |
143 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8), | 143 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8), |
144 | 144 |
| 145 kNone_GrColorComponentFlags = 0, |
| 146 |
145 kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentF
lag | | 147 kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentF
lag | |
146 kB_GrColorComponentFlag), | 148 kB_GrColorComponentFlag), |
147 | 149 |
148 kRGBA_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponent
Flag | | 150 kRGBA_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponent
Flag | |
149 kB_GrColorComponentFlag | kA_GrColorComponent
Flag) | 151 kB_GrColorComponentFlag | kA_GrColorComponent
Flag) |
150 }; | 152 }; |
151 | 153 |
| 154 GR_MAKE_BITFIELD_OPS(GrColorComponentFlags) |
| 155 |
152 static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) { | 156 static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) { |
153 SkASSERT(SkIsPow2(component)); | 157 SkASSERT(SkIsPow2(component)); |
154 switch (component) { | 158 switch (component) { |
155 case kR_GrColorComponentFlag: | 159 case kR_GrColorComponentFlag: |
156 return 'r'; | 160 return 'r'; |
157 case kG_GrColorComponentFlag: | 161 case kG_GrColorComponentFlag: |
158 return 'g'; | 162 return 'g'; |
159 case kB_GrColorComponentFlag: | 163 case kB_GrColorComponentFlag: |
160 return 'b'; | 164 return 'b'; |
161 case kA_GrColorComponentFlag: | 165 case kA_GrColorComponentFlag: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 GR_STATIC_ASSERT(9 == kLATC_GrPixelConfig); | 203 GR_STATIC_ASSERT(9 == kLATC_GrPixelConfig); |
200 GR_STATIC_ASSERT(10 == kR11_EAC_GrPixelConfig); | 204 GR_STATIC_ASSERT(10 == kR11_EAC_GrPixelConfig); |
201 GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig); | 205 GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig); |
202 GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig); | 206 GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig); |
203 GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig); | 207 GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig); |
204 GR_STATIC_ASSERT(14 == kRGBA_half_GrPixelConfig); | 208 GR_STATIC_ASSERT(14 == kRGBA_half_GrPixelConfig); |
205 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); | 209 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); |
206 } | 210 } |
207 | 211 |
208 #endif | 212 #endif |
OLD | NEW |