1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00
Commit Graph

255 Commits

Author SHA1 Message Date
David Maciejak
e237ec15a0 wrlib: Added clean-up of image cache in 'RShutdown'
The library maintains a cache of the images loaded, which is now
emptyed when the lib is asked to shutdown.
2014-05-09 01:11:30 +01:00
David Maciejak
283286e0cd wrlib: Implemented functions to allow clean-up of Contexts
The function 'RDestroyContext' have been defined in the API for a long time
but did not have an implementation, this patch fixes it.
2014-05-09 01:11:30 +01:00
Christophe CURIS
f1a36b4c07 wrlib: do not initialize/release ImageMagick unnecessarily
Instead of calling 'MagickWandGenesis' every time an image is loaded, only
call it the first time, and similarly do not call 'MagickWandTerminus' if
the library has not been used before.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-08 20:14:22 +01:00
Christophe CURIS
ebe7673bf6 wrlib: moved 'RShutdown' from 'load.c' to 'misc.c' for consistency
The cleanup function is actually not specific to loading images and could
do a lot more, so it is probably better placed in 'misc.c'
2014-05-08 20:14:22 +01:00
Christophe CURIS
9a0c3ab737 wrlib: light changes to the code for ImageMagick
- changed header used for MagickWand to the one specified in the online
documentation

- changed a comparison to 'MagickTrue' because its value does not allow a
compiler optimisation that would be expected in present case

- fixed potential crash, if loading with Magick fails it could return a
pointer to a de-allocated area

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-08 20:14:21 +01:00
Christophe CURIS
f17ec34cce wrlib: fixed compilation to use the flags detected by configure for MagickWand
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-05-08 20:13:17 +01:00
Christophe CURIS
c3139e9d0c wrlib: fixed prototype for 'RShutdown' in the public API header
Took opportunity to move it closer to the beginning of the file to improve
its visibility to users of the lib
2014-05-08 20:13:17 +01:00
Christophe CURIS
ed072cd578 wrlib: revert addition of an internal ImgFormat for ImageMagick
IM_MAGICK is not a file format, and in the current implementation it is
a special case for handling IM_UNKNOWN.
2014-04-29 10:15:27 +01:00
David Maciejak
bb69682b88 wrlib: added support for imagemagick third-party lib
It uses to provide some missing common image format
like SVG, BMP, PICT, ...
2014-04-29 10:15:27 +01:00
David Maciejak
050cae3bd2 wrlib: Added support for webp image
This patch is adding support for google webp image format, if you
don't know it a quick recap is to say that according to their tests
they claim it is better than png and jpeg.

Follow the link below for some more details:
https://developers.google.com/speed/webp/

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:51 +01:00
David Maciejak
de1421394c wrlib: Fixed and improved NETPBM examples
The tests examples were not compiling because of a missing X11 lib.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:51 +01:00
Christophe CURIS
8b73356c4f wrlib: Improved file format detection
- remove header not needed anymore
- revert change for XPM to stay in line with the standard
- changed PNG to stuck to the standard
- increased GIF to the complete signature

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:51 +01:00
David Maciejak
92b803bbdf wrlib: Improved file format detection
load.c is used to identify the file format, I rebased some checks on
what is defined in the spec of the format.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:51 +01:00
Christophe CURIS
34ca63c59f wrlib: Improved NETPBM support
- re-add PPM to the list of supported format, because legacy apps may
expect to find it from the list;

- add the copyright notice related to the code that have been borrowed
from Netpbm;

- fixed a small error in PPM format check in the loading procedure;

- and a few minor code improvements

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:50 +01:00
David Maciejak
051a30f550 wrlib: Improvements to Netpbm memory usage on errors
This is actually taken from patch:
  wrlib: Added support for webp image

in which it is out of place as it is unrelated

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:50 +01:00
David Maciejak
5c96c69cb5 wrlib: Improved NETPBM support, file format detection
1) according to that checks i was able to see that some netpbm support
   type are missing (exactly: ascii graymap (PGM files) and pixmap (PPM)
   and ascii/binary bitmap (PBM))

