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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 return 4; | 356 return 4; |
357 case kRGBA_half_GrPixelConfig: | 357 case kRGBA_half_GrPixelConfig: |
358 return 8; | 358 return 8; |
359 case kRGBA_float_GrPixelConfig: | 359 case kRGBA_float_GrPixelConfig: |
360 return 16; | 360 return 16; |
361 default: | 361 default: |
362 return 0; | 362 return 0; |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 static inline size_t GrUnpackAlignment(GrPixelConfig config) { | |
367 SkASSERT(!GrPixelConfigIsCompressed(config)); | |
368 switch (config) { | |
369 case kAlpha_8_GrPixelConfig: | |
370 return 1; | |
371 case kRGB_565_GrPixelConfig: | |
372 case kRGBA_4444_GrPixelConfig: | |
373 case kAlpha_half_GrPixelConfig: | |
374 case kRGBA_half_GrPixelConfig: | |
375 return 2; | |
376 case kRGBA_8888_GrPixelConfig: | |
377 case kBGRA_8888_GrPixelConfig: | |
378 case kSRGBA_8888_GrPixelConfig: | |
379 case kRGBA_float_GrPixelConfig: | |
380 return 4; | |
381 default: | |
382 return 0; | |
383 } | |
384 } | |
385 | |
386 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) { | 366 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) { |
387 switch (config) { | 367 switch (config) { |
388 case kETC1_GrPixelConfig: | 368 case kETC1_GrPixelConfig: |
389 case kRGB_565_GrPixelConfig: | 369 case kRGB_565_GrPixelConfig: |
390 return true; | 370 return true; |
391 default: | 371 default: |
392 return false; | 372 return false; |
393 } | 373 } |
394 } | 374 } |
395 | 375 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 return 4 * width * height; | 618 return 4 * width * height; |
639 } | 619 } |
640 } | 620 } |
641 | 621 |
642 /** | 622 /** |
643 * This value translates to reseting all the context state for any backend. | 623 * This value translates to reseting all the context state for any backend. |
644 */ | 624 */ |
645 static const uint32_t kAll_GrBackendState = 0xffffffff; | 625 static const uint32_t kAll_GrBackendState = 0xffffffff; |
646 | 626 |
647 #endif | 627 #endif |
OLD | NEW |