| 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: |
| 613 return 8; | 614 return 8; |
| 614 case ETC1: | 615 case ETC1: |
| 615 return 4; | 616 return 4; |
| 616 } | 617 } |
| 617 NOTREACHED(); | 618 NOTREACHED(); |
| 618 return 0; | 619 return 0; |
| 619 } | 620 } |
| 620 | 621 |
| 621 inline GLenum GLDataType(ResourceFormat format) { | 622 inline GLenum GLDataType(ResourceFormat format) { |
| 622 DCHECK_LE(format, RESOURCE_FORMAT_MAX); | 623 DCHECK_LE(format, RESOURCE_FORMAT_MAX); |
| 623 static const unsigned format_gl_data_type[RESOURCE_FORMAT_MAX + 1] = { | 624 static const unsigned format_gl_data_type[RESOURCE_FORMAT_MAX + 1] = { |
| 624 GL_UNSIGNED_BYTE, // RGBA_8888 | 625 GL_UNSIGNED_BYTE, // RGBA_8888 |
| 625 GL_UNSIGNED_SHORT_4_4_4_4, // RGBA_4444 | 626 GL_UNSIGNED_SHORT_4_4_4_4, // RGBA_4444 |
| 626 GL_UNSIGNED_BYTE, // BGRA_8888 | 627 GL_UNSIGNED_BYTE, // BGRA_8888 |
| 627 GL_UNSIGNED_BYTE, // ALPHA_8 | 628 GL_UNSIGNED_BYTE, // ALPHA_8 |
| 628 GL_UNSIGNED_BYTE, // LUMINANCE_8 | 629 GL_UNSIGNED_BYTE, // LUMINANCE_8 |
| 629 GL_UNSIGNED_SHORT_5_6_5, // RGB_565, | 630 GL_UNSIGNED_SHORT_5_6_5, // RGB_565, |
| 630 GL_UNSIGNED_BYTE // ETC1 | 631 GL_UNSIGNED_BYTE, // ETC1 |
| 632 GL_UNSIGNED_BYTE // RED_8 |
| 631 }; | 633 }; |
| 632 return format_gl_data_type[format]; | 634 return format_gl_data_type[format]; |
| 633 } | 635 } |
| 634 | 636 |
| 635 inline GLenum GLDataFormat(ResourceFormat format) { | 637 inline GLenum GLDataFormat(ResourceFormat format) { |
| 636 DCHECK_LE(format, RESOURCE_FORMAT_MAX); | 638 DCHECK_LE(format, RESOURCE_FORMAT_MAX); |
| 637 static const unsigned format_gl_data_format[RESOURCE_FORMAT_MAX + 1] = { | 639 static const unsigned format_gl_data_format[RESOURCE_FORMAT_MAX + 1] = { |
| 638 GL_RGBA, // RGBA_8888 | 640 GL_RGBA, // RGBA_8888 |
| 639 GL_RGBA, // RGBA_4444 | 641 GL_RGBA, // RGBA_4444 |
| 640 GL_BGRA_EXT, // BGRA_8888 | 642 GL_BGRA_EXT, // BGRA_8888 |
| 641 GL_ALPHA, // ALPHA_8 | 643 GL_ALPHA, // ALPHA_8 |
| 642 GL_LUMINANCE, // LUMINANCE_8 | 644 GL_LUMINANCE, // LUMINANCE_8 |
| 643 GL_RGB, // RGB_565 | 645 GL_RGB, // RGB_565 |
| 644 GL_ETC1_RGB8_OES // ETC1 | 646 GL_ETC1_RGB8_OES, // ETC1 |
| 647 GL_RED_EXT // RED_8 |
| 645 }; | 648 }; |
| 646 return format_gl_data_format[format]; | 649 return format_gl_data_format[format]; |
| 647 } | 650 } |
| 648 | 651 |
| 649 inline GLenum GLInternalFormat(ResourceFormat format) { | 652 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 650 return GLDataFormat(format); | 653 return GLDataFormat(format); |
| 651 } | 654 } |
| 652 | 655 |
| 653 } // namespace cc | 656 } // namespace cc |
| 654 | 657 |
| 655 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 658 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |