Commit Graph

1133 Commits (8df65487ff0ba98771ed865be80a2d47c91fcc4b)

Author SHA1 Message Date
willson-chen 8df65487ff drop support for VMS #453 2021-04-24 23:30:42 -04:00
Mike Frysinger b4eb70cf74 drop support for freetype <2.1.3
The configure script has already been requiring freetype-2.1.10+, so
this isn't really dropping old support.  Even then, 2.1.3 was released
in 2002, so users have had plenty of time to upgrade.
2021-04-24 23:27:45 -04:00
Mike Frysinger b2769ffe40 stop installing entities.h 2021-04-24 23:26:48 -04:00
Mike Frysinger d89be11633 open up 2.4.0 development for major(ish) changes 2021-04-24 23:21:42 -04:00
Khem Raj 93e53a7b80 replace uint32 with uint32_t and uint16 with uint16_6
uint16 and uint32 are now deprecated in libtiff and suggestion is to use
standard C99 types

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-04-23 02:13:46 -04:00
Ben Morss f6a111c632
Fix for libavif v0.8.2 (#680)
Don't return AVIF_RESULT_TRUNCATED_DATA, as this is normal for libavif <= 0.8.2. In our tests,
this makes tests pass with libavif 0.8.2.

Plus, we did a few things to stop compiler warnings - and added a newline to error output.

thanks @wantehchang for the collaboration here!

This fixes #677.
2021-03-16 12:26:17 -04:00
Ben Morss a29904a688
Set default AVIF encoding speed to 6 (#683)
Turns out that, in many cases, AVIF's default encoding speed (AVIF_SPEED_DEFAULT)
would be 0, the slowest possible speed.

The team's been working on making speed 6 a great compromise.
We should make this our default as well.
2021-03-16 12:19:06 -04:00
Martin Reboredo f7d12c91fa
Permit compilation with libheif version 1.7.0 (#686)
libheif versions that came before 1.9.0 don't support changing the output image chroma.
I did not notice that and it resulted with tests failures across other OSes that don't have
a much newer libheif.

See #678. Supersedes #685.
2021-03-16 11:53:16 -04:00
Mike Frysinger 2e40f55bfb release 2.3.2 2021-03-06 14:16:01 -05:00
Mike Frysinger 122799495c avif: fix build warnings in new code 2021-03-04 21:34:16 -05:00
Ben Morss f2aa2836ed
AVIF support (#671)
Demand for AVIF support on the web is growing, as the word gets out
about this new file format which allows higher-quality encoding at
smaller sizes.  Core contributors to major open-source CMSs are
interested in auto-generating AVIF images! They've been simply
waiting for support to appear in libgd.

This PR aims to meet the growing demand, and to help bring smaller,
more beautiful images to more of the web - to sites created by
experienced developers and CMS users alike.

This PR adds support by incorporating libavif in addition to the
existing libheif support.  It's generally felt that libavif has
more complete support for the AVIF format. libavif is also used
by the Chromium project and squoosh.app.

In this PR, I've endeavored to incorporate the latest research into
best practices for AVIF encoding - not just for default quantizer
values, but also an algorithm for determining the number of
horizontal tiles, vertical tiles, and threads.

Fixes #557.
2021-03-03 21:35:56 -05:00
az6667 fc38677e80
Allow GIFs missing both Global and Local Colormaps to still decode (#494)
Ensure that a GIF without any Global or Local color tables is still
decoded by libgd.

GIF89a spec indicates conforming image files need not have
Global or Local color tables at all.

Spec recommends creating custom color map in that situation, and
that at least Black+White as first two entries, to ensure B&W images
are decoded.

Some commonly used single-pixel GIFs found around the web are
undecoded by libgd otherwise. Test case has been included.

References:
https://www.w3.org/Graphics/GIF/spec-gif89a.txt
http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
2021-03-03 02:17:51 -05:00
Mike Frysinger a9a5b45983 drop redundant strcasecmp define
The common gd.h already provides this.
2021-03-03 02:08:46 -05:00
Martin Reboredo 39c4644fa0
HEIF support through libheif (#670)
With the adoption of AVIF by Firefox and Chromium based browsers (still
in experimental phase), the newer incorporation of HEIF by Canon and Sony 
in their cameras and the newer support of both of them in modern software 
like ImageMagick, GIMP and Krita, `gd` haven't seen any endorsement for
the formats up until this PR.

Reading and writing is done by `libheif`, with functionality for chroma 
subsampling (for now `4:2:0`, `4:2:2` and `4:4:4`), quality (with new
`200` for lossless) and compression (whether `HEVC` or `AV1`) selection. 

This was tested with `libheif` version `1.11.0` in my Solus machine.

Also, fixes both #395 and #557.
2021-03-02 12:32:03 -05:00
Mike Frysinger d6e3413f7f drop unused snprintf fallback
This was added ages ago with code that has since been deleted.
2021-02-21 12:48:22 -05:00
Mike Frysinger 34048f3dac regen config.h.cmake to include new symbols 2021-02-20 03:08:39 -05:00
Mike Frysinger c0a55d9d00 add missing gd_intern.h include
I removed the local MIN/MAX macros, but missed adding the gd_intern.h
include when doing so.
2021-02-08 18:44:32 -05:00
Mike Frysinger e1f02d2833 gd_intern: unify the min/max/clamp macros some more 2021-02-05 22:47:13 -05:00
Mike Frysinger f538eedc7c gd_filename: constify & localize more
Mark the data structures & functions as const & static when possible,
and punt the unused FType enum.
2021-02-05 00:45:55 -05:00
WilliamHeaven 4dd5f43bc6 Fix copyright format problem 2021-02-01 22:39:33 -05:00
wilson chen 75ef79c9b0
release-2.3.1 (#668) 2021-01-30 15:16:05 +08:00
Mike Frysinger 82b08997c1 gd_io: replace internal Putchar with gdPutC
Most code is already using gdPutC instead of Putchar -- only the bmp
module is using Putchar.  It's unclear why we have this other form as
they should be equivalent: gdPutC takes an unsigned char (8-bits) and
then calls ctx->putC while Putchar takes a signed int, masks it with
0xff, and then calls ctx->putC.

The history of these funcs goes back to when it's initially imported
as part of the 1.5.0 release, and there doesn't seem to be any notes
as to why.

So change bmp to use gdPutC so we can delete Putchar entirely.  The
function isn't exported so no one should even notice.  Our tests are
still passing, so hopefully that provide good coverage.
2021-01-11 19:15:17 -05:00
Mike Frysinger 8d63967a52 gd_io: trim unused Putword function 2021-01-11 18:53:50 -05:00
Christoph M. Becker 9ed642764c Fix potential integer overflow detected by oss-fuzz 2020-08-24 17:03:07 +02:00
Remi Collet 0be6aec0fe Fix #615 using libraqm
and avoid unneeded free
2020-07-15 09:45:07 +02:00
wilson chen 28ecfe77c8
fix #303: gdlib.pc: use Requires instead of Libs (#537) 2020-06-18 14:55:32 +08:00
Marek Skalický 4abc26cca6
Compute average in gdGuessBackgroundColorFromCorners properly (#483) 2020-05-13 19:19:08 +08:00
Christoph M. Becker 3dd0e308cb
Fix #615: gdImageStringFT() fails for empty strings as of libgd 2.3.0 (#633)
We change the return type of `textLayout()` to `ssize_t`, and signal
failure by returning `-1`, so that laying out an empty string is no
longer handled as failure.  We make sure that no overflow occurs,
assuming that all `int` values can be fully represented as `ssize_t`.
2020-05-05 18:02:45 +08:00
Remi Collet d3185dcfb6 fix typo but preserve BC 2020-04-15 09:11:01 +02:00
wilson chen da50dce3ba
src/config.h.cmake: replace #cmakedefine01 with #define in macro ENABLE_GD_FOORMATS (#622)
Although we have a document describ the avaiable options
are ENABLE_XXX=1/0, there must some one are familar with
ENABLE_XXX=ON/OF.  If ENABLE_GD_FORMATS=ON is used, it will
result that GD formats is not enabled actually.
2020-04-14 23:30:18 +08:00
willson-chen ce00fbff0e Move initial declaration out of `for` loop
'for' loop initial declarations are only allowed in C99 mode.
2020-03-25 11:41:44 +08:00
Benjamin Kramer 3d2bd757f0
Make gd_nnquant.c less likely to introduce duplicate definitions (#601)
This file contains some accidentally global symbols with generic names.
Give them internal linkage (or remove if unused) to avoid conflicts when
linking another library that happens to use the same generic names.
2020-03-23 23:25:24 +08:00
willson-chen 3b38ad28fd src/gd.h: Update version 2020-03-22 21:40:02 +08:00
Kleber Tarcísio 954f427ea9 gdcache: fix main function error
First argument of ‘main’ should be ‘int’.
2020-03-21 21:31:48 +08:00
wilson chen 3f50ffaefd
Fixed #596: gdTransformAffineCopy run error
And add test case for it.
2020-03-21 15:31:40 +08:00
wilson chen 04bb9a08b3
Fix #301: brect bounds
According to the result, the extra one pixel is unnessary. Deleting the related code block makes
the image looks fine.
2020-02-25 23:40:27 +08:00
wilson chen ace7fd88dc
Fixed #169: update var type to hold bigger w&h for ellipse (#565)
Update var type to hold bigger w&h for ellipse. And add corresponding test cases.
2020-02-09 22:13:26 +08:00
Christoph M. Becker a702897fb2 Revert accidential changes to config.h.cmake
These happened with commit 9088591eae.
2020-01-06 09:45:37 +01:00
Christoph M. Becker a9e66268f9 Fix #586: gdTransformAffineCopy() segfaults on palette images
We have to properly distinguish between truecolor and palette images.
2020-01-05 00:21:08 +01:00
Christoph M. Becker 9088591eae Fix #585: gdTransformAffineCopy() changes interpolation method
We have to properly initialize `interpolation_id_bak`.
2020-01-04 23:43:47 +01:00
Christoph M. Becker 6d21d30429 Fix #584: gdImageSetInterpolationMethod(im, GD_DEFAULT) inconsistent
We have to avoid the unintended fall through.
2020-01-04 19:06:51 +01:00
Christoph M. Becker 7a06c1669c Fix #583: gdTransformAffineCopy() may use unitialized values
We have to check the return value of `gdAffineInvert()`, and on failure
let `gdTransformAffineCopy()` fail as well.
2020-01-04 19:06:51 +01:00
wilson chen 13705fe80f
gdcache: improve gdcache test compile cmd 2019-12-22 23:04:29 +08:00
Fábio Cabral Pacheco a93eac0e84 Fix potential NULL pointer dereference in gdImageClone() 2019-12-20 17:19:54 +01:00
wilson chen 2e886046f8
Fix #497: gdImageColorMatch Out Of Bounds Write on Heap (CVE-2019-6977)
Fixed CVE-2019-6977 and add corresponding testcase.

Original patch by Christoph M. Bechker <cmbecker69@gmx.de>
https://gist.github.com/cmb69/1f36d285eb297ed326f5c821d7aafced
2019-12-20 10:12:04 +08:00
willson-chen 4b0f372402 Fixed #369: fix new_a init error in gdImageConvolution() 2019-12-13 10:54:25 +01:00
Christoph M. Becker 48ffba3f1b Fix GD build with -D SIGNED_COMPARE_SLOW
Apparently, this has not been tested for a long time, and might be a
refactoring relict.  Anyhow, we have to pass the context to
`GIFNextPixel` as well.

This issue has been reported by Kleber Tarcísio.
2019-11-21 20:07:20 -05:00
wilson chen b73137fcd4 Remove config.h in gdpp
Remove config.h & jpeg defines in gdpp.h & gdpp.cxx.
2019-11-18 23:09:44 -05:00
willson-chen ac7118680d Fix #539: Add RAQM support for cmake
* Add `ENABLE_RAQM` option to CMakeLists.txt
* Add cmake module FindRAQM.cmake
2019-11-02 00:59:43 -06:00
willson-chen b2011428f5 fixed cmake failed with MinGW
If BUILD_STATIC_LIBS is not On, cmake will failed for target ${GD_LIB_STATIC} doesn't exist.
2019-09-29 12:56:39 -04:00