Commit Graph

168 Commits (1b6564cdc857df53e541613f63f5976b42de6c7d)

Author SHA1 Message Date
Christoph M. Becker 65d40f5aa5 Fix #319: gdImageRotateInterpolated can have wrong background color
We backport the fix for <https://bugs.php.net/65070>, and also the fix for
<https://bugs.php.net/70976> which was introduced by fixing 65070.
2016-10-03 16:19:19 +02:00
Christoph M. Becker 9a43a7b3fd Test and document the effects (aka. alpha blending modes) 2016-10-02 18:29:28 +02:00
Christoph M. Becker ddddd0a2ba Improve anti-aliased drawing related docs 2016-10-02 11:54:36 +02:00
Christoph M. Becker 30453e94b2 Test and document filling behavior of self-intersecting polygons 2016-10-01 20:03:14 +02:00
Christoph M. Becker 7f7a7d8eca Fix #315: Single-point gdImageAALine() is invisible
We're treating a single-pointed gdImageAALine() as we treat vertical and
horizontal gdImageAALines(); namely, we draw it non-antialiased.
2016-10-01 01:43:59 +02:00
Christoph M. Becker c3cf674cb4 Fix overflow checks
We check for the proper sizeofs and add the additional sx*sy check for
gdImageCreate(), which serves as a quick check for totally oversized images.
2016-09-30 17:37:00 +02:00
Christoph M. Becker 0423df1131 Improve documentation 2016-09-15 23:36:49 +02:00
Christoph M. Becker 466d440002 Improve documentation 2016-09-15 14:59:21 +02:00
Christoph M. Becker 4b840e8216 Fix #300: gdImageClone() assigns res_y = res_x
We fix the obvious typo in gdImageClone(), add a regression test and improve
related documentation.
2016-09-12 23:59:51 +02:00
Christoph M. Becker 2fe471d5d4 Fix #299: Regression regarding gdImageRectangle() with gdImageSetThickness()
We remove the special casing for "point" rectangles with thick!=1 altogether,
and restrict the special casing for "line" rectangles to thick==1. We move
this necessary special casing (it fixes issue #172) towards the bottom of the
function like it is in PHP's bundled libgd.
2016-09-12 22:08:19 +02:00
Christoph M. Becker 4e8a94d36d Test and document gdImageRectangle
We're especially having a look at the point ordering issue, see
<https://github.com/libgd/libgd/issues/177>.
2016-09-12 14:33:17 +02:00
Christoph M. Becker 4933e316f4 Document image accessor macros 2016-09-11 17:54:14 +02:00
Christoph M. Becker c1804def24 Mark up code examples with (start|end code)
This makes the code better readable in the sources, and we get syntax
highlighting in the generated HTML wherever we want it (i.e. not necessarily
always as with `-hl all`).
2016-08-23 22:27:27 +02:00
Christoph M. Becker 4143073c88 Improve documentation of built-in fonts and their handling 2016-08-14 17:31:54 +02:00
Christoph M. Becker b0333689ef Document all BGD_DECLARE'd functions
We add only minimal documentation comments for now, but at least that lets
Natural Docs add the function prototypes to the documentation.
2016-07-20 21:24:48 +02:00
Christoph M. Becker b4f985a11d Merge branch 'pull-request/262' 2016-07-19 13:56:49 +02:00
Christoph M. Becker a212f60114 Merge branch 'pull-request/261' 2016-07-19 12:13:18 +02:00
Pierre Joye add4733944 Merge branch 'master' of github.com:libgd/libgd 2016-07-19 14:46:08 +07:00
Pierre Joye 0dd40abd6d fix possible OOB or OOM in gdImageScale, reported by Secunia (CVE 2016-6207) 2016-07-19 14:45:56 +07:00
Pierre Joye 118fc7098b php bug 72519, invalid color index for transparent color can lead to OOB 2016-07-19 14:38:26 +07:00
Christoph M. Becker e7e20d67d7 No pixel of a filled arc must ever be drawn multiple times
Otherwise we get artifacts regarding transparency. That happens with the
current implementation of gdImageFilledArc() unless gdChord or gdNoFill
are set. When gdPie is set, however, the filled arc is drawn in wedges,
which are polygons of three points, and so some overlap is natural.

To resolve the issue, we stick with the current algorithm of calculating the
wedges, but instead of drawing each polygon separately, we put the *relevant*
points in a large array, and draw a single polygon. That also is supposed to
improve the performance considerably.

Note that this modification will change the results when gdImageSetStyle()
or gdImageSetBrush() are used, but we believe that this modification is
also an improvement in this regard, even though it still might not make much
sense to use these functions with gdImageFilledArc().
2016-07-17 18:41:17 +02:00
Christoph M. Becker 9fd6021e12 Fix #252: gd_error() garbles variable arguments
Currently gd_error() forwards to gd_error_ex(). However, both functions
accept a variable number of arguments, and simply forwarding the va_list
isn't portable, see <http://c-faq.com/varargs/handoff.html>. This article
also describes the usual workaround, namely to let the second function
accept a va_list instead of variable number of arguments.

We do so by introducing a static helper, what does not affect API/ABI
compatibility.
2016-07-17 14:53:42 +02:00
Pierre Joye eafff87699 Merge branch 'GD-2.2'
* GD-2.2:
  fix CID 95837 duplicate code
  ensure null terminated string
  Fix #234: gdinterpolatedscale/gdTrivialResize is too slow
  ensure null terminated string
  Fix Coverity #95850: Structurally dead code
  Fix Coverity #102122: Unused value
  Fix Coverity #95850: Structurally dead code
  Fix Coverity #102122: Unused value
  Fix PHP bug #64641: imagefilledpolygon doesn't draw horizontal line
2016-06-21 12:17:46 +07:00
Pierre Joye f3b17253cb fix CID 95837 duplicate code 2016-06-21 12:17:26 +07:00
Christoph M. Becker b331c55f58 Fix PHP bug #64641: imagefilledpolygon doesn't draw horizontal line
As reported in <https://bugs.php.net/64641> 1-dimensional horizontal
filled polygons are not drawn at all. That is caused by the scanline
algorithm used for drawing filled polygons which skips the drawing of
horizontal edges, because that is normally not necessary. If, however,
the polygon consists of horizontal edges only, that obviously doesn't
work, so we add a special case handling.

(cherry picked from commit f9f10fa9d4)
2016-06-20 14:43:03 +02:00
Christoph M. Becker f9f10fa9d4 Fix PHP bug #64641: imagefilledpolygon doesn't draw horizontal line
As reported in <https://bugs.php.net/64641> 1-dimensional horizontal
filled polygons are not drawn at all. That is caused by the scanline
algorithm used for drawing filled polygons which skips the drawing of
horizontal edges, because that is normally not necessary. If, however,
the polygon consists of horizontal edges only, that obviously doesn't
work, so we add a special case handling.
2016-06-20 14:16:23 +02:00
Christoph M. Becker 0b9fe91679 Merge branch 'GD-2.2'
# resolved conflicts:
#	tests/gdimagerotate/bug00067.c
2016-06-15 17:55:38 +02:00
Christoph M. Becker c2b91dbce5 Fix #167: Styled thick horizontal lines are scrambled
Thick lines are drawn by gdImageFilledRectangle(), which iterates over
the x ordinate first (Z order) to apply the style pattern. While this works
fine for vertical and diagonal lines, it obviously fails for horizontal
lines, which have to be iterated over in N order.

To fix this bug, we introduce the helpers  gdImageFilled(H|V)Rectangle(),
which may be reused for other purposes as well.
2016-06-15 17:43:30 +02:00
Pierre Joye 45f16d0769 Merge branch 'GD-2.2'
* GD-2.2:
  fix #172 single line rectangle creates wriclers. Simplify test.

Conflicts:
	tests/gdimagerectangle/github_bug_00172.c
2016-06-09 10:56:18 +07:00
Pierre Joye 19788a221a fix #172 single line rectangle creates wriclers. Simplify test. 2016-06-09 10:50:30 +07:00
Pierre Joye 8438ce5dd6 Merge branch 'GD-2.2'
* GD-2.2:
  fix #215, invalid color index, missing case for invalid border
2016-06-08 11:23:57 +07:00
Pierre Joye 6f5c4084c1 fix #215, invalid color index, missing case for invalid border 2016-06-08 11:23:38 +07:00
Pierre Joye e8bfada239 Merge branch 'GD-2.2'
* GD-2.2:
  fix #215 gdImageFillToBorder stack-overflow when invalid color is used
  tests: add bug_github_18 to gitignore #18
  tests: fix typo in test name #18
2016-06-04 23:14:57 +07:00
Pierre Joye 77f619d482 fix #215 gdImageFillToBorder stack-overflow when invalid color is used 2016-06-04 23:09:01 +07:00
Christoph M. Becker 5a85d6c3e3 gdImageRectangle: support any relative points
Contrary to gdImageFilledRectangle(), gdImageRectangle() has the
documented limitation that the given points have to be the upper
left and the lower right corner, respectively.  However, libgd
already caters to upper right / lower left pairs, and not
catering to the other two combinations seems to be an oversight.

Fixes #177.
2016-05-20 11:03:37 -04:00
Ondřej Surý 4d29684fd4 CVE-2015-8874 2016-05-20 10:37:44 -04:00
Ondřej Surý 38241013cc CVE-2015-8874 2016-05-20 10:52:23 +02:00
Mike Frysinger 75c38f6b32 fix various gcc/clang warnings found with -Wall 2016-05-13 22:19:26 -04:00
sherif-elmetainy e87ec88e1c :fix and unit test for crash issue in gdImageFillTiled 2016-01-09 23:02:12 +02:00
Jitendar Kumar eaca20f1e6 Remove Deadcode in gd.c
In API gdImageLine()

if `dx == 0` Checked and return else if `dy==0` Checked and return. 

if ((dx == 0) && (dy == 0))  never TRUE , code has no impact , can be removed.
2015-04-22 11:48:39 +05:30
Pierre Joye 2b3130efe6 fix #90, actually copy src to dst 2015-01-17 08:34:07 +01:00
Pierre Joye 2f40d52ddc Fix #138, VS 2010 build error due to double semi column 2015-01-15 11:05:43 +01:00
Remi Collet 4af76c97a4 fix comment 2015-01-02 09:18:27 +01:00
Remi Collet 3c0d2203b2 Fix possible infinite loop (php bug report #68713)
- make code more legible (yy>=yy-1 seems ugly)
- fix mem leak, always free src->tpixels
2015-01-02 09:09:22 +01:00
Nathanael Jones 08eb6ee8e9 Restore support for alphaBlendingFlag value gdEffectAlphaBlend 2014-09-03 22:11:29 +00:00
Tim Toohey b39f92b195 Add overlay and multiply effects to gdImageSetPixel 2014-04-23 10:48:57 +10:00
Chris Reuter 275ac17bcc Started importing the old manual into Naturaldocs comments.
This changeset imports documention for gdImage to gdImagePng*() into
Natural Docs.  Documention is based on the text of the original
manual, version 2.0.36 but adapted to better suit the format.
Subsequent changesets will introduce docs for subsequent manual
entries.

naturaldocs, when present, is invoked by bootstrap.sh.  The completed
manual will be in docs/naturaldocs/html/index.html.  It can also be
explicitly invoked by running docs/naturaldocs/run_docs.sh.

This change also removed docs/naturaldocs/project/Menu.txt, since it
currently contains no non-generated content and is prone to introduce
noise into the changeset.
2014-01-07 15:29:06 -05:00
Chris Reuter bb1d4a044e Added documention for gdImageCreate() and type gdImage.
This change adds naturaldoc comments for the above function and type.
Text was adapted from the 2.0.36 manual.

It also fixes the formatting of the comment for gdInterpolationMethod
so that naturaldoc will extract it.
2013-11-18 18:21:28 -05:00
Remi Collet 837b73276d fix integer overflow in AAline, fixed issue #5 2013-06-10 10:15:18 +02:00
Remi Collet eca37d620a fix hangs in gdImageAALine (bug int overflow can still occur, need improvment 2013-06-10 09:30:29 +02:00