this treats quality == 100 as lossless similar to some other savers.
in case of lossless encoding, compression is derived from "quality" if
compression_tag was not set. in case of lossy encoding, the default is
used when compression_tag isn't set.
additionally, this fixes a bug in the older saver where fwrite might
have been called with a null fdata (which is UB) in case of an error.
Also:
- gif loader: Add error about corrupt frame sequence
- tiff loader: Drop OOM message - Not done elsewhere
- webp loader: Drop messages about quality tag outside [0-100] -
Not done elsewhere
This should make things slightly more consistent and unambiguous, and
the stdint types are already used here and there (in loaders).
I'm not aware of any systems where this change makes any difference.
If there are targets out there with 64 bit ints imlib2 might now work
there and on targets with 16 bit ints it most likely still doesn't.
as far as i can tell, iter is being used uninitialized here leading to
reading garbage values resulting in the last frame always being selected
when key is present.
Patch from Daniel Friesel <derf@finalrewind.org>:
---
Fix .gif loader if filename does not end in .gif
Imlib2 is currently unable to load gif images if the filename does not end in
.gif. This appears to be caused by imlib2 not resetting the file descriptor
back to 0 after trying to open the image with its different loaders.
While imlib2 does call rewind(FILE* im->fp) before invoking each loader, this
does not guarantee that the underlying FD is seeked as well. However, the GIF
loader uses the FD directly, and therefore tries to read from the middle of the
file (unless it is the first loader). This patch adds an explicit seek in the
same fashion as implemented in the TIFF loader.
Patch and debugging credits go to Lars Stoltenow.
---
Also fix same issue in TIFF and WEBP loaders.
im->w and im->h must always be set before __imlib_AllocateData() is
called due to non-immediate loading (__imlib_AllocateData() only
comes in play when the pixel data must be loaded).
Summary:
... and add imlib_create_image_using_data_and_memory_function().
For example, it allows to load an image in one process and then
pass it through shared memory to another process without extra
memory copy.
Reviewers: kwo
Differential Revision: https://phab.enlightenment.org/D10222