Skip to content

Commit 1185d10

Browse files
committed
Merge branch 'master' of https://git.php.net/push/php-src
* 'master' of https://git.php.net/push/php-src: fix BELL constant declaration merging conflict left over fix typo add definition for 5.5 fix bug #64490 - add __FreeBSD_kernel__ to allowed FreeBSD defs - fix x64 issues on windows with the various time types (overflow, signed and unsigned bits ops, etc.) causing crashes on start, error or log, must be done in win32/time.c for some of these functions too - fix regression (imagerotate_overflow.phpt), fix for all cases - fix regression bug24155.phpt and bug39366.phpt - fix regression (imagerotate_overflow.phpt) fix memory leak - ws - add gd changes - update the comment to match the code/features setting plausible default value for struct members Fixed test after nick previous fix
2 parents 415d077 + c3c4ff9 commit 1185d10

File tree

5 files changed

+44
-64
lines changed

5 files changed

+44
-64
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ $Id$
33
UPGRADE NOTES - PHP X.Y
44

55
1. Internal API changes
6-
a. Streams pooling API
7-
b. Lowercasing and locales
6+
a.
87

98
2. Build system changes
109
a. Unix build system changes
@@ -15,44 +14,6 @@ UPGRADE NOTES - PHP X.Y
1514
1. Internal API changes
1615
========================
1716

18-
a. Streams pooling API
19-
20-
The streams pooling API has been removed. The following functions no longer
21-
exist:
22-
23-
PHPAPI int php_stream_context_get_link(php_stream_context *context,
24-
const char *hostent, php_stream **stream);
25-
PHPAPI int php_stream_context_set_link(php_stream_context *context,
26-
const char *hostent, php_stream *stream);
27-
PHPAPI int php_stream_context_del_link(php_stream_context *context,
28-
php_stream *stream);
29-
30-
b. Lowercasing and locales
31-
32-
The lowercasing functions in zend_operators.c were split into those that do
33-
lowercasing according to locale rules and those that do ASCII lowercasing.
34-
ASCII:
35-
36-
zend_str_tolower_copy
37-
zend_str_tolower_dup
38-
zend_str_tolower
39-
zend_binary_strcasecmp
40-
zend_binary_strncasecmp
41-
42-
Locale-based:
43-
zend_binary_strncasecmp_l
44-
zend_binary_strcasecmp_l
45-
zend_binary_zval_strcasecmp
46-
zend_binary_zval_strncasecmp
47-
string_compare_function_ex
48-
string_case_compare_function
49-
50-
Internal engine lowercasing will be using ASCII-only rules. User-facing functions,
51-
such as strcasecmp, will be using locale rules.
52-
53-
Two new functions - zend_binary_strncasecmp_l and zend_binary_strcasecmp_l - added as
54-
locale-based counterparts to zend_binary_strcasecmp and zend_binary_strncasecmp.
55-
5617
========================
5718
2. Build system changes
5819
========================
@@ -61,5 +22,5 @@ locale-based counterparts to zend_binary_strcasecmp and zend_binary_strncasecmp.
6122
-
6223

6324
b. Windows build system changes
64-
- Drop Windows XP and 2003 support.
25+
-
6526

Zend/zend_ini_scanner_defs.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/* Generated by re2c 0.13.5 */
2-
#line 3 "Zend/zend_ini_scanner_defs.h"
3-
4-
enum YYCONDTYPE {
5-
yycINITIAL,
6-
yycST_OFFSET,
7-
yycST_SECTION_VALUE,
8-
yycST_VALUE,
9-
yycST_SECTION_RAW,
10-
yycST_DOUBLE_QUOTES,
11-
yycST_VARNAME,
12-
yycST_RAW,
13-
};
1+
/* Generated by re2c 0.13.5 */
2+
#line 3 "Zend/zend_ini_scanner_defs.h"
3+
4+
enum YYCONDTYPE {
5+
yycINITIAL,
6+
yycST_OFFSET,
7+
yycST_SECTION_VALUE,
8+
yycST_VALUE,
9+
yycST_SECTION_RAW,
10+
yycST_DOUBLE_QUOTES,
11+
yycST_VARNAME,
12+
yycST_RAW,
13+
};

