Changeset 71034 in webkit
- Timestamp:
- Nov 1, 2010 10:35:56 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r71031 r71034 1 2010-10-28 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 Fix enum naming style violation in GraphicsContext3D 6 https://bugs.webkit.org/show_bug.cgi?id=48441 7 8 * platform/graphics/GraphicsContext3D.cpp: 9 (WebCore::GraphicsContext3D::extractImageData): 10 (WebCore::GraphicsContext3D::extractTextureData): 11 (WebCore::doPacking): 12 (WebCore::GraphicsContext3D::packPixels): 13 * platform/graphics/GraphicsContext3D.h: 14 * platform/graphics/cg/GraphicsContext3DCG.cpp: 15 (WebCore::getSourceDataFormat): 16 (WebCore::GraphicsContext3D::getImageData): 17 * platform/graphics/skia/GraphicsContext3DSkia.cpp: 18 (WebCore::GraphicsContext3D::getImageData): 19 1 20 2010-11-01 Martin Robinson <mrobinson@igalia.com> 2 21 -
trunk/WebCore/platform/graphics/GraphicsContext3D.cpp
r70706 r71034 133 133 data.resize(dataBytes); 134 134 if (!packPixels(imageData->data()->data()->data(), 135 kSourceFormatRGBA8,135 SourceFormatRGBA8, 136 136 width, 137 137 height, … … 139 139 format, 140 140 type, 141 premultiplyAlpha ? kAlphaDoPremultiply : kAlphaDoNothing,141 premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing, 142 142 data.data())) 143 143 return false; … … 165 165 { 166 166 // Assumes format, type, etc. have already been validated. 167 SourceDataFormat sourceDataFormat = kSourceFormatRGBA8;167 SourceDataFormat sourceDataFormat = SourceFormatRGBA8; 168 168 switch (type) { 169 169 case UNSIGNED_BYTE: 170 170 switch (format) { 171 171 case RGBA: 172 sourceDataFormat = kSourceFormatRGBA8;172 sourceDataFormat = SourceFormatRGBA8; 173 173 break; 174 174 case RGB: 175 sourceDataFormat = kSourceFormatRGB8;175 sourceDataFormat = SourceFormatRGB8; 176 176 break; 177 177 case ALPHA: 178 sourceDataFormat = kSourceFormatA8;178 sourceDataFormat = SourceFormatA8; 179 179 break; 180 180 case LUMINANCE: 181 sourceDataFormat = kSourceFormatR8;181 sourceDataFormat = SourceFormatR8; 182 182 break; 183 183 case LUMINANCE_ALPHA: 184 sourceDataFormat = kSourceFormatRA8;184 sourceDataFormat = SourceFormatRA8; 185 185 break; 186 186 default: … … 189 189 break; 190 190 case UNSIGNED_SHORT_5_5_5_1: 191 sourceDataFormat = kSourceFormatRGBA5551;191 sourceDataFormat = SourceFormatRGBA5551; 192 192 break; 193 193 case UNSIGNED_SHORT_4_4_4_4: 194 sourceDataFormat = kSourceFormatRGBA4444;194 sourceDataFormat = SourceFormatRGBA4444; 195 195 break; 196 196 case UNSIGNED_SHORT_5_6_5: 197 sourceDataFormat = kSourceFormatRGB565;197 sourceDataFormat = SourceFormatRGB565; 198 198 break; 199 199 default: … … 214 214 width, height, unpackAlignment, 215 215 format, type, 216 (premultiplyAlpha ? kAlphaDoPremultiply : kAlphaDoNothing),216 (premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing), 217 217 data.data())) 218 218 return false; … … 567 567 } 568 568 569 // This is only used when the source format is different than kSourceFormatRGBA8.569 // This is only used when the source format is different than SourceFormatRGBA8. 570 570 void packRGBA8ToRGBA8(const uint8_t* source, uint8_t* destination) 571 571 { … … 773 773 { 774 774 switch (sourceDataFormat) { 775 case GraphicsContext3D:: kSourceFormatRGBA8: {775 case GraphicsContext3D::SourceFormatRGBA8: { 776 776 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 777 777 computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 790 790 break; 791 791 } 792 case GraphicsContext3D:: kSourceFormatRGBA16Little: {792 case GraphicsContext3D::SourceFormatRGBA16Little: { 793 793 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 794 794 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 796 796 break; 797 797 } 798 case GraphicsContext3D:: kSourceFormatRGBA16Big: {798 case GraphicsContext3D::SourceFormatRGBA16Big: { 799 799 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 800 800 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 802 802 break; 803 803 } 804 case GraphicsContext3D:: kSourceFormatRGB8: {804 case GraphicsContext3D::SourceFormatRGB8: { 805 805 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 806 806 computeIncrementParameters<uint8_t>(width, 3, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 808 808 break; 809 809 } 810 case GraphicsContext3D:: kSourceFormatRGB16Little: {810 case GraphicsContext3D::SourceFormatRGB16Little: { 811 811 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 812 812 computeIncrementParameters<uint16_t>(width, 6, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 814 814 break; 815 815 } 816 case GraphicsContext3D:: kSourceFormatRGB16Big: {816 case GraphicsContext3D::SourceFormatRGB16Big: { 817 817 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 818 818 computeIncrementParameters<uint16_t>(width, 6, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 820 820 break; 821 821 } 822 case GraphicsContext3D:: kSourceFormatARGB8: {822 case GraphicsContext3D::SourceFormatARGB8: { 823 823 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 824 824 computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 826 826 break; 827 827 } 828 case GraphicsContext3D:: kSourceFormatARGB16Little: {828 case GraphicsContext3D::SourceFormatARGB16Little: { 829 829 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 830 830 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 832 832 break; 833 833 } 834 case GraphicsContext3D:: kSourceFormatARGB16Big: {834 case GraphicsContext3D::SourceFormatARGB16Big: { 835 835 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 836 836 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 838 838 break; 839 839 } 840 case GraphicsContext3D:: kSourceFormatBGRA8: {840 case GraphicsContext3D::SourceFormatBGRA8: { 841 841 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 842 842 computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 844 844 break; 845 845 } 846 case GraphicsContext3D:: kSourceFormatBGRA16Little: {846 case GraphicsContext3D::SourceFormatBGRA16Little: { 847 847 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 848 848 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 850 850 break; 851 851 } 852 case GraphicsContext3D:: kSourceFormatBGRA16Big: {852 case GraphicsContext3D::SourceFormatBGRA16Big: { 853 853 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 854 854 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 856 856 break; 857 857 } 858 case GraphicsContext3D:: kSourceFormatRGBA5551: {858 case GraphicsContext3D::SourceFormatRGBA5551: { 859 859 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 860 860 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 862 862 break; 863 863 } 864 case GraphicsContext3D:: kSourceFormatRGBA4444: {864 case GraphicsContext3D::SourceFormatRGBA4444: { 865 865 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 866 866 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 868 868 break; 869 869 } 870 case GraphicsContext3D:: kSourceFormatRGB565: {870 case GraphicsContext3D::SourceFormatRGB565: { 871 871 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 872 872 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 874 874 break; 875 875 } 876 case GraphicsContext3D:: kSourceFormatR8: {876 case GraphicsContext3D::SourceFormatR8: { 877 877 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 878 878 computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 880 880 break; 881 881 } 882 case GraphicsContext3D:: kSourceFormatR16Little: {882 case GraphicsContext3D::SourceFormatR16Little: { 883 883 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 884 884 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 886 886 break; 887 887 } 888 case GraphicsContext3D:: kSourceFormatR16Big: {888 case GraphicsContext3D::SourceFormatR16Big: { 889 889 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 890 890 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 892 892 break; 893 893 } 894 case GraphicsContext3D:: kSourceFormatRA8: {894 case GraphicsContext3D::SourceFormatRA8: { 895 895 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 896 896 computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 898 898 break; 899 899 } 900 case GraphicsContext3D:: kSourceFormatRA16Little: {900 case GraphicsContext3D::SourceFormatRA16Little: { 901 901 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 902 902 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 904 904 break; 905 905 } 906 case GraphicsContext3D:: kSourceFormatRA16Big: {906 case GraphicsContext3D::SourceFormatRA16Big: { 907 907 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 908 908 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 910 910 break; 911 911 } 912 case GraphicsContext3D:: kSourceFormatAR8: {912 case GraphicsContext3D::SourceFormatAR8: { 913 913 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 914 914 computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 916 916 break; 917 917 } 918 case GraphicsContext3D:: kSourceFormatAR16Little: {918 case GraphicsContext3D::SourceFormatAR16Little: { 919 919 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 920 920 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 922 922 break; 923 923 } 924 case GraphicsContext3D:: kSourceFormatAR16Big: {924 case GraphicsContext3D::SourceFormatAR16Big: { 925 925 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 926 926 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 928 928 break; 929 929 } 930 case GraphicsContext3D:: kSourceFormatA8: {930 case GraphicsContext3D::SourceFormatA8: { 931 931 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 932 932 computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 934 934 break; 935 935 } 936 case GraphicsContext3D:: kSourceFormatA16Little: {936 case GraphicsContext3D::SourceFormatA16Little: { 937 937 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 938 938 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 940 940 break; 941 941 } 942 case GraphicsContext3D:: kSourceFormatA16Big: {942 case GraphicsContext3D::SourceFormatA16Big: { 943 943 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 944 944 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); … … 964 964 case UNSIGNED_BYTE: { 965 965 uint8_t* destination = static_cast<uint8_t*>(destinationData); 966 if (sourceDataFormat == kSourceFormatRGBA8 && destinationFormat == RGBA && sourceUnpackAlignment <= 4 && alphaOp == kAlphaDoNothing) {966 if (sourceDataFormat == SourceFormatRGBA8 && destinationFormat == RGBA && sourceUnpackAlignment <= 4 && alphaOp == AlphaDoNothing) { 967 967 // No conversion necessary. 968 968 memcpy(destinationData, sourceData, width * height * 4); … … 972 972 case RGB: 973 973 switch (alphaOp) { 974 case kAlphaDoNothing:974 case AlphaDoNothing: 975 975 doPacking<uint8_t, packRGBA8ToRGB8>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 3); 976 976 break; 977 case kAlphaDoPremultiply:977 case AlphaDoPremultiply: 978 978 doPacking<uint8_t, packRGBA8ToRGB8Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 3); 979 979 break; 980 case kAlphaDoUnmultiply:980 case AlphaDoUnmultiply: 981 981 doPacking<uint8_t, packRGBA8ToRGB8Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 3); 982 982 break; … … 985 985 case RGBA: 986 986 switch (alphaOp) { 987 case kAlphaDoNothing:988 ASSERT(sourceDataFormat != kSourceFormatRGBA8 || sourceUnpackAlignment > 4); // Handled above with fast case.987 case AlphaDoNothing: 988 ASSERT(sourceDataFormat != SourceFormatRGBA8 || sourceUnpackAlignment > 4); // Handled above with fast case. 989 989 doPacking<uint8_t, packRGBA8ToRGBA8>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 4); 990 990 break; 991 case kAlphaDoPremultiply:991 case AlphaDoPremultiply: 992 992 doPacking<uint8_t, packRGBA8ToRGBA8Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 4); 993 993 break; 994 case kAlphaDoUnmultiply:994 case AlphaDoUnmultiply: 995 995 doPacking<uint8_t, packRGBA8ToRGBA8Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 4); 996 996 break; … … 1010 1010 // from the RGBA data. 1011 1011 switch (alphaOp) { 1012 case kAlphaDoNothing:1012 case AlphaDoNothing: 1013 1013 doPacking<uint8_t, packRGBA8ToR8>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1014 1014 break; 1015 case kAlphaDoPremultiply:1015 case AlphaDoPremultiply: 1016 1016 doPacking<uint8_t, packRGBA8ToR8Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1017 1017 break; 1018 case kAlphaDoUnmultiply:1018 case AlphaDoUnmultiply: 1019 1019 doPacking<uint8_t, packRGBA8ToR8Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1020 1020 break; … … 1026 1026 // are chosen from the RGBA data. 1027 1027 switch (alphaOp) { 1028 case kAlphaDoNothing:1028 case AlphaDoNothing: 1029 1029 doPacking<uint8_t, packRGBA8ToRA8>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 2); 1030 1030 break; 1031 case kAlphaDoPremultiply:1031 case AlphaDoPremultiply: 1032 1032 doPacking<uint8_t, packRGBA8ToRA8Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 2); 1033 1033 break; 1034 case kAlphaDoUnmultiply:1034 case AlphaDoUnmultiply: 1035 1035 doPacking<uint8_t, packRGBA8ToRA8Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 2); 1036 1036 break; … … 1043 1043 uint16_t* destination = static_cast<uint16_t*>(destinationData); 1044 1044 switch (alphaOp) { 1045 case kAlphaDoNothing:1045 case AlphaDoNothing: 1046 1046 doPacking<uint16_t, packRGBA8ToUnsignedShort4444>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1047 1047 break; 1048 case kAlphaDoPremultiply:1048 case AlphaDoPremultiply: 1049 1049 doPacking<uint16_t, packRGBA8ToUnsignedShort4444Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1050 1050 break; 1051 case kAlphaDoUnmultiply:1051 case AlphaDoUnmultiply: 1052 1052 doPacking<uint16_t, packRGBA8ToUnsignedShort4444Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1053 1053 break; … … 1058 1058 uint16_t* destination = static_cast<uint16_t*>(destinationData); 1059 1059 switch (alphaOp) { 1060 case kAlphaDoNothing:1060 case AlphaDoNothing: 1061 1061 doPacking<uint16_t, packRGBA8ToUnsignedShort5551>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1062 1062 break; 1063 case kAlphaDoPremultiply:1063 case AlphaDoPremultiply: 1064 1064 doPacking<uint16_t, packRGBA8ToUnsignedShort5551Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1065 1065 break; 1066 case kAlphaDoUnmultiply:1066 case AlphaDoUnmultiply: 1067 1067 doPacking<uint16_t, packRGBA8ToUnsignedShort5551Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1068 1068 break; … … 1073 1073 uint16_t* destination = static_cast<uint16_t*>(destinationData); 1074 1074 switch (alphaOp) { 1075 case kAlphaDoNothing:1075 case AlphaDoNothing: 1076 1076 doPacking<uint16_t, packRGBA8ToUnsignedShort565>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1077 1077 break; 1078 case kAlphaDoPremultiply:1078 case AlphaDoPremultiply: 1079 1079 doPacking<uint16_t, packRGBA8ToUnsignedShort565Premultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1080 1080 break; 1081 case kAlphaDoUnmultiply:1081 case AlphaDoUnmultiply: 1082 1082 doPacking<uint16_t, packRGBA8ToUnsignedShort565Unmultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1083 1083 break; -
trunk/WebCore/platform/graphics/GraphicsContext3D.h
r70706 r71034 541 541 // by non-member functions. 542 542 enum SourceDataFormat { 543 kSourceFormatRGBA8 = 0,544 kSourceFormatRGBA16Little,545 kSourceFormatRGBA16Big,546 kSourceFormatRGB8,547 kSourceFormatRGB16Little,548 kSourceFormatRGB16Big,549 kSourceFormatBGRA8,550 kSourceFormatBGRA16Little,551 kSourceFormatBGRA16Big,552 kSourceFormatARGB8,553 kSourceFormatARGB16Little,554 kSourceFormatARGB16Big,555 kSourceFormatRGBA5551,556 kSourceFormatRGBA4444,557 kSourceFormatRGB565,558 kSourceFormatR8,559 kSourceFormatR16Little,560 kSourceFormatR16Big,561 kSourceFormatRA8,562 kSourceFormatRA16Little,563 kSourceFormatRA16Big,564 kSourceFormatAR8,565 kSourceFormatAR16Little,566 kSourceFormatAR16Big,567 kSourceFormatA8,568 kSourceFormatA16Little,569 kSourceFormatA16Big,570 kSourceFormatNumFormats543 SourceFormatRGBA8 = 0, 544 SourceFormatRGBA16Little, 545 SourceFormatRGBA16Big, 546 SourceFormatRGB8, 547 SourceFormatRGB16Little, 548 SourceFormatRGB16Big, 549 SourceFormatBGRA8, 550 SourceFormatBGRA16Little, 551 SourceFormatBGRA16Big, 552 SourceFormatARGB8, 553 SourceFormatARGB16Little, 554 SourceFormatARGB16Big, 555 SourceFormatRGBA5551, 556 SourceFormatRGBA4444, 557 SourceFormatRGB565, 558 SourceFormatR8, 559 SourceFormatR16Little, 560 SourceFormatR16Big, 561 SourceFormatRA8, 562 SourceFormatRA16Little, 563 SourceFormatRA16Big, 564 SourceFormatAR8, 565 SourceFormatAR16Little, 566 SourceFormatAR16Big, 567 SourceFormatA8, 568 SourceFormatA16Little, 569 SourceFormatA16Big, 570 SourceFormatNumFormats 571 571 }; 572 572 … … 833 833 // be removed. 834 834 enum AlphaOp { 835 kAlphaDoNothing = 0,836 kAlphaDoPremultiply = 1,837 kAlphaDoUnmultiply = 2835 AlphaDoNothing = 0, 836 AlphaDoPremultiply = 1, 837 AlphaDoUnmultiply = 2 838 838 }; 839 839 -
trunk/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
r70706 r71034 60 60 }; 61 61 62 // This returns kSourceFormatNumFormats if the combination of input parameters is unsupported.62 // This returns SourceFormatNumFormats if the combination of input parameters is unsupported. 63 63 static GraphicsContext3D::SourceDataFormat getSourceDataFormat(unsigned int componentsPerPixel, AlphaFormat alphaFormat, bool is16BitFormat, bool bigEndian) 64 64 { … … 71 71 }; 72 72 const static GraphicsContext3D::SourceDataFormat formatTable[SourceFormatBaseNumFormats][3] = { // SourceDataFormatBase x bitsPerComponentAndEndian 73 // 8bits 16bits, little endian16bits, big endian74 { GraphicsContext3D:: kSourceFormatR8, GraphicsContext3D::kSourceFormatR16Little, GraphicsContext3D::kSourceFormatR16Big },75 { GraphicsContext3D:: kSourceFormatA8, GraphicsContext3D::kSourceFormatA16Little, GraphicsContext3D::kSourceFormatA16Big },76 { GraphicsContext3D:: kSourceFormatRA8, GraphicsContext3D::kSourceFormatRA16Little, GraphicsContext3D::kSourceFormatRA16Big },77 { GraphicsContext3D:: kSourceFormatAR8, GraphicsContext3D::kSourceFormatAR16Little, GraphicsContext3D::kSourceFormatAR16Big },78 { GraphicsContext3D:: kSourceFormatRGB8, GraphicsContext3D::kSourceFormatRGB16Little, GraphicsContext3D::kSourceFormatRGB16Big },79 { GraphicsContext3D:: kSourceFormatRGBA8, GraphicsContext3D::kSourceFormatRGBA16Little, GraphicsContext3D::kSourceFormatRGBA16Big },80 { GraphicsContext3D:: kSourceFormatARGB8, GraphicsContext3D::kSourceFormatARGB16Little, GraphicsContext3D::kSourceFormatARGB16Big }73 // 8bits 16bits, little endian 16bits, big endian 74 { GraphicsContext3D::SourceFormatR8, GraphicsContext3D::SourceFormatR16Little, GraphicsContext3D::SourceFormatR16Big }, 75 { GraphicsContext3D::SourceFormatA8, GraphicsContext3D::SourceFormatA16Little, GraphicsContext3D::SourceFormatA16Big }, 76 { GraphicsContext3D::SourceFormatRA8, GraphicsContext3D::SourceFormatRA16Little, GraphicsContext3D::SourceFormatRA16Big }, 77 { GraphicsContext3D::SourceFormatAR8, GraphicsContext3D::SourceFormatAR16Little, GraphicsContext3D::SourceFormatAR16Big }, 78 { GraphicsContext3D::SourceFormatRGB8, GraphicsContext3D::SourceFormatRGB16Little, GraphicsContext3D::SourceFormatRGB16Big }, 79 { GraphicsContext3D::SourceFormatRGBA8, GraphicsContext3D::SourceFormatRGBA16Little, GraphicsContext3D::SourceFormatRGBA16Big }, 80 { GraphicsContext3D::SourceFormatARGB8, GraphicsContext3D::SourceFormatARGB16Little, GraphicsContext3D::SourceFormatARGB16Big } 81 81 }; 82 82 … … 84 84 SourceDataFormatBase formatBase = formatTableBase[componentsPerPixel - 1][alphaFormat]; 85 85 if (formatBase == SourceFormatBaseNumFormats) 86 return GraphicsContext3D:: kSourceFormatNumFormats;86 return GraphicsContext3D::SourceFormatNumFormats; 87 87 if (!is16BitFormat) 88 88 return formatTable[formatBase][0]; … … 147 147 } 148 148 149 AlphaOp neededAlphaOp = kAlphaDoNothing;149 AlphaOp neededAlphaOp = AlphaDoNothing; 150 150 AlphaFormat alphaFormat = AlphaFormatNone; 151 151 switch (CGImageGetAlphaInfo(cgImage)) { … … 156 156 ASSERT(!image->data()); 157 157 if (!premultiplyAlpha) 158 neededAlphaOp = kAlphaDoUnmultiply;158 neededAlphaOp = AlphaDoUnmultiply; 159 159 alphaFormat = AlphaFormatFirst; 160 160 break; … … 162 162 // This path is only accessible for MacOS earlier than 10.6.4. 163 163 if (premultiplyAlpha) 164 neededAlphaOp = kAlphaDoPremultiply;164 neededAlphaOp = AlphaDoPremultiply; 165 165 alphaFormat = AlphaFormatFirst; 166 166 break; … … 174 174 ASSERT(!image->data()); 175 175 if (!premultiplyAlpha) 176 neededAlphaOp = kAlphaDoUnmultiply;176 neededAlphaOp = AlphaDoUnmultiply; 177 177 alphaFormat = AlphaFormatLast; 178 178 break; 179 179 case kCGImageAlphaLast: 180 180 if (premultiplyAlpha) 181 neededAlphaOp = kAlphaDoPremultiply;181 neededAlphaOp = AlphaDoPremultiply; 182 182 alphaFormat = AlphaFormatLast; 183 183 break; … … 192 192 } 193 193 SourceDataFormat srcDataFormat = getSourceDataFormat(componentsPerPixel, alphaFormat, bitsPerComponent == 16, srcByteOrder16Big); 194 if (srcDataFormat == kSourceFormatNumFormats)194 if (srcDataFormat == SourceFormatNumFormats) 195 195 return false; 196 196 -
trunk/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp
r66288 r71034 49 49 OwnPtr<NativeImageSkia> pixels; 50 50 NativeImageSkia* skiaImage = 0; 51 AlphaOp neededAlphaOp = kAlphaDoNothing;51 AlphaOp neededAlphaOp = AlphaDoNothing; 52 52 if (image->data()) { 53 53 ImageSource decoder(false); … … 64 64 skiaImage = pixels.get(); 65 65 if (hasAlpha && premultiplyAlpha) 66 neededAlphaOp = kAlphaDoPremultiply;66 neededAlphaOp = AlphaDoPremultiply; 67 67 } else { 68 68 // This is a special case for texImage2D with HTMLCanvasElement input. 69 69 skiaImage = image->nativeImageForCurrentFrame(); 70 70 if (!premultiplyAlpha) 71 neededAlphaOp = kAlphaDoUnmultiply;71 neededAlphaOp = AlphaDoUnmultiply; 72 72 } 73 73 if (!skiaImage) … … 78 78 outputVector.resize(skiaImage->rowBytes() * skiaImage->height()); 79 79 return packPixels(reinterpret_cast<const uint8_t*>(skiaImage->getPixels()), 80 kSourceFormatBGRA8, skiaImage->width(), skiaImage->height(), 0,80 SourceFormatBGRA8, skiaImage->width(), skiaImage->height(), 0, 81 81 format, type, neededAlphaOp, outputVector.data()); 82 82 }
Note: See TracChangeset
for help on using the changeset viewer.