< prev index next >

src/java.desktop/share/native/libawt/java2d/loops/LoopMacros.h

Print this page




 890     BlitLoopWidthHeight(ANYTYPE, pSrc, srcBase, pSrcInfo, \
 891                         ANYTYPE, pDst, dstBase, pDstInfo, DstWrite, \
 892                         width, height, \
 893                         XorCopy ## ANYTYPE ## PixelData(pSrc, pDst, 0, \
 894                                                         xorpixel, xor)); \
 895 }
 896 
 897 /*
 898  * This macro defines an entire function to implement a Blit inner loop
 899  * for converting pixels from a buffer of one type into a buffer of
 900  * another type.  No blending is done of the pixels.
 901  */
 902 #define DEFINE_CONVERT_BLIT(SRC, DST, STRATEGY) \
 903 void NAME_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 904                                  juint width, juint height, \
 905                                  SurfaceDataRasInfo *pSrcInfo, \
 906                                  SurfaceDataRasInfo *pDstInfo, \
 907                                  NativePrimitive *pPrim, \
 908                                  CompositeInfo *pCompInfo) \
 909 { \

 910     Declare ## SRC ## LoadVars(SrcRead) \
 911     Declare ## DST ## StoreVars(DstWrite) \
 912  \
 913     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
 914     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
 915                         DST, pDst, dstBase, pDstInfo, DstWrite, \
 916                         width, height, \
 917                         ConvertVia ## STRATEGY(pSrc, SRC, SrcRead, \
 918                                                pDst, DST, DstWrite, \
 919                                                0, 0)); \
 920 }
 921 
 922 /*
 923  * This macro defines an entire function to implement a Blit inner loop
 924  * for converting pixels from a buffer of byte pixels with a lookup
 925  * table into a buffer of another type.  No blending is done of the pixels.
 926  */
 927 #define DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
 928 void NAME_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 929                                  juint width, juint height, \
 930                                  SurfaceDataRasInfo *pSrcInfo, \
 931                                  SurfaceDataRasInfo *pDstInfo, \
 932                                  NativePrimitive *pPrim, \
 933                                  CompositeInfo *pCompInfo) \
 934 { \

 935     Declare ## DST ## StoreVars(DstWrite) \
 936     Declare ## LUT_STRATEGY ## Lut(SRC, DST, pixLut) \
 937  \
 938     Setup ## LUT_STRATEGY ## Lut(SRC, DST, pixLut,\
 939                                  pSrcInfo, pDstInfo); \
 940     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
 941                         DST, pDst, dstBase, pDstInfo, DstWrite, \
 942                         width, height, \
 943                         Body ## LUT_STRATEGY ## Lut(pSrc, SRC, \
 944                                                     pixLut, \
 945                                                     pDst, DST, \
 946                                                     DstWrite, 0, 0));\
 947 }
 948 #define DEFINE_CONVERT_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
 949     DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
 950 
 951 /*
 952  * This macro defines an entire function to implement a ScaleBlit inner
 953  * loop for scaling and converting pixels from a buffer of one type into
 954  * a buffer of another type.  No blending is done of the pixels.
 955  */
 956 #define DEFINE_SCALE_BLIT(SRC, DST, STRATEGY) \
 957 void NAME_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 958                                juint width, juint height, \
 959                                jint sxloc, jint syloc, \
 960                                jint sxinc, jint syinc, jint shift, \
 961                                SurfaceDataRasInfo *pSrcInfo, \
 962                                SurfaceDataRasInfo *pDstInfo, \
 963                                NativePrimitive *pPrim, \
 964                                CompositeInfo *pCompInfo) \
 965 { \

 966     Declare ## SRC ## LoadVars(SrcRead) \
 967     Declare ## DST ## StoreVars(DstWrite) \
 968  \
 969     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
 970     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
 971                              DST, pDst, dstBase, pDstInfo, DstWrite, \
 972                              x, width, height, \
 973                              sxloc, syloc, sxinc, syinc, shift, \
 974                              ConvertVia ## STRATEGY(pSrc, SRC, SrcRead, \
 975                                                     pDst, DST, DstWrite, \
 976                                                     x, 0)); \
 977 }
 978 
 979 /*
 980  * This macro defines an entire function to implement a ScaleBlit inner
 981  * loop for scaling and converting pixels from a buffer of byte pixels
 982  * with a lookup table into a buffer of another type.  No blending is
 983  * done of the pixels.
 984  */
 985 #define DEFINE_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
 986 void NAME_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 987                                juint width, juint height, \
 988                                jint sxloc, jint syloc, \
 989                                jint sxinc, jint syinc, jint shift, \
 990                                SurfaceDataRasInfo *pSrcInfo, \
 991                                SurfaceDataRasInfo *pDstInfo, \
 992                                NativePrimitive *pPrim, \
 993                                CompositeInfo *pCompInfo) \
 994 { \

 995     Declare ## DST ## StoreVars(DstWrite) \
 996     Declare ## LUT_STRATEGY ## Lut(SRC, DST, pixLut) \
 997  \
 998     Setup ## LUT_STRATEGY ## Lut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
 999     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1000                              DST, pDst, dstBase, pDstInfo, DstWrite, \
1001                              x, width, height, \
1002                              sxloc, syloc, sxinc, syinc, shift, \
1003                              Body ## LUT_STRATEGY ## Lut(pSrc, SRC, pixLut, \
1004                                                          pDst, DST, \
1005                                                          DstWrite, x, 0));\
1006 }
1007 #define DEFINE_SCALE_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
1008     DEFINE_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY)
1009 
1010 /*
1011  * This macro defines an entire function to implement a Blit inner loop
1012  * for drawing opaque pixels from a buffer of one type onto a buffer of
1013  * another type, ignoring the transparent pixels in the source buffer.
1014  * No blending is done of the pixels - the converted pixel value is
1015  * either copied or the destination is left untouched.
1016  */
1017 #define DEFINE_XPAR_CONVERT_BLIT(SRC, DST, STRATEGY) \
1018 void NAME_XPAR_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1019                                       juint width, juint height, \
1020                                       SurfaceDataRasInfo *pSrcInfo, \
1021                                       SurfaceDataRasInfo *pDstInfo, \
1022                                       NativePrimitive *pPrim, \
1023                                       CompositeInfo *pCompInfo) \
1024 { \

1025     Declare ## SRC ## LoadVars(SrcRead) \
1026     Declare ## DST ## StoreVars(DstWrite) \
1027  \
1028     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
1029     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1030                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1031                         width, height, \
1032                         ConvertXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
1033                                                    pDst, DST, DstWrite, \
1034                                                    0, 0)); \
1035 }
1036 
1037 /*
1038  * This macro defines an entire function to implement a Blit inner loop
1039  * for converting pixels from a buffer of byte pixels with a lookup
1040  * table containing transparent pixels into a buffer of another type.
1041  * No blending is done of the pixels - the converted pixel value is
1042  * either copied or the destination is left untouched.
1043  */
1044 #define DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
1045 void NAME_XPAR_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1046                                       juint width, juint height, \
1047                                       SurfaceDataRasInfo *pSrcInfo, \
1048                                       SurfaceDataRasInfo *pDstInfo, \
1049                                       NativePrimitive *pPrim, \
1050                                       CompositeInfo *pCompInfo) \
1051 { \

1052     Declare ## DST ## StoreVars(DstWrite) \
1053     Declare ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut) \
1054  \
1055     Setup ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
1056     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1057                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1058                         width, height, \
1059                         Body ## LUT_STRATEGY ## XparLut(pSrc, SRC, pixLut, \
1060                                                         pDst, DST, \
1061                                                         DstWrite, 0, 0)); \
1062 }
1063 #define DEFINE_XPAR_CONVERT_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
1064     DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
1065 
1066 /*
1067  * This macro defines an entire function to implement a ScaleBlit inner
1068  * loop for scaling and converting pixels from a buffer of byte pixels
1069  * with a lookup table containing transparent pixels into a buffer of
1070  * another type.
1071  * No blending is done of the pixels - the converted pixel value is
1072  * either copied or the destination is left untouched.
1073  */
1074 #define DEFINE_XPAR_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
1075 void NAME_XPAR_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1076                                     juint width, juint height, \
1077                                     jint sxloc, jint syloc, \
1078                                     jint sxinc, jint syinc, jint shift, \
1079                                     SurfaceDataRasInfo *pSrcInfo, \
1080                                     SurfaceDataRasInfo *pDstInfo, \
1081                                     NativePrimitive *pPrim, \
1082                                     CompositeInfo *pCompInfo) \
1083 { \

1084     Declare ## DST ## StoreVars(DstWrite) \
1085     Declare ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut) \
1086  \
1087     Setup ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
1088     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1089                              DST, pDst, dstBase, pDstInfo, DstWrite, \
1090                              x, width, height, \
1091                              sxloc, syloc, sxinc, syinc, shift, \
1092                              Body ## LUT_STRATEGY ## XparLut(pSrc, SRC, pixLut, \
1093                                                              pDst, DST, \
1094                                                              DstWrite, \
1095                                                              x, 0)); \
1096 }
1097 #define DEFINE_XPAR_SCALE_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
1098     DEFINE_XPAR_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY)
1099 
1100 /*
1101  * This macro defines an entire function to implement a ScaleBlit inner
1102  * loop for scaling and converting pixels from a buffer of one type
1103  * containing transparent pixels into a buffer of another type.
1104  *
1105  * No blending is done of the pixels - the converted pixel value is
1106  * either copied or the destination is left untouched.
1107  */
1108 #define DEFINE_XPAR_SCALE_BLIT(SRC, DST, STRATEGY) \
1109 void NAME_XPAR_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1110                                juint width, juint height, \
1111                                jint sxloc, jint syloc, \
1112                                jint sxinc, jint syinc, jint shift, \
1113                                SurfaceDataRasInfo *pSrcInfo, \
1114                                SurfaceDataRasInfo *pDstInfo, \
1115                                NativePrimitive *pPrim, \
1116                                CompositeInfo *pCompInfo) \
1117 { \

1118     Declare ## SRC ## LoadVars(SrcRead) \
1119     Declare ## DST ## StoreVars(DstWrite) \
1120  \
1121     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
1122     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1123                              DST, pDst, dstBase, pDstInfo, DstWrite, \
1124                              x, width, height, \
1125                              sxloc, syloc, sxinc, syinc, shift, \
1126                              ConvertXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
1127                                                         pDst, DST, DstWrite, \
1128                                                         x, 0)); \
1129 }
1130 
1131 /*
1132  * This macro defines an entire function to implement a BlitBg inner loop
1133  * for converting pixels from a buffer of one type containing transparent
1134  * pixels into a buffer of another type with a specified bgcolor for the
1135  * transparent pixels.
1136  * No blending is done of the pixels other than to substitute the
1137  * bgcolor for any transparent pixels.
1138  */
1139 #define DEFINE_XPAR_BLITBG(SRC, DST, STRATEGY) \
1140 void NAME_XPAR_BLITBG(SRC, DST)(void *srcBase, void *dstBase, \
1141                                 juint width, juint height, \
1142                                 jint bgpixel, \
1143                                 SurfaceDataRasInfo *pSrcInfo, \
1144                                 SurfaceDataRasInfo *pDstInfo, \
1145                                 NativePrimitive *pPrim, \
1146                                 CompositeInfo *pCompInfo) \
1147 { \

1148     Declare ## SRC ## LoadVars(SrcRead) \
1149     Declare ## DST ## StoreVars(DstWrite) \
1150     Declare ## DST ## PixelData(bgdata) \
1151  \
1152     Extract ## DST ## PixelData(bgpixel, bgdata); \
1153     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1154                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1155                         width, height, \
1156                         BgCopyXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
1157                                                   pDst, DST, DstWrite, \
1158                                                   0, 0, bgpixel, bgdata)); \
1159 }
1160 
1161 /*
1162  * This macro defines an entire function to implement a BlitBg inner loop
1163  * for converting pixels from a buffer of byte pixels with a lookup
1164  * table containing transparent pixels into a buffer of another type
1165  * with a specified bgcolor for the transparent pixels.
1166  * No blending is done of the pixels other than to substitute the
1167  * bgcolor for any transparent pixels.
1168  */
1169 #define DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY) \
1170 void NAME_XPAR_BLITBG(SRC, DST)(void *srcBase, void *dstBase, \
1171                                 juint width, juint height, \
1172                                 jint bgpixel, \
1173                                 SurfaceDataRasInfo *pSrcInfo, \
1174                                 SurfaceDataRasInfo *pDstInfo, \
1175                                 NativePrimitive *pPrim, \
1176                                 CompositeInfo *pCompInfo) \
1177 { \

1178     Declare ## DST ## StoreVars(DstWrite) \
1179     Declare ## LUT_STRATEGY ## BgLut(SRC, DST, pixLut) \
1180  \
1181     Setup ## LUT_STRATEGY ## BgLut(SRC, DST, pixLut, pSrcInfo, pDstInfo, \
1182                                    bgpixel); \
1183     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1184                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1185                         width, height, \
1186                         Body ## LUT_STRATEGY ## BgLut(pSrc, SRC, pixLut, \
1187                                                       pDst, DST, \
1188                                                       DstWrite, 0, 0, \
1189                                                       bgpixel)); \
1190 }
1191 #define DEFINE_XPAR_BLITBG_LUT8(SRC, DST, LUT_STRATEGY) \
1192     DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY)
1193 
1194 /*
1195  * This macro defines an entire function to implement a Blit inner loop
1196  * for converting pixels from a buffer of one type into a buffer of
1197  * another type.  Each source pixel is XORed with the current XOR color value.
1198  * That result is then XORed with the destination pixel and the final
1199  * result is stored in the destination surface.
1200  */
1201 #define DEFINE_XOR_BLIT(SRC, DST, DSTANYTYPE) \
1202 void NAME_XOR_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1203                              juint width, juint height, \
1204                              SurfaceDataRasInfo *pSrcInfo, \
1205                              SurfaceDataRasInfo *pDstInfo, \
1206                              NativePrimitive *pPrim, \
1207                              CompositeInfo *pCompInfo) \
1208 { \
1209     jint xorpixel = pCompInfo->details.xorPixel; \
1210     juint alphamask = pCompInfo->alphaMask; \

1211     Declare ## DSTANYTYPE ## PixelData(xor) \
1212     Declare ## DSTANYTYPE ## PixelData(mask) \
1213     Declare ## SRC ## LoadVars(SrcRead) \
1214     Declare ## DST ## StoreVars(DstWrite) \
1215  \
1216     Extract ## DSTANYTYPE ## PixelData(xorpixel, xor); \
1217     Extract ## DSTANYTYPE ## PixelData(alphamask, mask); \
1218  \
1219     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
1220     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1221                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1222                         width, height, \
1223                         XorVia1IntArgb(pSrc, SRC, SrcRead, \
1224                                        pDst, DST, DSTANYTYPE, \
1225                                        0, xorpixel, xor, \
1226                                        alphamask, mask, pDstInfo)); \
1227 }
1228 
1229 /*
1230  * This macro defines an entire function to implement a FillRect inner loop


1735                                                dstG); \
1736             } else { \
1737                 Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
1738                                           FG_PIXEL, PREFIX); \
1739             } \
1740         } \
1741     } while (0);
1742 
1743 #define DEFINE_SOLID_DRAWGLYPHLISTAA(DST, STRATEGY) \
1744 void NAME_SOLID_DRAWGLYPHLISTAA(DST)(SurfaceDataRasInfo *pRasInfo, \
1745                                      ImageRef *glyphs, \
1746                                      jint totalGlyphs, jint fgpixel, \
1747                                      jint argbcolor, \
1748                                      jint clipLeft, jint clipTop, \
1749                                      jint clipRight, jint clipBottom, \
1750                                      NativePrimitive *pPrim, \
1751                                      CompositeInfo *pCompInfo) \
1752 { \
1753     jint glyphCounter; \
1754     jint scan = pRasInfo->scanStride; \


1755     DST ## DataType *pPix; \
1756     Declare ## DST ## PixelData(solidpix) \
1757     DeclareAlphaVarFor ## STRATEGY(srcA) \
1758     DeclareCompVarsFor ## STRATEGY(src) \
1759 \
1760     Declare ## DST ## LoadVars(pix) \
1761     Declare ## DST ## StoreVars(pix) \
1762 \
1763     Init ## DST ## LoadVars(pix, pRasInfo); \
1764     Init ## DST ## StoreVarsY(pix, pRasInfo); \
1765     Init ## DST ## StoreVarsX(pix, pRasInfo); \
1766     Extract ## STRATEGY ## CompsAndAlphaFromArgb(argbcolor, src); \
1767     Extract ## DST ## PixelData(fgpixel, solidpix); \
1768 \
1769     for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
1770         DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
1771                                      left, top, right, bottom) \
1772         ClipDrawGlyphList(DST, pixels, 1, rowBytes, width, height, \
1773                           left, top, right, bottom, \
1774                           clipLeft, clipTop, clipRight, clipBottom, \


1881                                           FG_PIXEL, PREFIX); \
1882             } \
1883         } \
1884     } while (0);
1885 
1886 #define DEFINE_SOLID_DRAWGLYPHLISTLCD(DST, STRATEGY) \
1887 void NAME_SOLID_DRAWGLYPHLISTLCD(DST)(SurfaceDataRasInfo *pRasInfo, \
1888                                      ImageRef *glyphs, \
1889                                      jint totalGlyphs, jint fgpixel, \
1890                                      jint argbcolor, \
1891                                      jint clipLeft, jint clipTop, \
1892                                      jint clipRight, jint clipBottom, \
1893                                      jint rgbOrder, \
1894                                      unsigned char *gammaLut, \
1895                                      unsigned char * invGammaLut, \
1896                                      NativePrimitive *pPrim, \
1897                                      CompositeInfo *pCompInfo) \
1898 { \
1899     jint glyphCounter, bpp; \
1900     jint scan = pRasInfo->scanStride; \

1901     DST ## DataType *pPix; \
1902     Declare ## DST ## PixelData(solidpix) \
1903     DeclareAlphaVarFor ## STRATEGY(srcA) \
1904     DeclareCompVarsFor ## STRATEGY(src) \
1905 \
1906     Declare ## DST ## LoadVars(pix) \
1907     Declare ## DST ## StoreVars(pix) \
1908 \
1909     Init ## DST ## LoadVars(pix, pRasInfo); \
1910     Init ## DST ## StoreVarsY(pix, pRasInfo); \
1911     Init ## DST ## StoreVarsX(pix, pRasInfo); \
1912     Extract ## STRATEGY ## CompsAndAlphaFromArgb(argbcolor, src); \
1913     Extract ## DST ## PixelData(fgpixel, solidpix); \
1914     srcR = invGammaLut[srcR]; \
1915     srcG = invGammaLut[srcG]; \
1916     srcB = invGammaLut[srcB]; \
1917 \
1918     for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
1919         DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
1920                                      left, top, right, bottom) \




 890     BlitLoopWidthHeight(ANYTYPE, pSrc, srcBase, pSrcInfo, \
 891                         ANYTYPE, pDst, dstBase, pDstInfo, DstWrite, \
 892                         width, height, \
 893                         XorCopy ## ANYTYPE ## PixelData(pSrc, pDst, 0, \
 894                                                         xorpixel, xor)); \
 895 }
 896 
 897 /*
 898  * This macro defines an entire function to implement a Blit inner loop
 899  * for converting pixels from a buffer of one type into a buffer of
 900  * another type.  No blending is done of the pixels.
 901  */
 902 #define DEFINE_CONVERT_BLIT(SRC, DST, STRATEGY) \
 903 void NAME_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 904                                  juint width, juint height, \
 905                                  SurfaceDataRasInfo *pSrcInfo, \
 906                                  SurfaceDataRasInfo *pDstInfo, \
 907                                  NativePrimitive *pPrim, \
 908                                  CompositeInfo *pCompInfo) \
 909 { \
 910     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
 911     Declare ## SRC ## LoadVars(SrcRead) \
 912     Declare ## DST ## StoreVars(DstWrite) \
 913  \
 914     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
 915     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
 916                         DST, pDst, dstBase, pDstInfo, DstWrite, \
 917                         width, height, \
 918                         ConvertVia ## STRATEGY(pSrc, SRC, SrcRead, \
 919                                                pDst, DST, DstWrite, \
 920                                                0, 0)); \
 921 }
 922 
 923 /*
 924  * This macro defines an entire function to implement a Blit inner loop
 925  * for converting pixels from a buffer of byte pixels with a lookup
 926  * table into a buffer of another type.  No blending is done of the pixels.
 927  */
 928 #define DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
 929 void NAME_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 930                                  juint width, juint height, \
 931                                  SurfaceDataRasInfo *pSrcInfo, \
 932                                  SurfaceDataRasInfo *pDstInfo, \
 933                                  NativePrimitive *pPrim, \
 934                                  CompositeInfo *pCompInfo) \
 935 { \
 936     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
 937     Declare ## DST ## StoreVars(DstWrite) \
 938     Declare ## LUT_STRATEGY ## Lut(SRC, DST, pixLut) \
 939  \
 940     Setup ## LUT_STRATEGY ## Lut(SRC, DST, pixLut,\
 941                                  pSrcInfo, pDstInfo); \
 942     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
 943                         DST, pDst, dstBase, pDstInfo, DstWrite, \
 944                         width, height, \
 945                         Body ## LUT_STRATEGY ## Lut(pSrc, SRC, \
 946                                                     pixLut, \
 947                                                     pDst, DST, \
 948                                                     DstWrite, 0, 0));\
 949 }
 950 #define DEFINE_CONVERT_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
 951     DEFINE_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
 952 
 953 /*
 954  * This macro defines an entire function to implement a ScaleBlit inner
 955  * loop for scaling and converting pixels from a buffer of one type into
 956  * a buffer of another type.  No blending is done of the pixels.
 957  */
 958 #define DEFINE_SCALE_BLIT(SRC, DST, STRATEGY) \
 959 void NAME_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 960                                juint width, juint height, \
 961                                jint sxloc, jint syloc, \
 962                                jint sxinc, jint syinc, jint shift, \
 963                                SurfaceDataRasInfo *pSrcInfo, \
 964                                SurfaceDataRasInfo *pDstInfo, \
 965                                NativePrimitive *pPrim, \
 966                                CompositeInfo *pCompInfo) \
 967 { \
 968     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
 969     Declare ## SRC ## LoadVars(SrcRead) \
 970     Declare ## DST ## StoreVars(DstWrite) \
 971  \
 972     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
 973     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
 974                              DST, pDst, dstBase, pDstInfo, DstWrite, \
 975                              x, width, height, \
 976                              sxloc, syloc, sxinc, syinc, shift, \
 977                              ConvertVia ## STRATEGY(pSrc, SRC, SrcRead, \
 978                                                     pDst, DST, DstWrite, \
 979                                                     x, 0)); \
 980 }
 981 
 982 /*
 983  * This macro defines an entire function to implement a ScaleBlit inner
 984  * loop for scaling and converting pixels from a buffer of byte pixels
 985  * with a lookup table into a buffer of another type.  No blending is
 986  * done of the pixels.
 987  */
 988 #define DEFINE_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
 989 void NAME_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
 990                                juint width, juint height, \
 991                                jint sxloc, jint syloc, \
 992                                jint sxinc, jint syinc, jint shift, \
 993                                SurfaceDataRasInfo *pSrcInfo, \
 994                                SurfaceDataRasInfo *pDstInfo, \
 995                                NativePrimitive *pPrim, \
 996                                CompositeInfo *pCompInfo) \
 997 { \
 998     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
 999     Declare ## DST ## StoreVars(DstWrite) \
1000     Declare ## LUT_STRATEGY ## Lut(SRC, DST, pixLut) \
1001  \
1002     Setup ## LUT_STRATEGY ## Lut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
1003     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1004                              DST, pDst, dstBase, pDstInfo, DstWrite, \
1005                              x, width, height, \
1006                              sxloc, syloc, sxinc, syinc, shift, \
1007                              Body ## LUT_STRATEGY ## Lut(pSrc, SRC, pixLut, \
1008                                                          pDst, DST, \
1009                                                          DstWrite, x, 0));\
1010 }
1011 #define DEFINE_SCALE_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
1012     DEFINE_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY)
1013 
1014 /*
1015  * This macro defines an entire function to implement a Blit inner loop
1016  * for drawing opaque pixels from a buffer of one type onto a buffer of
1017  * another type, ignoring the transparent pixels in the source buffer.
1018  * No blending is done of the pixels - the converted pixel value is
1019  * either copied or the destination is left untouched.
1020  */
1021 #define DEFINE_XPAR_CONVERT_BLIT(SRC, DST, STRATEGY) \
1022 void NAME_XPAR_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1023                                       juint width, juint height, \
1024                                       SurfaceDataRasInfo *pSrcInfo, \
1025                                       SurfaceDataRasInfo *pDstInfo, \
1026                                       NativePrimitive *pPrim, \
1027                                       CompositeInfo *pCompInfo) \
1028 { \
1029     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1030     Declare ## SRC ## LoadVars(SrcRead) \
1031     Declare ## DST ## StoreVars(DstWrite) \
1032  \
1033     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
1034     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1035                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1036                         width, height, \
1037                         ConvertXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
1038                                                    pDst, DST, DstWrite, \
1039                                                    0, 0)); \
1040 }
1041 
1042 /*
1043  * This macro defines an entire function to implement a Blit inner loop
1044  * for converting pixels from a buffer of byte pixels with a lookup
1045  * table containing transparent pixels into a buffer of another type.
1046  * No blending is done of the pixels - the converted pixel value is
1047  * either copied or the destination is left untouched.
1048  */
1049 #define DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
1050 void NAME_XPAR_CONVERT_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1051                                       juint width, juint height, \
1052                                       SurfaceDataRasInfo *pSrcInfo, \
1053                                       SurfaceDataRasInfo *pDstInfo, \
1054                                       NativePrimitive *pPrim, \
1055                                       CompositeInfo *pCompInfo) \
1056 { \
1057     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1058     Declare ## DST ## StoreVars(DstWrite) \
1059     Declare ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut) \
1060  \
1061     Setup ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
1062     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1063                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1064                         width, height, \
1065                         Body ## LUT_STRATEGY ## XparLut(pSrc, SRC, pixLut, \
1066                                                         pDst, DST, \
1067                                                         DstWrite, 0, 0)); \
1068 }
1069 #define DEFINE_XPAR_CONVERT_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
1070     DEFINE_XPAR_CONVERT_BLIT_LUT(SRC, DST, LUT_STRATEGY)
1071 
1072 /*
1073  * This macro defines an entire function to implement a ScaleBlit inner
1074  * loop for scaling and converting pixels from a buffer of byte pixels
1075  * with a lookup table containing transparent pixels into a buffer of
1076  * another type.
1077  * No blending is done of the pixels - the converted pixel value is
1078  * either copied or the destination is left untouched.
1079  */
1080 #define DEFINE_XPAR_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY) \
1081 void NAME_XPAR_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1082                                     juint width, juint height, \
1083                                     jint sxloc, jint syloc, \
1084                                     jint sxinc, jint syinc, jint shift, \
1085                                     SurfaceDataRasInfo *pSrcInfo, \
1086                                     SurfaceDataRasInfo *pDstInfo, \
1087                                     NativePrimitive *pPrim, \
1088                                     CompositeInfo *pCompInfo) \
1089 { \
1090     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1091     Declare ## DST ## StoreVars(DstWrite) \
1092     Declare ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut) \
1093  \
1094     Setup ## LUT_STRATEGY ## XparLut(SRC, DST, pixLut, pSrcInfo, pDstInfo); \
1095     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1096                              DST, pDst, dstBase, pDstInfo, DstWrite, \
1097                              x, width, height, \
1098                              sxloc, syloc, sxinc, syinc, shift, \
1099                              Body ## LUT_STRATEGY ## XparLut(pSrc, SRC, pixLut, \
1100                                                              pDst, DST, \
1101                                                              DstWrite, \
1102                                                              x, 0)); \
1103 }
1104 #define DEFINE_XPAR_SCALE_BLIT_LUT8(SRC, DST, LUT_STRATEGY) \
1105     DEFINE_XPAR_SCALE_BLIT_LUT(SRC, DST, LUT_STRATEGY)
1106 
1107 /*
1108  * This macro defines an entire function to implement a ScaleBlit inner
1109  * loop for scaling and converting pixels from a buffer of one type
1110  * containing transparent pixels into a buffer of another type.
1111  *
1112  * No blending is done of the pixels - the converted pixel value is
1113  * either copied or the destination is left untouched.
1114  */
1115 #define DEFINE_XPAR_SCALE_BLIT(SRC, DST, STRATEGY) \
1116 void NAME_XPAR_SCALE_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1117                                juint width, juint height, \
1118                                jint sxloc, jint syloc, \
1119                                jint sxinc, jint syinc, jint shift, \
1120                                SurfaceDataRasInfo *pSrcInfo, \
1121                                SurfaceDataRasInfo *pDstInfo, \
1122                                NativePrimitive *pPrim, \
1123                                CompositeInfo *pCompInfo) \
1124 { \
1125     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1126     Declare ## SRC ## LoadVars(SrcRead) \
1127     Declare ## DST ## StoreVars(DstWrite) \
1128  \
1129     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
1130     BlitLoopScaleWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1131                              DST, pDst, dstBase, pDstInfo, DstWrite, \
1132                              x, width, height, \
1133                              sxloc, syloc, sxinc, syinc, shift, \
1134                              ConvertXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
1135                                                         pDst, DST, DstWrite, \
1136                                                         x, 0)); \
1137 }
1138 
1139 /*
1140  * This macro defines an entire function to implement a BlitBg inner loop
1141  * for converting pixels from a buffer of one type containing transparent
1142  * pixels into a buffer of another type with a specified bgcolor for the
1143  * transparent pixels.
1144  * No blending is done of the pixels other than to substitute the
1145  * bgcolor for any transparent pixels.
1146  */
1147 #define DEFINE_XPAR_BLITBG(SRC, DST, STRATEGY) \
1148 void NAME_XPAR_BLITBG(SRC, DST)(void *srcBase, void *dstBase, \
1149                                 juint width, juint height, \
1150                                 jint bgpixel, \
1151                                 SurfaceDataRasInfo *pSrcInfo, \
1152                                 SurfaceDataRasInfo *pDstInfo, \
1153                                 NativePrimitive *pPrim, \
1154                                 CompositeInfo *pCompInfo) \
1155 { \
1156     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1157     Declare ## SRC ## LoadVars(SrcRead) \
1158     Declare ## DST ## StoreVars(DstWrite) \
1159     Declare ## DST ## PixelData(bgdata) \
1160  \
1161     Extract ## DST ## PixelData(bgpixel, bgdata); \
1162     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1163                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1164                         width, height, \
1165                         BgCopyXparVia ## STRATEGY(pSrc, SRC, SrcRead, \
1166                                                   pDst, DST, DstWrite, \
1167                                                   0, 0, bgpixel, bgdata)); \
1168 }
1169 
1170 /*
1171  * This macro defines an entire function to implement a BlitBg inner loop
1172  * for converting pixels from a buffer of byte pixels with a lookup
1173  * table containing transparent pixels into a buffer of another type
1174  * with a specified bgcolor for the transparent pixels.
1175  * No blending is done of the pixels other than to substitute the
1176  * bgcolor for any transparent pixels.
1177  */
1178 #define DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY) \
1179 void NAME_XPAR_BLITBG(SRC, DST)(void *srcBase, void *dstBase, \
1180                                 juint width, juint height, \
1181                                 jint bgpixel, \
1182                                 SurfaceDataRasInfo *pSrcInfo, \
1183                                 SurfaceDataRasInfo *pDstInfo, \
1184                                 NativePrimitive *pPrim, \
1185                                 CompositeInfo *pCompInfo) \
1186 { \
1187     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1188     Declare ## DST ## StoreVars(DstWrite) \
1189     Declare ## LUT_STRATEGY ## BgLut(SRC, DST, pixLut) \
1190  \
1191     Setup ## LUT_STRATEGY ## BgLut(SRC, DST, pixLut, pSrcInfo, pDstInfo, \
1192                                    bgpixel); \
1193     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1194                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1195                         width, height, \
1196                         Body ## LUT_STRATEGY ## BgLut(pSrc, SRC, pixLut, \
1197                                                       pDst, DST, \
1198                                                       DstWrite, 0, 0, \
1199                                                       bgpixel)); \
1200 }
1201 #define DEFINE_XPAR_BLITBG_LUT8(SRC, DST, LUT_STRATEGY) \
1202     DEFINE_XPAR_BLITBG_LUT(SRC, DST, LUT_STRATEGY)
1203 
1204 /*
1205  * This macro defines an entire function to implement a Blit inner loop
1206  * for converting pixels from a buffer of one type into a buffer of
1207  * another type.  Each source pixel is XORed with the current XOR color value.
1208  * That result is then XORed with the destination pixel and the final
1209  * result is stored in the destination surface.
1210  */
1211 #define DEFINE_XOR_BLIT(SRC, DST, DSTANYTYPE) \
1212 void NAME_XOR_BLIT(SRC, DST)(void *srcBase, void *dstBase, \
1213                              juint width, juint height, \
1214                              SurfaceDataRasInfo *pSrcInfo, \
1215                              SurfaceDataRasInfo *pDstInfo, \
1216                              NativePrimitive *pPrim, \
1217                              CompositeInfo *pCompInfo) \
1218 { \
1219     jint xorpixel = pCompInfo->details.xorPixel; \
1220     juint alphamask = pCompInfo->alphaMask; \
1221     jboolean representsPrimary = (pDstInfo)->representsPrimary; \
1222     Declare ## DSTANYTYPE ## PixelData(xor) \
1223     Declare ## DSTANYTYPE ## PixelData(mask) \
1224     Declare ## SRC ## LoadVars(SrcRead) \
1225     Declare ## DST ## StoreVars(DstWrite) \
1226  \
1227     Extract ## DSTANYTYPE ## PixelData(xorpixel, xor); \
1228     Extract ## DSTANYTYPE ## PixelData(alphamask, mask); \
1229  \
1230     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
1231     BlitLoopWidthHeight(SRC, pSrc, srcBase, pSrcInfo, \
1232                         DST, pDst, dstBase, pDstInfo, DstWrite, \
1233                         width, height, \
1234                         XorVia1IntArgb(pSrc, SRC, SrcRead, \
1235                                        pDst, DST, DSTANYTYPE, \
1236                                        0, xorpixel, xor, \
1237                                        alphamask, mask, pDstInfo)); \
1238 }
1239 
1240 /*
1241  * This macro defines an entire function to implement a FillRect inner loop


1746                                                dstG); \
1747             } else { \
1748                 Store ## DST ## PixelData(DST_PTR, PIXEL_INDEX, \
1749                                           FG_PIXEL, PREFIX); \
1750             } \
1751         } \
1752     } while (0);
1753 
1754 #define DEFINE_SOLID_DRAWGLYPHLISTAA(DST, STRATEGY) \
1755 void NAME_SOLID_DRAWGLYPHLISTAA(DST)(SurfaceDataRasInfo *pRasInfo, \
1756                                      ImageRef *glyphs, \
1757                                      jint totalGlyphs, jint fgpixel, \
1758                                      jint argbcolor, \
1759                                      jint clipLeft, jint clipTop, \
1760                                      jint clipRight, jint clipBottom, \
1761                                      NativePrimitive *pPrim, \
1762                                      CompositeInfo *pCompInfo) \
1763 { \
1764     jint glyphCounter; \
1765     jint scan = pRasInfo->scanStride; \
1766     jboolean representsPrimary = (pRasInfo)->representsPrimary; \
1767 \
1768     DST ## DataType *pPix; \
1769     Declare ## DST ## PixelData(solidpix) \
1770     DeclareAlphaVarFor ## STRATEGY(srcA) \
1771     DeclareCompVarsFor ## STRATEGY(src) \
1772 \
1773     Declare ## DST ## LoadVars(pix) \
1774     Declare ## DST ## StoreVars(pix) \
1775 \
1776     Init ## DST ## LoadVars(pix, pRasInfo); \
1777     Init ## DST ## StoreVarsY(pix, pRasInfo); \
1778     Init ## DST ## StoreVarsX(pix, pRasInfo); \
1779     Extract ## STRATEGY ## CompsAndAlphaFromArgb(argbcolor, src); \
1780     Extract ## DST ## PixelData(fgpixel, solidpix); \
1781 \
1782     for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
1783         DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
1784                                      left, top, right, bottom) \
1785         ClipDrawGlyphList(DST, pixels, 1, rowBytes, width, height, \
1786                           left, top, right, bottom, \
1787                           clipLeft, clipTop, clipRight, clipBottom, \


1894                                           FG_PIXEL, PREFIX); \
1895             } \
1896         } \
1897     } while (0);
1898 
1899 #define DEFINE_SOLID_DRAWGLYPHLISTLCD(DST, STRATEGY) \
1900 void NAME_SOLID_DRAWGLYPHLISTLCD(DST)(SurfaceDataRasInfo *pRasInfo, \
1901                                      ImageRef *glyphs, \
1902                                      jint totalGlyphs, jint fgpixel, \
1903                                      jint argbcolor, \
1904                                      jint clipLeft, jint clipTop, \
1905                                      jint clipRight, jint clipBottom, \
1906                                      jint rgbOrder, \
1907                                      unsigned char *gammaLut, \
1908                                      unsigned char * invGammaLut, \
1909                                      NativePrimitive *pPrim, \
1910                                      CompositeInfo *pCompInfo) \
1911 { \
1912     jint glyphCounter, bpp; \
1913     jint scan = pRasInfo->scanStride; \
1914     jboolean representsPrimary = (pRasInfo)->representsPrimary; \
1915     DST ## DataType *pPix; \
1916     Declare ## DST ## PixelData(solidpix) \
1917     DeclareAlphaVarFor ## STRATEGY(srcA) \
1918     DeclareCompVarsFor ## STRATEGY(src) \
1919 \
1920     Declare ## DST ## LoadVars(pix) \
1921     Declare ## DST ## StoreVars(pix) \
1922 \
1923     Init ## DST ## LoadVars(pix, pRasInfo); \
1924     Init ## DST ## StoreVarsY(pix, pRasInfo); \
1925     Init ## DST ## StoreVarsX(pix, pRasInfo); \
1926     Extract ## STRATEGY ## CompsAndAlphaFromArgb(argbcolor, src); \
1927     Extract ## DST ## PixelData(fgpixel, solidpix); \
1928     srcR = invGammaLut[srcR]; \
1929     srcG = invGammaLut[srcG]; \
1930     srcB = invGammaLut[srcB]; \
1931 \
1932     for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) { \
1933         DeclareDrawGlyphListClipVars(pixels, rowBytes, width, height, \
1934                                      left, top, right, bottom) \


< prev index next >