jdk/src/share/native/sun/java2d/loops/LoopMacros.h
changeset 7487 9b031d062ede
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
7486:6a36b1ebc620 7487:9b031d062ede
   605 #define NAME_TRANSFORMHELPER_BL(TYPE)    NAME_TRANSFORMHELPER(TYPE, Bilinear)
   605 #define NAME_TRANSFORMHELPER_BL(TYPE)    NAME_TRANSFORMHELPER(TYPE, Bilinear)
   606 #define NAME_TRANSFORMHELPER_BC(TYPE)    NAME_TRANSFORMHELPER(TYPE, Bicubic)
   606 #define NAME_TRANSFORMHELPER_BC(TYPE)    NAME_TRANSFORMHELPER(TYPE, Bicubic)
   607 
   607 
   608 #define NAME_TRANSFORMHELPER_FUNCS(TYPE) TYPE ## TransformHelperFuncs
   608 #define NAME_TRANSFORMHELPER_FUNCS(TYPE) TYPE ## TransformHelperFuncs
   609 
   609 
       
   610 #define NAME_SOLID_FILLPGRAM(TYPE)       TYPE ## SetParallelogram
       
   611 #define NAME_SOLID_PGRAM_FUNCS(TYPE)     TYPE ## SetParallelogramFuncs
       
   612 
       
   613 #define NAME_XOR_FILLPGRAM(TYPE)         TYPE ## XorParallelogram
       
   614 #define NAME_XOR_PGRAM_FUNCS(TYPE)       TYPE ## XorParallelogramFuncs
       
   615 
   610 /*
   616 /*
   611  * These macros conveniently name and declare the indicated native
   617  * These macros conveniently name and declare the indicated native
   612  * primitive loop function for forward referencing.
   618  * primitive loop function for forward referencing.
   613  */
   619  */
   614 #define DECLARE_CONVERT_BLIT(SRC, DST) \
   620 #define DECLARE_CONVERT_BLIT(SRC, DST) \
   687     TransformHelperFunc NAME_TRANSFORMHELPER_NN(TYPE); \
   693     TransformHelperFunc NAME_TRANSFORMHELPER_NN(TYPE); \
   688     TransformHelperFunc NAME_TRANSFORMHELPER_BL(TYPE); \
   694     TransformHelperFunc NAME_TRANSFORMHELPER_BL(TYPE); \
   689     TransformHelperFunc NAME_TRANSFORMHELPER_BC(TYPE); \
   695     TransformHelperFunc NAME_TRANSFORMHELPER_BC(TYPE); \
   690     TransformHelperFuncs NAME_TRANSFORMHELPER_FUNCS(TYPE)
   696     TransformHelperFuncs NAME_TRANSFORMHELPER_FUNCS(TYPE)
   691 
   697 
       
   698 #define DECLARE_SOLID_PARALLELOGRAM(TYPE) \
       
   699     FillParallelogramFunc NAME_SOLID_FILLPGRAM(TYPE); \
       
   700     DECLARE_SOLID_DRAWLINE(TYPE); \
       
   701     DrawParallelogramFuncs NAME_SOLID_PGRAM_FUNCS(TYPE)
       
   702 
       
   703 #define DECLARE_XOR_PARALLELOGRAM(TYPE) \
       
   704     FillParallelogramFunc NAME_XOR_FILLPGRAM(TYPE); \
       
   705     DECLARE_XOR_DRAWLINE(TYPE); \
       
   706     DrawParallelogramFuncs NAME_XOR_PGRAM_FUNCS(TYPE)
       
   707 
   692 /*
   708 /*
   693  * These macros construct the necessary NativePrimitive structure
   709  * These macros construct the necessary NativePrimitive structure
   694  * for the indicated native primitive loop function which will be
   710  * for the indicated native primitive loop function which will be
   695  * declared somewhere prior and defined elsewhere (usually after).
   711  * declared somewhere prior and defined elsewhere (usually after).
   696  */
   712  */
   797                              NAME_XOR_DRAWGLYPHLIST(TYPE))
   813                              NAME_XOR_DRAWGLYPHLIST(TYPE))
   798 
   814 
   799 #define REGISTER_TRANSFORMHELPER_FUNCS(TYPE) \
   815 #define REGISTER_TRANSFORMHELPER_FUNCS(TYPE) \
   800     REGISTER_PRIMITIVE(TransformHelper, TYPE, SrcNoEa, IntArgbPre, \
   816     REGISTER_PRIMITIVE(TransformHelper, TYPE, SrcNoEa, IntArgbPre, \
   801                        (AnyFunc *) &NAME_TRANSFORMHELPER_FUNCS(TYPE))
   817                        (AnyFunc *) &NAME_TRANSFORMHELPER_FUNCS(TYPE))
       
   818 
       
   819 #define REGISTER_SOLID_PARALLELOGRAM(TYPE) \
       
   820     REGISTER_PRIMITIVE(FillParallelogram, AnyColor, SrcNoEa, TYPE, \
       
   821                        NAME_SOLID_FILLPGRAM(TYPE)), \
       
   822     REGISTER_PRIMITIVE(DrawParallelogram, AnyColor, SrcNoEa, TYPE, \
       
   823                        (AnyFunc *) &NAME_SOLID_PGRAM_FUNCS(TYPE))
       
   824 
       
   825 #define REGISTER_XOR_PARALLELOGRAM(TYPE) \
       
   826     REGISTER_PRIMITIVE(FillParallelogram, AnyColor, Xor, TYPE, \
       
   827                        NAME_XOR_FILLPGRAM(TYPE)), \
       
   828     REGISTER_PRIMITIVE(DrawParallelogram, AnyColor, Xor, TYPE, \
       
   829                        (AnyFunc *) &NAME_XOR_PGRAM_FUNCS(TYPE))
   802 
   830 
   803 /*
   831 /*
   804  * This macro defines an entire function to implement a Blit inner loop
   832  * This macro defines an entire function to implement a Blit inner loop
   805  * for copying pixels of a common type from one buffer to another.
   833  * for copying pixels of a common type from one buffer to another.
   806  */
   834  */
  1261             } \
  1289             } \
  1262             pPix = PtrAddBytes(pPix, scan); \
  1290             pPix = PtrAddBytes(pPix, scan); \
  1263         } while (--h > 0); \
  1291         } while (--h > 0); \
  1264     } \
  1292     } \
  1265 }
  1293 }
       
  1294 
       
  1295 /*
       
  1296  * This macro defines an entire function to implement a FillParallelogram
       
  1297  * inner loop for tracing 2 diagonal edges (left and right) and setting
       
  1298  * those regions of pixels between them to a specific pixel value.
       
  1299  * No blending of the fill color is done with the pixels.
       
  1300  */
       
  1301 #define DEFINE_SOLID_FILLPGRAM(DST) \
       
  1302 void NAME_SOLID_FILLPGRAM(DST)(SurfaceDataRasInfo *pRasInfo, \
       
  1303                                jint lox, jint loy, jint hix, jint hiy, \
       
  1304                                jlong leftx, jlong dleftx, \
       
  1305                                jlong rightx, jlong drightx, \
       
  1306                                jint pixel, struct _NativePrimitive *pPrim, \
       
  1307                                CompositeInfo *pCompInfo) \
       
  1308 { \
       
  1309     Declare ## DST ## PixelData(pix) \
       
  1310     jint scan = pRasInfo->scanStride; \
       
  1311     DST ## DataType *pPix = PtrCoord(pRasInfo->rasBase, 0, 0, loy, scan); \
       
  1312  \
       
  1313     Extract ## DST ## PixelData(pixel, pix); \
       
  1314     while (loy < hiy) { \
       
  1315         jint lx = WholeOfLong(leftx); \
       
  1316         jint rx = WholeOfLong(rightx); \
       
  1317         if (lx < lox) lx = lox; \
       
  1318         if (rx > hix) rx = hix; \
       
  1319         while (lx < rx) { \
       
  1320             Store ## DST ## PixelData(pPix, lx, pixel, pix); \
       
  1321             lx++; \
       
  1322         } \
       
  1323         pPix = PtrAddBytes(pPix, scan); \
       
  1324         leftx += dleftx; \
       
  1325         rightx += drightx; \
       
  1326         loy++; \
       
  1327     } \
       
  1328 }
       
  1329 
       
  1330 #define DEFINE_SOLID_DRAWPARALLELOGRAM_FUNCS(DST) \
       
  1331     DrawParallelogramFuncs NAME_SOLID_PGRAM_FUNCS(DST) = { \
       
  1332         NAME_SOLID_FILLPGRAM(DST), \
       
  1333         NAME_SOLID_DRAWLINE(DST), \
       
  1334     };
       
  1335 
       
  1336 #define DEFINE_SOLID_PARALLELOGRAM(DST) \
       
  1337     DEFINE_SOLID_FILLPGRAM(DST) \
       
  1338     DEFINE_SOLID_DRAWPARALLELOGRAM_FUNCS(DST)
  1266 
  1339 
  1267 /*
  1340 /*
  1268  * This macro declares the bumpmajor and bumpminor variables used for the
  1341  * This macro declares the bumpmajor and bumpminor variables used for the
  1269  * DrawLine functions.
  1342  * DrawLine functions.
  1270  */
  1343  */