@@ -439,9 +439,7 @@ draw_horizontal_lines(
439439 * Filled polygon draw function using scan line algorithm.
440440 */
441441static inline int
442- polygon_generic (
443- Imaging im , int n , Edge * e , int ink , int eofill , hline_handler hline , int hasAlpha
444- ) {
442+ polygon_generic (Imaging im , int n , Edge * e , int ink , int eofill , hline_handler hline ) {
445443 Edge * * edge_table ;
446444 float * xx ;
447445 int edge_count = 0 ;
@@ -461,6 +459,7 @@ polygon_generic(
461459 return -1 ;
462460 }
463461
462+ int hasAlpha = hline == hline32rgba ;
464463 for (i = 0 ; i < n ; i ++ ) {
465464 if (ymin > e [i ].ymin ) {
466465 ymin = e [i ].ymin ;
@@ -590,21 +589,6 @@ polygon_generic(
590589 return 0 ;
591590}
592591
593- static inline int
594- polygon8 (Imaging im , int n , Edge * e , int ink , int eofill ) {
595- return polygon_generic (im , n , e , ink , eofill , hline8 , 0 );
596- }
597-
598- static inline int
599- polygon32 (Imaging im , int n , Edge * e , int ink , int eofill ) {
600- return polygon_generic (im , n , e , ink , eofill , hline32 , 0 );
601- }
602-
603- static inline int
604- polygon32rgba (Imaging im , int n , Edge * e , int ink , int eofill ) {
605- return polygon_generic (im , n , e , ink , eofill , hline32rgba , 1 );
606- }
607-
608592static inline void
609593add_edge (Edge * e , int x0 , int y0 , int x1 , int y1 ) {
610594 /* printf("edge %d %d %d %d\n", x0, y0, x1, y1); */
@@ -641,12 +625,11 @@ typedef struct {
641625 void (* point )(Imaging im , int x , int y , int ink );
642626 void (* hline )(Imaging im , int x0 , int y0 , int x1 , int ink );
643627 void (* line )(Imaging im , int x0 , int y0 , int x1 , int y1 , int ink );
644- int (* polygon )(Imaging im , int n , Edge * e , int ink , int eofill );
645628} DRAW ;
646629
647- DRAW draw8 = {point8 , hline8 , line8 , polygon8 };
648- DRAW draw32 = {point32 , hline32 , line32 , polygon32 };
649- DRAW draw32rgba = {point32rgba , hline32rgba , line32rgba , polygon32rgba };
630+ DRAW draw8 = {point8 , hline8 , line8 };
631+ DRAW draw32 = {point32 , hline32 , line32 };
632+ DRAW draw32rgba = {point32rgba , hline32rgba , line32rgba };
650633
651634/* -------------------------------------------------------------------- */
652635/* Interface */
@@ -731,7 +714,7 @@ ImagingDrawWideLine(
731714 add_edge (e + 2 , vertices [2 ][0 ], vertices [2 ][1 ], vertices [3 ][0 ], vertices [3 ][1 ]);
732715 add_edge (e + 3 , vertices [3 ][0 ], vertices [3 ][1 ], vertices [0 ][0 ], vertices [0 ][1 ]);
733716
734- draw -> polygon (im , 4 , e , ink , 0 );
717+ polygon_generic (im , 4 , e , ink , 0 , draw -> hline );
735718 }
736719 return 0 ;
737720}
@@ -839,7 +822,7 @@ ImagingDrawPolygon(
839822 if (xy [i * 2 ] != xy [0 ] || xy [i * 2 + 1 ] != xy [1 ]) {
840823 add_edge (& e [n ++ ], xy [i * 2 ], xy [i * 2 + 1 ], xy [0 ], xy [1 ]);
841824 }
842- draw -> polygon (im , n , e , ink , 0 );
825+ polygon_generic (im , n , e , ink , 0 , draw -> hline );
843826 free (e );
844827
845828 } else {
@@ -1989,7 +1972,7 @@ ImagingDrawOutline(
19891972
19901973 DRAWINIT ();
19911974
1992- draw -> polygon (im , outline -> count , outline -> edges , ink , 0 );
1975+ polygon_generic (im , outline -> count , outline -> edges , ink , 0 , draw -> hline );
19931976
19941977 return 0 ;
19951978}
0 commit comments