OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrTypes_DEFINED | 8 #ifndef GrTypes_DEFINED |
9 #define GrTypes_DEFINED | 9 #define GrTypes_DEFINED |
10 | 10 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 switch (config) { | 306 switch (config) { |
307 case kRGBA_8888_GrPixelConfig: | 307 case kRGBA_8888_GrPixelConfig: |
308 case kBGRA_8888_GrPixelConfig: | 308 case kBGRA_8888_GrPixelConfig: |
309 case kSRGBA_8888_GrPixelConfig: | 309 case kSRGBA_8888_GrPixelConfig: |
310 return true; | 310 return true; |
311 default: | 311 default: |
312 return false; | 312 return false; |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
| 316 // Returns true if the color (non-alpha) components represent sRGB values. It do
es NOT indicate that |
| 317 // all three color components are present in the config or anything about their
order. |
| 318 static inline bool GrPixelConfigIsSRGB(GrPixelConfig config) { |
| 319 switch (config) { |
| 320 case kSRGBA_8888_GrPixelConfig: |
| 321 return true; |
| 322 default: |
| 323 return false; |
| 324 } |
| 325 } |
| 326 |
316 // Takes a config and returns the equivalent config with the R and B order | 327 // Takes a config and returns the equivalent config with the R and B order |
317 // swapped if such a config exists. Otherwise, kUnknown_GrPixelConfig | 328 // swapped if such a config exists. Otherwise, kUnknown_GrPixelConfig |
318 static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) { | 329 static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) { |
319 switch (config) { | 330 switch (config) { |
320 case kBGRA_8888_GrPixelConfig: | 331 case kBGRA_8888_GrPixelConfig: |
321 return kRGBA_8888_GrPixelConfig; | 332 return kRGBA_8888_GrPixelConfig; |
322 case kRGBA_8888_GrPixelConfig: | 333 case kRGBA_8888_GrPixelConfig: |
323 return kBGRA_8888_GrPixelConfig; | 334 return kBGRA_8888_GrPixelConfig; |
324 default: | 335 default: |
325 return kUnknown_GrPixelConfig; | 336 return kUnknown_GrPixelConfig; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 return 4 * width * height; | 630 return 4 * width * height; |
620 } | 631 } |
621 } | 632 } |
622 | 633 |
623 /** | 634 /** |
624 * This value translates to reseting all the context state for any backend. | 635 * This value translates to reseting all the context state for any backend. |
625 */ | 636 */ |
626 static const uint32_t kAll_GrBackendState = 0xffffffff; | 637 static const uint32_t kAll_GrBackendState = 0xffffffff; |
627 | 638 |
628 #endif | 639 #endif |
OLD | NEW |