Commit Graph

47 Commits (master)

Author SHA1 Message Date
مهدي شينون (Mehdi Chinoune) 7efcf4f935
Some fixes for MINGW (#828)
* Enable webpng on MINGW

* Detect GD version using cmake language

* Use _aligned_malloc instead of posix_memalign on Windows

* Include missing "errno.h"

* Fix finding WEBP on MINGW

* Fix finding XPM on MINGW

* Use PkgConfig to find packages on MINGW

* CI: Enable more options  for MINGW
2022-04-15 15:34:24 +07:00
Pierre Joye 3f08a018cb
Fix #815, gd_topal, explicit null dereferenced (kind of false positiv… (#816)
* Fix #815, gd_topal, explicit null dereferenced (kind of false positive however it does hurt to add that check)

* Fix #815, != NULL
2022-01-31 11:46:15 +07:00
Tim Gates f7e57be725 docs: Fix a few typos
There are small typos in:
- examples/copyrotated.c
- src/gd.c
- src/gd.h
- src/gd_avif.c
- src/gd_nnquant.c
- src/gd_tga.c
- src/gd_topal.c
- src/wbmp.c
- tests/avif/compare_avif_to_png.c

Fixes:
- Should read `requires` rather than `reqiures`.
- Should read `of the` rather than `ofthe`.
- Should read `memory` rather than `memmory`.
- Should read `maximum` rather than `maxmum`.
- Should read `intersection` rather than `intertersection`.
- Should read `hypotenuse` rather than `hypothenus`.
- Should read `flexibility` rather than `flexibilty`.
- Should read `always` rather than `alwasy`.
- Should read `also` rather than `alos`.
2021-09-23 01:13:40 -04:00
Ken Brown 529c471f7b Fix #479: Provide a suitable malloc function to liq
liq requires 16 byte alignment, which gdMalloc() doesn't guarantee.
Define and use a new malloc16() function when building with liq.
2018-11-16 00:42:52 -05:00
Mike Frysinger fd06f7f83c clean up trailing whitespace/newlines
This is preparation for adding some linting checks for new commits from
people.  Shouldn't be any functional changes here (tests still pass!).
2018-06-21 22:47:42 -04:00
Christoph M. Becker 25e18ebce8 Improve documentation of truecolor to palette conversion 2016-09-21 14:14:27 +02:00
Christoph M. Becker 408ea5e5c3 Fix #307: GD_QUANT_NEUQUANT fails to unset trueColor flag
Before we copy the quantized palette image onto the original image, we have
to mark the latter as palette image. We also have to free the allocated
truecolor pixels; free_truecolor_image_data() does all that for us.
2016-09-21 12:42:49 +02:00
Christoph M. Becker 096f843e85 Revert "Fix #307: GD_QUANT_NEUQUANT fails to unset trueColor flag"
This reverts commit a74909b9a4.
2016-09-21 00:29:22 +02:00
Christoph M. Becker a74909b9a4 Fix #307: GD_QUANT_NEUQUANT fails to unset trueColor flag
We must unset the trueColor image after converting it; gdImageCopy() wont't
(rightly) do that for us.
2016-09-21 00:15:47 +02:00
Christoph M. Becker 466d440002 Improve documentation 2016-09-15 14:59:21 +02:00
Christoph M. Becker 24b4550fa8 Fix PHP bug #67325: imagetruecolortopalette: white is duplicated in palette
gdImageTrueColorToPalette() is sometimes wasteful by putting multiple white
color entries into the palette. This is caused by an obvious typo, where
to avoid a division by zero when `total` is zero, `count` is checked instead
of `total`.

We fix this issue, to improve the quality of the color quantization.
2016-09-03 17:48:03 +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
Pierre Joye bcc3d53a55 we need unsigned char storage here, not unsigned char *, aka allocate the right size 2016-06-19 15:59:43 +07:00
Mike Frysinger c9a4a85f38 libimagequant: fix integration
The symbol was being set up in cmake but not on the autotools side.
Clean this up to be like other external libraries.

We need to pull in some openmp logic as it's not uncommon for the lib
to be built with openmp support.  When we test for it, we need to do
so with openmp flags.

Fixes #137.
2016-05-18 03:03:50 -04:00
Jitendar Kumar 312b020fa1 Update gd_topal.c
Update `*cimP`, before null checking `nim`.
return `FALSE` if `nim` is NULL, or else copy and destroy the image and return `TRUE`.
2015-04-22 11:24:15 +05:30
Jitendar Kumar 4cf53078a2 Missing nullcheck in gd_topal.c
Issue : gdImageNeuQuant() may possibly return NULL pointer.

nim can hold NULL value.

Should be NULL checked.
2015-04-22 10:17:56 +05:30
Ondřej Surý f0ddf2eccd Introduce gdReallocEx which will free the original memory when realloc
fails to circumvent lost memory when doing:

    a = gdRealloc(a, s);
    if (!a)
        return;

Thanks to Niels Thykier for catching that.
2013-05-20 21:10:28 +02:00
Ondřej Surý e432fcabd0 WS & CS 2013-04-30 09:14:20 +02:00
Ondřej Surý 15ea6bc5a1 Fix several uninitialized variable reads, dereferences before NULL checks, resource leaks and some other minor errors 2013-04-08 12:53:52 +02:00
pierrejoye e20413bf6b - apply same CS everywhere 2013-04-03 14:23:11 +02:00
Takeshi Abe c8a4be7d73 avoid the C99 flavor 2013-03-27 21:11:05 +09:00
Kornel Lesiński 77fcf312e6 Include config.h for LIQ 2013-03-27 01:46:40 +00:00
Kornel Lesiński 6de104fdad Reverted unrelated whitespace changes
--HG--
branch : liq
extra : rebase_source : 6c5f1e173348b97be6b31ea67c2b174c1094d262
extra : histedit_source : d33be583abd05b908a7d0bf47ad46f2c85de8c9e%2Cb4a6bc74922a2105d2a14894f4d47cb77c61de63
2013-03-27 01:06:44 +00:00
Kornel Lesiński 34a00a40fb API change: Return whether gdImageTrueColorToPalette() succeeded
--HG--
branch : liq
extra : histedit_source : 2191518b844770395136a641e7a7a336cf928d16
2013-03-25 23:28:49 +00:00
Kornel Lesiński b2a067f685 Whitespace/indent normalization
--HG--
branch : liq
extra : source : 0e39317ac3a7d3eea2cb7993a4a7d05431771f11
extra : histedit_source : 6bca726d6099106b5a7bd13561f4a37c5ebf58f7
2013-03-25 22:26:12 +00:00
Kornel Lesiński cfa23367ad Download libimagequant in cmakefile if needed
--HG--
branch : liq
extra : source : de3e993342bc3d4eefe4b638143a7657e0aafe62
extra : histedit_source : 961d951975c5df5b9da5848ce2b04777a2156890%2C12013ded8ac6e49f8af6e757daa1aad8299d3e65
2013-03-25 23:46:54 +00:00
Kornel Lesiński 46054d2327 Configurable speed/quality for LIQ and NeuQuant
--HG--
branch : liq
extra : source : 6143642cc64a259e77e67a093707054638d88a3f
extra : histedit_source : be9cda208ec8d2457a92a5f0ebc532e59f4b4a6b
2013-03-22 01:09:35 +00:00
Kornel Lesiński 3e41e98be6 Added optional support for libimagequant
--HG--
branch : liq
extra : source : 10af42bdcf385e81906f71f9df32e6cbe944bb09
extra : histedit_source : 908d51aa5c090b037b73d27952511d755696e88f%2Cc7a97cd44d133fb330ea150d1cebc2426fc0b8eb
2013-03-25 23:29:20 +00:00
Kornel Lesiński 81675d3901 Moved freeing of truecolor pixels to a function 2013-03-09 13:17:08 +00:00
Kornel Lesiński 4b20813579 Avoid NULL pointer dereference by checking if parent struct has been allocated first
--HG--
extra : rebase_source : 2755ec5ce2de7dc7046dc13e3f77a880222290f9
2013-03-09 13:06:16 +00:00
Kornel Lesiński 1d9a609b5f Removed defunct support for ORIGINAL_LIB_JPEG quantization
--HG--
extra : rebase_source : 9e3467943ba45505115dbc8e139d18026defe4e3
2013-02-24 11:56:17 +00:00
tabe 3aaf1ab557 fix -Wunused-parameter 2013-02-11 11:31:40 +09:00
pajoye 80e78e432a #14, set fserror after the check 2007-01-04 12:49:26 +00:00
pajoye 163a161a73 #35, Added sanity checks for allocations failure in gd_topal (yet another.) 2007-01-03 21:57:34 +00:00
pajoye 0424e8717e - #15, gdImageCreatePaletteFromTrueColor(), colors allocated henceforth from
the resulting image overwrite the palette colors (Rob Leslie)
2007-01-03 19:14:00 +00:00
pajoye 565dbcc705 - #14, Fixed leak in jinit_2pass_quantizer (gd_topal.c) 2007-01-03 18:31:45 +00:00
pierre eeb94db2f2 - sync to 2.0.29 2006-04-05 15:54:20 +00:00
pierre b9d845987e - sync to 2.0.28 2006-04-05 15:53:57 +00:00
pierre b77f755a64 - sync to 2.0.24 2006-04-05 15:52:22 +00:00
pierre 0a3439a3e7 - sync to 2.0.23 2006-04-05 15:51:53 +00:00
pierre b14040d671 - sync to 2.0.17 2006-04-05 15:49:38 +00:00
pierre 871d0d852c - sync to 2.0.12 2006-04-05 15:47:57 +00:00
pierre 2399023b6c - sync to 2.0.9 2006-04-05 15:46:42 +00:00
pierre b0243fe7b1 - sync to 2.0.5 2006-04-05 15:44:56 +00:00
pierre b623f93e30 - sync to 2.0.4 2006-04-05 15:44:17 +00:00
pierre 1cdea7482e - sync to 2.0.1 2006-04-05 15:42:56 +00:00
pierre fceb93d2b9 - sync to 2.0.0 2006-04-05 15:42:22 +00:00