ext/gd/gd.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC);
8383
# endif
8484
#endif
8585

86+
#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
87+
# include "X11/xpm.h"
88+
#endif
89+
8690
#ifndef M_PI
8791
#define M_PI 3.14159265358979323846
8892
#endif
@@ -124,6 +128,10 @@ int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
124128
#define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data)
125129
#endif
126130

131+
/* as it is not really public, duplicate declaration here to avoid
132+
pointless warnings */
133+
int overflow2(int a, int b);
134+
127135
/* Section Filters Declarations */
128136
/* IMPORTANT NOTE FOR NEW FILTER
129137
* Do not forget to update:
@@ -1265,7 +1273,7 @@ PHP_MINIT_FUNCTION(gd)
12651273
REGISTER_LONG_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT);
12661274

12671275

1268-
REGISTER_LONG_CONSTANT("IMG_BELL", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT);
1276+
REGISTER_LONG_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT);
12691277
REGISTER_LONG_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT);
12701278
REGISTER_LONG_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT);
12711279
REGISTER_LONG_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT);
@@ -2266,7 +2274,7 @@ PHP_FUNCTION(imagerotate)
22662274

22672275
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
22682276

2269-
im_dst = gdImageRotateInterpolated(im_src, (float)degrees, color);
2277+
im_dst = gdImageRotateInterpolated(im_src, (const float)degrees, color);
22702278

22712279
if (im_dst != NULL) {
22722280
ZEND_REGISTER_RESOURCE(return_value, im_dst, le_gd);
@@ -5489,8 +5497,6 @@ PHP_FUNCTION(imageaffine)
54895497
pRect = NULL;
54905498
}
54915499

5492-
5493-
//int gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]);
54945500
if (gdTransformAffineGetImage(&dst, src, pRect, affine) != GD_TRUE) {
54955501
RETURN_FALSE;
54965502
}

ext/gd/libgd/gd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,7 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
845845
gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor);
846846
gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor);
847847
gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor);
848-
849-
848+
gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
850849

851850
typedef enum {
852851
GD_AFFINE_TRANSLATE = 0,

ext/gd/libgd/gd_interpolation.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* The two pass scaling function is based on:
23
* Filtered Image Rescaling
34
* Based on Gems III
45
* - Schumacher general filtered image rescaling
@@ -13,6 +14,7 @@
1314
*
1415
* Initial sources code is avaibable in the Gems Source Code Packages:
1516
* http://www.acm.org/pubs/tog/GraphicsGems/GGemsIII.tar.gz
17+
*
1618
*/
1719

1820
/*
@@ -34,6 +36,17 @@
3436
3537
*/
3638

39+
/*
40+
Additional functions are available for simple rotation or up/downscaling.
41+
downscaling using the fixed point implementations are usually much faster
42+
than the existing gdImageCopyResampled while having a similar or better
43+
quality.
44+
45+
For image rotations, the optimized versions have a lazy antialiasing for
46+
the edges of the images. For a much better antialiased result, the affine
47+
function is recommended.
48+
*/
49+
3750
/*
3851
TODO:
3952
- Optimize pixel accesses and loops once we have continuous buffer
@@ -805,10 +818,6 @@ int getPixelInterpolated(gdImagePtr im, const double x, const double y, const in
805818
return -1;
806819
}
807820

808-
/* Default to full alpha */
809-
if (bgColor == -1) {
810-
}
811-
812821
if (im->interpolation_id == GD_WEIGHTED4) {
813822
return getPixelInterpolateWeight(im, x, y, bgColor);
814823
}
@@ -1704,6 +1713,7 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
17041713
gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor)
17051714
{
17061715
float _angle = ((float) (-degrees / 180.0f) * (float)M_PI);
1716+
const int angle_rounded = (int)floor(degrees * 100);
17071717
const int src_w = gdImageSX(src);
17081718
const int src_h = gdImageSY(src);
17091719
const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle))) + 0.5f);
@@ -1725,6 +1735,10 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
17251735
f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y)
17261736
: 0;
17271737

1738+
if (bgColor < 0) {
1739+
return NULL;
1740+
}
1741+
17281742
/* impact perf a bit, but not that much. Implementation for palette
17291743
images can be done at a later point.
17301744
*/

0 commit comments

Comments
 (0)