summaryrefslogtreecommitdiff
path: root/ext/gd
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd')
-rw-r--r--ext/gd/gd.c12
-rw-r--r--ext/gd/libgd/gd.h3
-rw-r--r--ext/gd/libgd/gd_interpolation.c11
3 files changed, 17 insertions, 9 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 9bdedee71b..14dd90b81a 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -82,6 +82,10 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC);
# endif
#endif
+#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
+# include "X11/xpm.h"
+#endif
+
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
@@ -92,6 +96,10 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int);
#include "gd_ctx.c"
+/* as it is not really public, duplicate declaration here to avoid
+ pointless warnings */
+int overflow2(int a, int b);
+
/* Section Filters Declarations */
/* IMPORTANT NOTE FOR NEW FILTER
* Do not forget to update:
@@ -2082,7 +2090,7 @@ PHP_FUNCTION(imagerotate)
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
- im_dst = gdImageRotateInterpolated(im_src, (float)degrees, color);
+ im_dst = gdImageRotateInterpolated(im_src, (const float)degrees, color);
if (im_dst != NULL) {
ZEND_REGISTER_RESOURCE(return_value, im_dst, le_gd);
@@ -5175,8 +5183,6 @@ PHP_FUNCTION(imageaffine)
pRect = NULL;
}
-
- //int gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]);
if (gdTransformAffineGetImage(&dst, src, pRect, affine) != GD_TRUE) {
RETURN_FALSE;
}
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index 72515108d6..20156b97b5 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -849,8 +849,7 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor);
gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor);
gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor);
-
-
+gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
typedef enum {
GD_AFFINE_TRANSLATE = 0,
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index e3247a78c1..b6e7c69201 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -1,4 +1,5 @@
/*
+ * The two pass scaling function is based on:
* Filtered Image Rescaling
* Based on Gems III
* - Schumacher general filtered image rescaling
@@ -13,6 +14,7 @@
*
* Initial sources code is avaibable in the Gems Source Code Packages:
* http://www.acm.org/pubs/tog/GraphicsGems/GGemsIII.tar.gz
+ *
*/
/*
@@ -816,10 +818,6 @@ int getPixelInterpolated(gdImagePtr im, const double x, const double y, const in
return -1;
}
- /* Default to full alpha */
- if (bgColor == -1) {
- }
-
if (im->interpolation_id == GD_WEIGHTED4) {
return getPixelInterpolateWeight(im, x, y, bgColor);
}
@@ -1708,6 +1706,7 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor)
{
float _angle = ((float) (-degrees / 180.0f) * (float)M_PI);
+ const int angle_rounded = (int)floor(degrees * 100);
const int src_w = gdImageSX(src);
const int src_h = gdImageSY(src);
const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle))) + 0.5f);
@@ -1730,6 +1729,10 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b
: 0;
+ if (bgColor < 0) {
+ return NULL;
+ }
+
dst = gdImageCreateTrueColor(new_width, new_height);
if (!dst) {
return NULL;