summaryrefslogtreecommitdiff
path: root/ext/gd/libgd/gd_interpolation.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2013-12-15 16:55:29 +0800
committerXinchen Hui <laruence@gmail.com>2013-12-15 16:55:29 +0800
commit5eb8d9d70009c0bf9bfbbf511f2713e64dc8ee83 (patch)
tree2480a26e79d85b4b7f2eacb5a2187eb13f029094 /ext/gd/libgd/gd_interpolation.c
parent10964b78548a5878254f5aa75f4cfdcedb0543bc (diff)
parent904721189ff949c67795ec418f04b67951cbd57b (diff)
downloadphp-git-5eb8d9d70009c0bf9bfbbf511f2713e64dc8ee83.tar.gz
Merge branch 'PHP-5.6' of https://git.php.net/push/php-src into PHP-5.6
Diffstat (limited to 'ext/gd/libgd/gd_interpolation.c')
-rw-r--r--ext/gd/libgd/gd_interpolation.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index 3643535f2e..e34242bb73 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);
}
@@ -1711,6 +1709,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);
@@ -1733,6 +1732,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;