| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 inline unsigned BitsPerPixel(ResourceFormat format) { | 603 inline unsigned BitsPerPixel(ResourceFormat format) { |
| 604 switch (format) { | 604 switch (format) { |
| 605 case BGRA_8888: | 605 case BGRA_8888: |
| 606 case RGBA_8888: | 606 case RGBA_8888: |
| 607 return 32; | 607 return 32; |
| 608 case RGBA_4444: | 608 case RGBA_4444: |
| 609 case RGB_565: | 609 case RGB_565: |
| 610 return 16; | 610 return 16; |
| 611 case ALPHA_8: | 611 case ALPHA_8: |
| 612 case LUMINANCE_8: | 612 case LUMINANCE_8: |
| 613 case RED_8: | |
| 614 return 8; | 613 return 8; |
| 615 case ETC1: | 614 case ETC1: |
| 616 return 4; | 615 return 4; |
| 617 } | 616 } |
| 618 NOTREACHED(); | 617 NOTREACHED(); |
| 619 return 0; | 618 return 0; |
| 620 } | 619 } |
| 621 | 620 |
| 622 inline GLenum GLDataType(ResourceFormat format) { | 621 inline GLenum GLDataType(ResourceFormat format) { |
| 623 DCHECK_LE(format, RESOURCE_FORMAT_MAX); | 622 DCHECK_LE(format, RESOURCE_FORMAT_MAX); |
| 624 static const unsigned format_gl_data_type[RESOURCE_FORMAT_MAX + 1] = { | 623 static const unsigned format_gl_data_type[RESOURCE_FORMAT_MAX + 1] = { |
| 625 GL_UNSIGNED_BYTE, // RGBA_8888 | 624 GL_UNSIGNED_BYTE, // RGBA_8888 |
| 626 GL_UNSIGNED_SHORT_4_4_4_4, // RGBA_4444 | 625 GL_UNSIGNED_SHORT_4_4_4_4, // RGBA_4444 |
| 627 GL_UNSIGNED_BYTE, // BGRA_8888 | 626 GL_UNSIGNED_BYTE, // BGRA_8888 |
| 628 GL_UNSIGNED_BYTE, // ALPHA_8 | 627 GL_UNSIGNED_BYTE, // ALPHA_8 |
| 629 GL_UNSIGNED_BYTE, // LUMINANCE_8 | 628 GL_UNSIGNED_BYTE, // LUMINANCE_8 |
| 630 GL_UNSIGNED_SHORT_5_6_5, // RGB_565, | 629 GL_UNSIGNED_SHORT_5_6_5, // RGB_565, |
| 631 GL_UNSIGNED_BYTE, // ETC1 | 630 GL_UNSIGNED_BYTE // ETC1 |
| 632 GL_UNSIGNED_BYTE // RED_8 | |
| 633 }; | 631 }; |
| 634 return format_gl_data_type[format]; | 632 return format_gl_data_type[format]; |
| 635 } | 633 } |
| 636 | 634 |
| 637 inline GLenum GLDataFormat(ResourceFormat format) { | 635 inline GLenum GLDataFormat(ResourceFormat format) { |
| 638 DCHECK_LE(format, RESOURCE_FORMAT_MAX); | 636 DCHECK_LE(format, RESOURCE_FORMAT_MAX); |
| 639 static const unsigned format_gl_data_format[RESOURCE_FORMAT_MAX + 1] = { | 637 static const unsigned format_gl_data_format[RESOURCE_FORMAT_MAX + 1] = { |
| 640 GL_RGBA, // RGBA_8888 | 638 GL_RGBA, // RGBA_8888 |
| 641 GL_RGBA, // RGBA_4444 | 639 GL_RGBA, // RGBA_4444 |
| 642 GL_BGRA_EXT, // BGRA_8888 | 640 GL_BGRA_EXT, // BGRA_8888 |
| 643 GL_ALPHA, // ALPHA_8 | 641 GL_ALPHA, // ALPHA_8 |
| 644 GL_LUMINANCE, // LUMINANCE_8 | 642 GL_LUMINANCE, // LUMINANCE_8 |
| 645 GL_RGB, // RGB_565 | 643 GL_RGB, // RGB_565 |
| 646 GL_ETC1_RGB8_OES, // ETC1 | 644 GL_ETC1_RGB8_OES // ETC1 |
| 647 GL_RED_EXT // RED_8 | |
| 648 }; | 645 }; |
| 649 return format_gl_data_format[format]; | 646 return format_gl_data_format[format]; |
| 650 } | 647 } |
| 651 | 648 |
| 652 inline GLenum GLInternalFormat(ResourceFormat format) { | 649 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 653 return GLDataFormat(format); | 650 return GLDataFormat(format); |
| 654 } | 651 } |
| 655 | 652 |
| 656 } // namespace cc | 653 } // namespace cc |
| 657 | 654 |
| 658 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 655 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |