227 Commits

Author SHA1 Message Date
Kovid Goyal
50e5b339b2 Fix failing test 2024-12-24 09:59:38 +05:30
Kovid Goyal
24a195c7c7 Graphics: Fix deletion of images by id not working for images with no placements 2024-12-24 09:39:01 +05:30
Kovid Goyal
8facaf4fa0 Graphics: Fix deleted but not freed images without any references being incorrectly freed on a subsequent delete command 2024-12-18 09:25:06 +05:30
Kovid Goyal
cb2e1fcd04 Graphics protocol: Fix delete by number not deleting newest image with the specified number
Fixes #8071
2024-11-24 10:11:34 +05:30
Kovid Goyal
70d72b22d8 Graphics protocol: Clear any partially uploaded data for a chunked load when any delete command is received
Fixes #7968
2024-10-13 09:49:44 +05:30
Kovid Goyal
15d77c648d Speed up loading of background image
Use a persistent cache of RGBA data. Also as a free bonus, support more
image formats for the background image.
2024-07-23 15:10:54 +05:30
Kovid Goyal
30023d9d9c DRYer 2024-07-16 10:57:00 +05:30
Kovid Goyal
bc8c4ac3d6 migrate graphics code to verstable 2024-07-12 11:45:48 +05:30
Kovid Goyal
c410ab8a8f Hide graphics internal APIs 2024-07-12 11:45:48 +05:30
Kovid Goyal
beb42d571b Forgot to use aspect ratio calculation when only one of r/c is specified for determining cursor position and image cell overlaps. Fixes #7479 2024-05-28 21:30:26 +05:30
Kovid Goyal
e7c4069b91 Make code scanning happy 2024-04-30 11:05:31 +05:30
Kovid Goyal
82ab44826c Graphics: Fix aspect ratio of images not being preserved when only a single dimension of the destination rectangle is specified
Fixes #7380
2024-04-24 12:28:35 +05:30
Kovid Goyal
c19488f3be Graphics protocol: Add a new delete mode for deleting images whose ids fall within a range
Useful for bulk deletion. See #7080
2024-02-25 09:57:44 +05:30
Kovid Goyal
91013a4e05 Faster image cache key generation 2024-02-25 09:57:43 +05:30
Kovid Goyal
1c62b0f1ec ... 2024-02-25 09:57:43 +05:30
Kovid Goyal
9d4193f4ea Fix texture ref not useable on repurposed image object 2024-02-25 09:57:38 +05:30
Kovid Goyal
b560fe34c9 Give the functions for creating various objects unique names so they are easily recognized in macOS's non-fully-symolicated crash reports 2024-02-25 09:57:37 +05:30
Kovid Goyal
f45cd87488 Implement paused rendering for graphics 2024-02-25 09:57:33 +05:30
Kovid Goyal
7b963a2372 Allow texture references to outlive parent images
This is needed for paused rendering of images. Use a simple ref counting
scheme.
2024-02-25 09:57:33 +05:30
Kovid Goyal
e8d9ca4465 Graphics protocol: Improve display of images using unicode placeholders or row/column boxes by resizing them using linear instead of nearest neighbor interpolation on the GPU
Fixes #7070
2024-01-28 08:05:02 +05:30
Kovid Goyal
8c12086beb Dont store query images in disk cache and dont send their data to GPU 2024-01-27 13:41:59 +05:30
Kovid Goyal
37f0c8c0a8 Fix #6994 2024-01-15 10:18:03 +05:30
Kovid Goyal
c2b4df0666 No need to use fmemopen 2023-11-23 19:30:43 +05:30
Kovid Goyal
79f3692f1e Better PNG load error reporting 2023-11-23 19:16:43 +05:30
Kovid Goyal
c174c3cb38 ... 2023-10-27 15:49:37 +05:30
Kovid Goyal
52d5a4679f Graphics protocol: Support for positioning images relative to other images
Fixes #6617
2023-10-27 15:27:30 +05:30
Kovid Goyal
7cb392c7ab Use a hash table for images 2023-10-26 20:40:02 +05:30
Kovid Goyal
f8d5e30300 Use a hash table for image placements 2023-10-26 19:42:32 +05:30
Kovid Goyal
be5a0e8559 Same treatment for image and render data arrays 2023-10-26 16:29:13 +05:30
Kovid Goyal
7cffb2a714 Prepare for fast image/ref lookup via hashmap 2023-10-26 15:45:06 +05:30
Sergei Grechanik
63cc5d7e49 Fix erasure of unicode placeholder images on reset 2023-09-03 15:33:30 -07:00
Kovid Goyal
951951776a Ensure group_count is never zero in any ImageRef
Now group_count means the number of refs pointing to the same image from
that ref onwards. This is needed because we can index the list of refs
at any point when drawing not just at the start of a group.