See the link below for more details.
http://en.wikipedia.org/wiki/Netpbm_format

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-04-24 10:56:50 +01:00
Christophe CURIS
2658ed0fb2 WRaster: Added missing const attribute
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
062f6dd59d Code refactoring: replaced macro 'XSHM' by 'USE_XSHM' for consistency
The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:06 +00:00
Christophe CURIS
f7931ecd02 WRaster: Removed unused variables from Makefile
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
787036551f wrlib: Added noreturn attribute to appropriate functions
clang is a bit more strict on the attribute usage, so let's comply.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:05 +00:00
Christophe CURIS
c3a132215d wrlib: Renamed image format related files for clarity
This patch makes all files appear together when listing files and
it is more clear about their function.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
f619546af9 wrlib: Marked args as unused for compiler
The two functions require an argument which is used when the libXpm is
used, which means having the same argument list for the builtin code to be
permutable.

This patch adds the appropriate stuff to avoid a false report from the
compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
3b2362662e wrlib: Use a Conditional for XPM in the makefile instead of #if in source
Now that the builtin XPM loading is separated from the saving code, the
use of the conditionals provided by autotools provides a better result
as it avoids unnecessary compilation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
aa99207ab4 wrlib: separated the code to save to XPM from the builtin XPM loading
Big files are harder to work with, so split load and save, which
happen to already be independent anyway.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
b66a890404 wrlib: Moved configure's detection of XPM support to a dedicated macro
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.

The new macro:
 - uses as much as possible autoconf macros for portability and code
consistency;
 - provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
 - makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
 - uses an automake conditional to avoid compiling the file is support is
not enabled

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Christophe CURIS
a5ca34ccb1 wrlib: Moved configure's detection of TIFF support to a dedicated macro
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.

The new macro:
 - uses as much as possible autoconf macros for portability and code
consistency;
 - provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
 - makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
 - uses an automake conditional to avoid compiling the file is support is
not enabled

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:02 +00:00
Christophe CURIS
1c21d946ec wrlib: Moved configure's detection of PNG support to a dedicated macro
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.

The new macro:
 - uses as much as possible autoconf macros for portability and code
consistency;
 - provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
 - makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
 - uses an automake conditional to avoid compiling the file is support is
not enabled

It includes a typo fixed by Amadeusz S-B³awiñski.-A

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:02 +00:00
Christophe CURIS
777bf28ab3 wrlib: Moved configure's detection of JPEG support to a dedicated macro
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.

The new macro:
 - uses as much as possible autoconf macros for portability and code
consistency;
 - provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
 - makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
 - uses an automake conditional to avoid compiling the file is support is
not enabled

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:02 +00:00
Christophe CURIS
a7663fbbcf wrlib: Add support for v5 of the gif_lib API
As reported by Nicolas (nhs), compilation of wrlib is broken when
switching to gif_lib v5.

The API of gif_lib has known little change to provide thread-safe usage,
so we now detect this in configure and and use the functions as appropriate
in gif.c

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2013-12-30 18:11:02 +00:00
Christophe CURIS
7831acebe3 wrlib: Use a Conditional for GIF in the makefile instead of #if in source
The use of the conditionals provided by autotools provides a better result
as they avoid unnecessary compilation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2013-12-30 18:11:02 +00:00
Rodolfo García Peñas (kix)
82aea844d0 Removed context argument in jpeg files
The context argumetn is now not used, so can be removed.
2013-09-05 22:44:36 +01:00
Rodolfo García Peñas (kix)
d1f9b80171 Removed optimize_for_speed flag
The optimize_for_speed was used to set the Alpha channel for jpeg.
The alpha channel for jpeg should be used always. The current CPUs/GPUs can do
it without problems and this is an old behaviour.
2013-09-05 22:44:36 +01:00
Rodolfo García Peñas (kix)
f363292d3c gif.c code style
This patch removes some extra curly brackets, some empty lines,
extra spaces,...

This patch is not removing the goto calls. I am not sure if the code
is better without gotos.
2013-09-05 22:44:36 +01:00
Rodolfo García Peñas (kix)
2bdeb693f6 ppm.c code style
This patch removes some extra curly brackets, some empty lines,
extra spaces,...

