Kim Woelders
8af7975804
x11_grab: Various fixes in __imlib_GrabDrawableScaledToRGBA()
...
- Fix clipping to source.
- Fix error when mask from shape is requested but drawable is pixmap.
- Use queried drawable depth, not the context one.
This eliminates the last usage of the context depth in the grabbing
functions.
2023-03-06 06:59:04 +01:00
Kim Woelders
3b21892c77
x11_grab: Clear image pixels not actually grabbed
...
When using imlib_create[_scaled]_image_from_drawable() with non-zero
source offsets the output image could contain pixels either not set or
copied from uninitialised parts of intermediary pixmap.
2023-03-06 06:58:48 +01:00
Kim Woelders
e41499a528
x11_grab: Rework clipping
...
Source clipping in imlib_copy_drawable_to_image() was broken and is
already dealt with in __imlib_GrabDrawableToRGBA().
Destination clipping has now been added.
2023-03-06 06:57:32 +01:00
Kim Woelders
de79c704eb
x11_grab: Move window/pixmap checking to separate function
2023-03-06 06:57:32 +01:00
Kim Woelders
3ab9498777
x11: Pass X11 context around by struct
...
A bit nicer, I think.
2023-03-06 06:53:06 +01:00
Kim Woelders
51d74520fc
test_grab: Check get-mask-from-shape too
...
Since only pixmap grabbing is tested for now, testing mask handling
just checks that we don't do something silly (like getting shape from
pixmap).
2023-03-05 19:24:50 +01:00
Kim Woelders
567bb5aa75
test_grab: Add some tests for imlib_copy_drawable_to_image()
2023-03-05 19:24:13 +01:00
Kim Woelders
31c8f06215
test_grab: Update
2023-03-05 19:24:13 +01:00
Kim Woelders
c47e18d571
imlib2_view: Add option to set background checkerboard field size
2023-03-01 11:03:15 +01:00
Kim Woelders
8d3539234d
x11_grab: Drop now unused 1:1 scaling path in __imlib_GrabDrawableScaledToRGBA()
2023-02-19 22:36:46 +01:00
Kim Woelders
5ea6a407cf
imlib_create_scaled_image_from_drawable(): Simplify call path
...
On 1:1 scaling call __imlib_GrabDrawableToRGBA() directly instead of
going through __imlib_GrabDrawableScaledToRGBA().
This fixes 1:1 grabbing of pixmaps.
Non-1:1 pixmaps grabs are still not ok (window grabs are).
2023-02-19 22:35:58 +01:00
Kim Woelders
61097080e5
x11_grab: Eliminate unnecessary pixmap copy
...
Speeds up 1:1 scaling with non-zero source offset in
imlib_create_scaled_image_from_drawable().
2023-02-19 17:53:11 +01:00
Kim Woelders
f54961f0cd
x11_grab: Let __imlib_Grab..() return error instead of ok
2023-02-19 17:17:22 +01:00
Kim Woelders
9657d6a291
test_grab: Rearrange code
2023-02-19 16:57:20 +01:00
Kim Woelders
702432f5ed
api: Oops - debug--
2023-02-15 21:14:15 +01:00
Kim Woelders
ce0ac1eeff
Add imlib_save_image_fd()
...
#7
2023-02-15 18:31:19 +01:00
Kim Woelders
1ba40142f7
api: Minor simplification in error handling in save functions
2023-02-15 18:23:34 +01:00
Kim Woelders
81a1d1d929
api: Cosmetics around image save functions
...
Consistently use "file" for the file name in save functions as well as
in load functions.
2023-02-15 18:22:39 +01:00
Kim Woelders
3840c6636c
api: Update documentation for imlib_get_error()
2023-02-15 18:22:39 +01:00
Kim Woelders
d52c1a5dae
api: Remove pointless statement
2023-02-14 20:01:07 +01:00
Kim Woelders
592bea9208
Loaders, savers: Handle EINTR during fopen()
...
Fixes potential error when saving to pipe in the presence of signals
(if nothing else).
#5
2023-02-04 11:02:19 +01:00
Kim Woelders
5352caecb3
PNG saver: Avoid potential clobber warning
...
Also remove some unnecessary png cleanup function calls.
All is done by png_destroy_write_struct(), which was even called twice.
2023-02-04 10:49:37 +01:00
Kim Woelders
2ad8d7d785
JPG saver: Avoid potential clobber warning
2023-02-04 10:49:37 +01:00
Kim Woelders
c3d524924e
Savers: Centralize file open/close
...
As done for the loaders a while back.
2023-02-04 10:49:37 +01:00
Kim Woelders
a81078e204
Loaders: Debug tweaks
2023-02-04 10:15:14 +01:00
Kim Woelders
fb19c620e8
Loaders: decompress_load() is not part of the loader API
2023-02-04 10:15:05 +01:00
Guilherme Janczak
84314f013f
remove bad unused function
...
__imlib_FileCanRead() suffers from TOCTTOU issues. The file behind the
path it takes as a parameter can change while the function executes, and
also between the function's return and the caller's use of the path.
The function is also unused, so just delete it.
2023-02-04 04:17:57 +00:00
Kim Woelders
829632a735
__imlib_FileDir(): Fix missing closedir() on OOM
...
Noted by NRK.
And some cosmetics.
2023-01-31 19:32:03 +01:00
Kim Woelders
5c226954c1
ANI, PNG, TGA loaders: Enable handling of unaligned data
...
Fixes warnings seen with -fsanitize=undefined when using
--enable-packed.
2023-01-29 10:25:08 +01:00
Kim Woelders
9222dad42d
autofoo: Add __PACKED__ for optional struct packing
2023-01-29 10:25:08 +01:00
Kim Woelders
d27354926a
Loaders: Avoid cast-align warnings with -Wcast-align=strict
2023-01-29 10:25:08 +01:00
Kim Woelders
6337c54d30
ANI loader: Use struct to access chunk data
2023-01-28 16:25:15 +01:00
Kim Woelders
495fb5e6f8
Loaders: Debug macro cleanups
2023-01-28 16:25:15 +01:00
Kim Woelders
8c6c40097e
x11_rgba: Avoid cast-align warnings with -Wcast-align=strict
...
Just silencing the warnings, assuming things are properly aligned.
2023-01-28 16:16:17 +01:00
Kim Woelders
09bb1a1c4c
x11_grab: Avoid cast-align warnings with -Wcast-align=strict
...
Just silencing the warnings, assuming things are properly aligned.
2023-01-28 16:16:17 +01:00
Kim Woelders
a910b58242
x11_rgba: Add missing const
...
Also add missing header.
2023-01-28 16:16:17 +01:00
Kim Woelders
00dcf6851f
PNM saver: Write images with alpha as P7 PAM RGB_ALPHA type
...
The previously used P8 type seems to be known only by imlib2.
2023-01-22 17:20:01 +01:00
Kim Woelders
1ca706b79a
test: test_save: Check that files are written and ok
2023-01-22 17:20:01 +01:00
Kim Woelders
87bd2fa58a
test: test_save: Trivial changes
2023-01-22 17:19:48 +01:00
Kim Woelders
9b9abcdc1e
test: Introduce image_get_crc32()
2023-01-22 17:14:52 +01:00
Kim Woelders
c8dcabc62a
PNM loader: Speedups
...
Eliminate copy of data to intermediary buffer.
2023-01-22 09:20:07 +01:00
Kim Woelders
ac4fb5e21f
imlib2_view: Be more verbose about load errors
2023-01-14 10:47:12 +01:00
Kim Woelders
66a5e03de6
imlib2_load: Show error on deferred data load problem
2023-01-14 10:47:12 +01:00
Kim Woelders
930243411e
api: Remember error on deferred image data loads
...
Now it can be fetched with imlib_get_error().
2023-01-14 10:47:12 +01:00
Kim Woelders
a856571312
Drop some redundant calls to __imlib_LoadImageData()
2023-01-14 10:47:12 +01:00
Kim Woelders
5d1083858c
image: Let __imlib_CreateImage() allocate pixel data buffer
...
..and check dimensions.
Does simplify things nicely.
2023-01-14 08:59:32 +01:00
Kim Woelders
5d16eb8bb8
api: Tweak/correct error handling in drawable grabbing functions
...
imlib_create_scaled_image_from_drawable() now returns NULL if the
drawable could not be grabbed, just as imlib_create_image_from_drawable()
has always done.
2023-01-14 08:59:32 +01:00
Kim Woelders
dafd7eb33d
api: Change some parameter names
...
- Shorten some names - mostly to avoid some line wrapping
source_... -> src_...
destination_... -> dst_...
- Change some parameter names for consistency/clarity
Change (x, y, width, height) to (src_x, src_y, src_width, src_height)
or (dst_x, dst_y, dst_width, dst_height) a couple of places.
2023-01-14 08:59:17 +01:00
Kim Woelders
a4e240bc96
api: Fix code duplication around some __imlib_BlendImageToImage() calls
2023-01-13 16:19:02 +01:00
Kim Woelders
207cffb207
Avoid some more undefined behaviors with shifts
2023-01-13 10:55:47 +01:00