Fixes #6594
2023-09-02 12:48:44 +05:30
Kovid Goyal
6c7a8f8fa9 Ensure usage of __attribute__(cleanup) never frees un-initialized memory
Use macros that take an initializer parameter to, thereby ensuring the
variable to be cleaned up is always initialized.
2023-08-07 12:24:18 +05:30
Kovid Goyal
9415a56b0f add a comment explaining the purpose of the function 2023-06-22 19:40:08 +05:30
Kovid Goyal
248301f8b3 Cleanup a bunch of shader infrastructure
1) No longer us glScissor. It's an awful API and is not available in
   Vulkan. Instead the graphics drawing code ensures the graphic is
   drawn within the current viewport

2) Use generated code to automatically get the locations of uniforms
   from shaders. Greatly simplifies adding new uniforms to a shader.

3) Dont use a VAO for loading graphics vertices. Greatly simplifies
   a bunch of book keeping code.
2023-06-22 19:38:05 +05:30
Kovid Goyal
a4373ec8b4 Fix graphics being scaled during live resize 2023-06-21 06:17:35 +05:30
Kovid Goyal
a4f2f1b601 DRYer 2023-06-20 21:10:23 +05:30
Kovid Goyal
c66e4ced56 Preserve text size during live resize 2023-06-20 19:41:57 +05:30
Kovid Goyal
7d2ac765a4 Dont check for allowed filepath for SHM transfers 2023-05-28 11:59:05 +05:30
Kovid Goyal
624007c7aa Refuse to read image files in /proc /sys and /dev
Also, open the image file with O_NONBLOCK to ensure we dont hang opening
a FIFO
2023-05-25 12:17:03 +05:30
Kovid Goyal
046eb86091 Only move graphics on resize if the actual num of content lines chages
Avoids spurious moves when the window is not full and therefore text
does not move on vertical resize
2023-05-24 15:40:41 +05:30
Kovid Goyal
a720ef6917 Graphics: Move images up along with text when the window is shrunk vertically
Fixes #6278
2023-05-24 15:18:58 +05:30
Kovid Goyal
52afc79476 Fix re-using an image id for an animated image for a still image causing a crash
Fixes #6244
2023-05-06 09:37:55 +05:30
Kovid Goyal
a7ed47575e Improve documentation for Unicode placeholders 2023-03-03 12:45:52 +05:30
Kovid Goyal
8add28de96 Merge branch 'pr-unicode-placeholders' of https://github.com/sergei-grechanik/kitty 2023-03-03 10:55:02 +05:30
Kovid Goyal
1bf180f354 Allow loading window background images from memory 2023-03-01 16:11:38 +05:30
Sergei Grechanik
d63eeada73 Image placement using Unicode placeholders
This commit introduces the Unicode placeholder image placement method.
In particular:
- Virtual placements can be created by passing `U=1` in a put command.
- Images with virtual placements can be displayed using the placeholder
  character `U+10EEEE` with diacritics indicating rows and columns.
- The image ID is indicated by the foreground color of the placeholder.
  Additionally, the most significant byte of the ID can be specified via
  the third diacritic.
- Underline color can be optionally used to specify the placement ID.
- A bug was fixed, which caused incomplete image removal when it was
  overwritten by another image with the same ID.
2023-02-21 18:23:16 -08:00
Kovid Goyal
b408abe304 Move compile_commands.json to build directory 2023-01-26 14:25:22 +05:30
Kovid Goyal
a548e3eb4d Fix some animations pausing before starting 2023-01-04 11:18:17 +05:30
Sergei Grechanik
32d8aac808 Fix scrolling images within margins
This commit fixes an off-by-one error in image scrolling that caused
images to not be scrolled or to be cropped at the wrong line.
2022-12-25 15:34:54 -08:00