6767# include <emmintrin.h>
6868#endif
6969
70- #ifndef MIN
71- #define MIN (a ,b ) ((a)<(b)?(a):(b))
72- #endif
73- #define MIN3 (a ,b ,c ) ((a)<(b)?(MIN(a,c)):(MIN(b,c)))
74- #ifndef MAX
75- #define MAX (a ,b ) ((a)<(b)?(b):(a))
76- #endif
77- #define MAX3 (a ,b ,c ) ((a)<(b)?(MAX(b,c)):(MAX(a,c)))
70+ static gdImagePtr gdImageScaleBilinear (gdImagePtr im ,
71+ const unsigned int new_width ,
72+ const unsigned int new_height );
73+ static gdImagePtr gdImageScaleBicubicFixed (gdImagePtr src ,
74+ const unsigned int width ,
75+ const unsigned int height );
76+ static gdImagePtr gdImageScaleNearestNeighbour (gdImagePtr im ,
77+ const unsigned int width , const unsigned int height );
78+ static gdImagePtr gdImageScaleTwoPass (const gdImagePtr pOrigImage ,
79+ const unsigned int uOrigWidth ,
80+ const unsigned int uOrigHeight ,
81+ const unsigned int uNewWidth ,
82+ const unsigned int uNewHeight );
83+ static gdImagePtr gdImageRotateNearestNeighbour (gdImagePtr src ,
84+ const float degrees ,
85+ const int bgColor );
86+ static gdImagePtr gdImageRotateBilinear (gdImagePtr src ,
87+ const float degrees ,
88+ const int bgColor );
89+ static gdImagePtr gdImageRotateBicubicFixed (gdImagePtr src ,
90+ const float degrees ,
91+ const int bgColor );
92+ static gdImagePtr gdImageRotateGeneric (gdImagePtr src ,
93+ const float degrees ,
94+ const int bgColor );
7895
7996/* only used here, let do a generic fixed point integers later if required by other
8097 part of GD */
@@ -1045,16 +1062,13 @@ static inline int _gdScaleVert (const gdImagePtr pSrc, const unsigned int src_wi
10451062 return 1 ;
10461063}
10471064
1048- gdImagePtr gdImageScaleTwoPass (const gdImagePtr src , const unsigned int src_width , const unsigned int src_height , const unsigned int new_width , const unsigned int new_height )
1065+ static gdImagePtr
1066+ gdImageScaleTwoPass (const gdImagePtr src , const unsigned int src_width , const unsigned int src_height , const unsigned int new_width , const unsigned int new_height )
10491067{
10501068 gdImagePtr tmp_im ;
10511069 gdImagePtr dst ;
10521070 int scale_pass_res ;
10531071
1054- if (new_width == 0 || new_height == 0 ) {
1055- return NULL ;
1056- }
1057-
10581072 /* Convert to truecolor if it isn't; this code requires it. */
10591073 if (!src -> trueColor ) {
10601074 gdImagePaletteToTrueColor (src );
@@ -1094,7 +1108,8 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
10941108 Integer only implementation, good to have for common usages like pre scale very large
10951109 images before using another interpolation methods for the last step.
10961110*/
1097- gdImagePtr gdImageScaleNearestNeighbour (gdImagePtr im , const unsigned int width , const unsigned int height )
1111+ static gdImagePtr
1112+ gdImageScaleNearestNeighbour (gdImagePtr im , const unsigned int width , const unsigned int height )
10981113{
10991114 const unsigned long new_width = MAX (1 , width );
11001115 const unsigned long new_height = MAX (1 , height );
@@ -1108,10 +1123,6 @@ gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width,
11081123 unsigned long dst_offset_y = 0 ;
11091124 unsigned int i ;
11101125
1111- if (new_width == 0 || new_height == 0 ) {
1112- return NULL ;
1113- }
1114-
11151126 dst_img = gdImageCreateTrueColor (new_width , new_height );
11161127
11171128 if (dst_img == NULL ) {
@@ -1165,10 +1176,6 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int
11651176 gdImagePtr new_img ;
11661177 const int transparent = im -> transparent ;
11671178
1168- if (new_width == 0 || new_height == 0 ) {
1169- return NULL ;
1170- }
1171-
11721179 new_img = gdImageCreateTrueColor (new_width , new_height );
11731180 if (new_img == NULL ) {
11741181 return NULL ;
@@ -1266,10 +1273,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
12661273 long i ;
12671274 gdImagePtr new_img ;
12681275
1269- if (new_width == 0 || new_height == 0 ) {
1270- return NULL ;
1271- }
1272-
12731276 new_img = gdImageCreateTrueColor (new_width , new_height );
12741277 if (!new_img ){
12751278 return NULL ;
@@ -1340,7 +1343,8 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
13401343 return new_img ;
13411344}
13421345
1343- gdImagePtr gdImageScaleBilinear (gdImagePtr im , const unsigned int new_width , const unsigned int new_height )
1346+ static gdImagePtr
1347+ gdImageScaleBilinear (gdImagePtr im , const unsigned int new_width , const unsigned int new_height )
13441348{
13451349 if (im -> trueColor ) {
13461350 return gdImageScaleBilinearTC (im , new_width , new_height );
@@ -1349,7 +1353,8 @@ gdImagePtr gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, con
13491353 }
13501354}
13511355
1352- gdImagePtr gdImageScaleBicubicFixed (gdImagePtr src , const unsigned int width , const unsigned int height )
1356+ static gdImagePtr
1357+ gdImageScaleBicubicFixed (gdImagePtr src , const unsigned int width , const unsigned int height )
13531358{
13541359 const long new_width = MAX (1 , width );
13551360 const long new_height = MAX (1 , height );
@@ -1368,10 +1373,6 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
13681373 unsigned int dst_offset_y = 0 ;
13691374 long i ;
13701375
1371- if (new_width == 0 || new_height == 0 ) {
1372- return NULL ;
1373- }
1374-
13751376 /* impact perf a bit, but not that much. Implementation for palette
13761377 images can be done at a later point.
13771378 */
@@ -1628,7 +1629,8 @@ static int gdRotatedImageSize(gdImagePtr src, const float angle, gdRectPtr bbox)
16281629 return GD_TRUE ;
16291630}
16301631
1631- gdImagePtr gdImageRotateNearestNeighbour (gdImagePtr src , const float degrees , const int bgColor )
1632+ static gdImagePtr
1633+ gdImageRotateNearestNeighbour (gdImagePtr src , const float degrees , const int bgColor )
16321634{
16331635 float _angle = ((float ) (- degrees / 180.0f ) * (float )M_PI );
16341636 const int src_w = gdImageSX (src );
@@ -1650,10 +1652,6 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
16501652 new_width = bbox .width ;
16511653 new_height = bbox .height ;
16521654
1653- if (new_width == 0 || new_height == 0 ) {
1654- return NULL ;
1655- }
1656-
16571655 dst = gdImageCreateTrueColor (new_width , new_height );
16581656 if (!dst ) {
16591657 return NULL ;
@@ -1685,7 +1683,8 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
16851683 return dst ;
16861684}
16871685
1688- gdImagePtr gdImageRotateGeneric (gdImagePtr src , const float degrees , const int bgColor )
1686+ static gdImagePtr
1687+ gdImageRotateGeneric (gdImagePtr src , const float degrees , const int bgColor )
16891688{
16901689 float _angle = ((float ) (- degrees / 180.0f ) * (float )M_PI );
16911690 const int src_w = gdImageSX (src );
@@ -1751,7 +1750,8 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
17511750 return dst ;
17521751}
17531752
1754- gdImagePtr gdImageRotateBilinear (gdImagePtr src , const float degrees , const int bgColor )
1753+ static gdImagePtr
1754+ gdImageRotateBilinear (gdImagePtr src , const float degrees , const int bgColor )
17551755{
17561756 float _angle = (float )((- degrees / 180.0f ) * M_PI );
17571757 const unsigned int src_w = gdImageSX (src );
@@ -1866,7 +1866,8 @@ gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int
18661866 return dst ;
18671867}
18681868
1869- gdImagePtr gdImageRotateBicubicFixed (gdImagePtr src , const float degrees , const int bgColor )
1869+ static gdImagePtr
1870+ gdImageRotateBicubicFixed (gdImagePtr src , const float degrees , const int bgColor )
18701871{
18711872 const float _angle = (float )((- degrees / 180.0f ) * M_PI );
18721873 const int src_w = gdImageSX (src );
0 commit comments