67
67
# include <emmintrin.h>
68
68
#endif
69
69
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 );
78
95
79
96
/* only used here, let do a generic fixed point integers later if required by other
80
97
part of GD */
@@ -1045,16 +1062,13 @@ static inline int _gdScaleVert (const gdImagePtr pSrc, const unsigned int src_wi
1045
1062
return 1 ;
1046
1063
}
1047
1064
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 )
1049
1067
{
1050
1068
gdImagePtr tmp_im ;
1051
1069
gdImagePtr dst ;
1052
1070
int scale_pass_res ;
1053
1071
1054
- if (new_width == 0 || new_height == 0 ) {
1055
- return NULL ;
1056
- }
1057
-
1058
1072
/* Convert to truecolor if it isn't; this code requires it. */
1059
1073
if (!src -> trueColor ) {
1060
1074
gdImagePaletteToTrueColor (src );
@@ -1094,7 +1108,8 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
1094
1108
Integer only implementation, good to have for common usages like pre scale very large
1095
1109
images before using another interpolation methods for the last step.
1096
1110
*/
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 )
1098
1113
{
1099
1114
const unsigned long new_width = MAX (1 , width );
1100
1115
const unsigned long new_height = MAX (1 , height );
@@ -1108,10 +1123,6 @@ gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width,
1108
1123
unsigned long dst_offset_y = 0 ;
1109
1124
unsigned int i ;
1110
1125
1111
- if (new_width == 0 || new_height == 0 ) {
1112
- return NULL ;
1113
- }
1114
-
1115
1126
dst_img = gdImageCreateTrueColor (new_width , new_height );
1116
1127
1117
1128
if (dst_img == NULL ) {
@@ -1165,10 +1176,6 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int
1165
1176
gdImagePtr new_img ;
1166
1177
const int transparent = im -> transparent ;
1167
1178
1168
- if (new_width == 0 || new_height == 0 ) {
1169
- return NULL ;
1170
- }
1171
-
1172
1179
new_img = gdImageCreateTrueColor (new_width , new_height );
1173
1180
if (new_img == NULL ) {
1174
1181
return NULL ;
@@ -1266,10 +1273,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
1266
1273
long i ;
1267
1274
gdImagePtr new_img ;
1268
1275
1269
- if (new_width == 0 || new_height == 0 ) {
1270
- return NULL ;
1271
- }
1272
-
1273
1276
new_img = gdImageCreateTrueColor (new_width , new_height );
1274
1277
if (!new_img ){
1275
1278
return NULL ;
@@ -1340,7 +1343,8 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
1340
1343
return new_img ;
1341
1344
}
1342
1345
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 )
1344
1348
{
1345
1349
if (im -> trueColor ) {
1346
1350
return gdImageScaleBilinearTC (im , new_width , new_height );
@@ -1349,7 +1353,8 @@ gdImagePtr gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, con
1349
1353
}
1350
1354
}
1351
1355
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 )
1353
1358
{
1354
1359
const long new_width = MAX (1 , width );
1355
1360
const long new_height = MAX (1 , height );
@@ -1368,10 +1373,6 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
1368
1373
unsigned int dst_offset_y = 0 ;
1369
1374
long i ;
1370
1375
1371
- if (new_width == 0 || new_height == 0 ) {
1372
- return NULL ;
1373
- }
1374
-
1375
1376
/* impact perf a bit, but not that much. Implementation for palette
1376
1377
images can be done at a later point.
1377
1378
*/
@@ -1628,7 +1629,8 @@ static int gdRotatedImageSize(gdImagePtr src, const float angle, gdRectPtr bbox)
1628
1629
return GD_TRUE ;
1629
1630
}
1630
1631
1631
- gdImagePtr gdImageRotateNearestNeighbour (gdImagePtr src , const float degrees , const int bgColor )
1632
+ static gdImagePtr
1633
+ gdImageRotateNearestNeighbour (gdImagePtr src , const float degrees , const int bgColor )
1632
1634
{
1633
1635
float _angle = ((float ) (- degrees / 180.0f ) * (float )M_PI );
1634
1636
const int src_w = gdImageSX (src );
@@ -1650,10 +1652,6 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
1650
1652
new_width = bbox .width ;
1651
1653
new_height = bbox .height ;
1652
1654
1653
- if (new_width == 0 || new_height == 0 ) {
1654
- return NULL ;
1655
- }
1656
-
1657
1655
dst = gdImageCreateTrueColor (new_width , new_height );
1658
1656
if (!dst ) {
1659
1657
return NULL ;
@@ -1685,7 +1683,8 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
1685
1683
return dst ;
1686
1684
}
1687
1685
1688
- gdImagePtr gdImageRotateGeneric (gdImagePtr src , const float degrees , const int bgColor )
1686
+ static gdImagePtr
1687
+ gdImageRotateGeneric (gdImagePtr src , const float degrees , const int bgColor )
1689
1688
{
1690
1689
float _angle = ((float ) (- degrees / 180.0f ) * (float )M_PI );
1691
1690
const int src_w = gdImageSX (src );
@@ -1751,7 +1750,8 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
1751
1750
return dst ;
1752
1751
}
1753
1752
1754
- gdImagePtr gdImageRotateBilinear (gdImagePtr src , const float degrees , const int bgColor )
1753
+ static gdImagePtr
1754
+ gdImageRotateBilinear (gdImagePtr src , const float degrees , const int bgColor )
1755
1755
{
1756
1756
float _angle = (float )((- degrees / 180.0f ) * M_PI );
1757
1757
const unsigned int src_w = gdImageSX (src );
@@ -1866,7 +1866,8 @@ gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int
1866
1866
return dst ;
1867
1867
}
1868
1868
1869
- gdImagePtr gdImageRotateBicubicFixed (gdImagePtr src , const float degrees , const int bgColor )
1869
+ static gdImagePtr
1870
+ gdImageRotateBicubicFixed (gdImagePtr src , const float degrees , const int bgColor )
1870
1871
{
1871
1872
const float _angle = (float )((- degrees / 180.0f ) * M_PI );
1872
1873
const int src_w = gdImageSX (src );
0 commit comments