@@ -738,8 +738,8 @@ static int getPixelInterpolateWeight(gdImagePtr im, const double x, const double
738738 */
739739int getPixelInterpolated (gdImagePtr im , const double x , const double y , const int bgColor )
740740{
741- const int xi = (int )(( x ) < 0 ? x - 1 : x );
742- const int yi = (int )(( y ) < 0 ? y - 1 : y );
741+ const int xi = (int )(x );
742+ const int yi = (int )(y );
743743 int yii ;
744744 int i ;
745745 double kernel , kernel_cache_y ;
@@ -1703,13 +1703,6 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
17031703 int new_width , new_height ;
17041704 gdRect bbox ;
17051705
1706- const gdFixed f_slop_y = f_sin ;
1707- const gdFixed f_slop_x = f_cos ;
1708- const gdFixed f_slop = f_slop_x > 0 && f_slop_y > 0 ?
1709- (f_slop_x > f_slop_y ? gd_divfx (f_slop_y , f_slop_x ) : gd_divfx (f_slop_x , f_slop_y ))
1710- : 0 ;
1711-
1712-
17131706 if (bgColor < 0 ) {
17141707 return NULL ;
17151708 }
@@ -1735,15 +1728,10 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
17351728 long m = gd_fxtoi (f_m );
17361729 long n = gd_fxtoi (f_n );
17371730
1738- if (( n <= 0 ) || ( m <= 0 ) || ( m >= src_h ) || ( n >= src_w ) ) {
1731+ if (m < -1 || n < -1 || m >= src_h || n >= src_w ) {
17391732 dst -> tpixels [dst_offset_y ][dst_offset_x ++ ] = bgColor ;
1740- } else if ((n <= 1 ) || (m <= 1 ) || (m >= src_h - 1 ) || (n >= src_w - 1 )) {
1741- register int c = getPixelInterpolated (src , n , m , bgColor );
1742- c = c | (( gdTrueColorGetAlpha (c ) + ((int )(127 * gd_fxtof (f_slop )))) << 24 );
1743-
1744- dst -> tpixels [dst_offset_y ][dst_offset_x ++ ] = _color_blend (bgColor , c );
17451733 } else {
1746- dst -> tpixels [dst_offset_y ][dst_offset_x ++ ] = getPixelInterpolated (src , n , m , bgColor );
1734+ dst -> tpixels [dst_offset_y ][dst_offset_x ++ ] = getPixelInterpolated (src , gd_fxtod ( f_n ), gd_fxtod ( f_m ) , bgColor );
17471735 }
17481736 }
17491737 dst_offset_y ++ ;
0 commit comments