This source file had some empty if blocks. Now are removed.

This patch also changes some preprocessor macros for C code.
2013-09-05 22:44:36 +01:00
Christophe CURIS
7bf8efef54 WRaster: Changed formula for reconverting angle to the (0-360) bounds
There is a dedicaded floating point modulo operator that does a
better job (faster, no precision loss), so we use it instead of the
complicated formula that uses type conversions.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-17 01:54:06 +01:00
Christophe CURIS
a622197faa Added explicit 'void' to function that takes no argument
This is the correct way to tell that a function takes no
arguments, because an empty parameter list tells the compiler
that it is not yet defined, and is tolerated only for
compatibility with very old C compilers for whom prototypes
were not yet a defined language element.
2013-05-12 01:01:20 +01:00
Christophe CURIS
8ef38e9910 WRaster: Changed equality/inequality comparison on floating point number
The equality comparison (a == b) is known to be a dangerous trap
when floating-point arithmetics are involved. This patch changes
all the cases which try to do this to a safer check.
2013-05-11 00:17:27 +01:00
Christophe CURIS
90d24a1648 Unified usage of the 'inline' attribute for functions
Autoconf provides the necessary stuff to detect if inline keyword
is supported, and to detect special syntaxes, so let's use this
and remove the multiple local definitions, this makes code simpler.
2013-05-11 00:17:27 +01:00
Christophe CURIS
591dc5cd4d wrlib: Added 'const' attribute to local function in 'context' 2013-05-09 16:56:28 +01:00
Christophe CURIS
ac89706859 WRaster: Bugfix, added missing 'const' to RLoad* functions
Prototype of function changed in commit
  d1e1c13fa3
but two of them were not updated in the source.

Thanks to Rodolfo García Peñas for taking the time to test and report.
2013-05-03 08:17:26 +01:00
Christophe CURIS
9e4253f670 Added the last missing 'const' attributes to function parameters 2013-05-02 20:48:45 +01:00
Christophe CURIS
0bf6297a32 Added 'const' attribute on non-modified arguments for color handling functions
These functions have both an input and an output color, marked the
input color as const to help distinguish.
2013-05-02 20:48:45 +01:00
Christophe CURIS
8f7d4b7751 Added 'const' attribute on non-modified arguments for drawing functions
All these functions expects agruments like color or list-of-points
that should not be modified (and are not) by the function; added
the corresponding qualifier to reflect that.
2013-05-02 20:48:45 +01:00
Christophe CURIS
d1e1c13fa3 Added 'const' attribute to the file name parameter to load/save
This name is not modified by the callee functions (and it should
not be anyway), so let's make it official in the internal functions
2013-05-02 20:48:45 +01:00
Christophe CURIS
225c99a6ca Converted #define into an Enum for image format number
An enum is always a better idea as it allows the compiler to do
some checks, and as this info is internal only to the WRLib it
will not change the API.
2013-05-02 20:48:45 +01:00
Christophe CURIS
268ead4eca Moved the function to Save image also into the internal header 2013-05-02 20:48:45 +01:00
Christophe CURIS
883cda48e3 Moved declaration of format-specific image Load functions to dedicated header
The functions are declared in different files but they were called
in another file which re-declared the prototypes. This is dangerous
as it can lead to misaligned prototypes when functions changes.

They are now grouped in the library internal header 'imgformat.h'
2013-05-02 20:48:45 +01:00
Andreas Bierfert
0b74ae4194 Include LGPL with correct FSF address
(see http://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt)
2013-01-07 21:19:56 +00:00
Andreas Bierfert
085224973a Fix incorrect FSF address 2013-01-07 21:19:40 +00:00
Kamil Rytarowski
0706471a10 Fix build with automake-1.13 and modernize .am files.
The following macro: AM_CONFIG_HEADER is deprecated and replaced with AC_CONFIG_HEADERS. INCLUDES is an old version of AM_CPPLAGS.
2013-01-03 23:27:31 +00:00