com php-src: Fix #68714: copy 'n paste error: ext/gd/libgd/gd _arc.c ext/gd/tests/imagefilledellipse_basic.phpt
| From: | Christoph Michael Becker | Date: | Sun, 12 Jul 2015 14:32:38 +0000 |
| Subject: | com php-src: Fix #68714: copy 'n paste error: ext/gd/libgd/gd _arc.c ext/gd/tests/imagefilledellipse_basic.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87930@lists.php.net to get a copy of this message | ||
Commit: ba7c3a1bb40c4c087436a230dd7372ff9b6413d8
Author: Christoph M. Becker <cmb@php.net> Sun, 12 Jul 2015 16:26:16 +0200
Parents: a8dbe655e55bad9564687edda274b7d3cb9b9674
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ba7c3a1bb40c4c087436a230dd7372ff9b6413d8
Log:
Fix #68714: copy 'n paste error
Actually, this is not really a bug fix, but rather a simplification and
optimization in the same vein as has been done with the external libgd, but
going a small step further and joining both for loops.
Bugs:
https://bugs.php.net/68714
Changed paths:
M ext/gd/libgd/gd_arc.c
A ext/gd/tests/imagefilledellipse_basic.phpt
Diff:
diff --git a/ext/gd/libgd/gd_arc.c b/ext/gd/libgd/gd_arc.c
index 545dcb3..1c74871 100644
--- a/ext/gd/libgd/gd_arc.c
+++ b/ext/gd/libgd/gd_arc.c
@@ -58,7 +58,7 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
int x=0,mx1=0,mx2=0,my1=0,my2=0;
long aq,bq,dx,dy,r,rx,ry,a,b;
int i;
- int old_y1,old_y2;
+ int old_y2;
a=w>>1;
b=h>>1;
@@ -79,7 +79,6 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
ry = 0;
x = a;
old_y2=-2;
- old_y1=-2;
while (x > 0){
if (r > 0) {
my1++;my2--;
@@ -95,15 +94,10 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
if(old_y2!=my2){
for(i=mx1;i<=mx2;i++){
gdImageSetPixel(im,i,my1,c);
- }
- }
- if(old_y2!=my2){
- for(i=mx1;i<=mx2;i++){
gdImageSetPixel(im,i,my2,c);
}
}
old_y2 = my2;
- old_y1 = my1;
}
}
diff --git a/ext/gd/tests/imagefilledellipse_basic.phpt b/ext/gd/tests/imagefilledellipse_basic.phpt
new file mode 100644
index 0000000..a1a578a
--- /dev/null
+++ b/ext/gd/tests/imagefilledellipse_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Testing imagefilledellipse() of GD library
+--SKIPIF--
+<?php
+if (!extension_loaded("gd")) die("skip GD not present");
+?>
+--FILE--
+<?php
+
+$image = imagecreatetruecolor(100, 100);
+
+$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
+
+//create an ellipse and fill it with white color
+imagefilledellipse($image, 50, 50, 40, 30, $white);
+
+ob_start();
+imagepng($image);
+$img = ob_get_contents();
+ob_end_clean();
+
+echo md5(base64_encode($img));
+?>
+--EXPECT--
+9ba540bba1b78c9f08efaa6fa0afd93b