<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/sixel.c, branch 1.7.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.7.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2021-04-18T18:07:35Z</updated>
<entry>
<title>sixel: unhook: tighten up the condition needed for us to free image data pre-maturely</title>
<updated>2021-04-18T18:07:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T17:08:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7b0d2522ee204b83bbf4598528bc76fa503d3794'/>
<id>urn:sha1:7b0d2522ee204b83bbf4598528bc76fa503d3794</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: sixel_fini(): free image data</title>
<updated>2021-04-18T18:07:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T17:07:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8d06278a292f726c76ab023adea09ee74e82ec60'/>
<id>urn:sha1:8d06278a292f726c76ab023adea09ee74e82ec60</id>
<content type='text'>
Normally, this data is always free:d indirectly, when the sixel image
that took over ownership is destroyed. But let’s play it safe.
</content>
</entry>
<entry>
<title>sixel: fix double free caused by bad free() in sixel_colors_set()</title>
<updated>2021-04-18T18:07:02Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-30T09:08:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6e782271ff433d76e192a43739eb01f175bd1995'/>
<id>urn:sha1:6e782271ff433d76e192a43739eb01f175bd1995</id>
<content type='text'>
sixel_color_set() is called when the number of (sixel) color registers
is changed.

It frees the current palette, and changes the “palette size” variable.

Originally, we only had a single palette. This is the one free:d by
sixel_color_set().

Later, we added support for private vs. shared palettes. With this
change, we now have one palette that is “never” free:d (the shared
one), and a private palette that is always free:d after a sixel has
been emitted.

‘sixel.palette’ is a pointer to the palette currently in use, and
should only be accessed **while emitting a sixel**.

This is the pointer sixel_color_set() free:d. So for example, if
‘sixel.palette’ pointed to the shared palette, we’d free the shared
palette. But, we didn’t reset ‘sixel.shared_palette’, causing a double
free later on.

Closes #427
</content>
</entry>
<entry>
<title>sixel: free backing buffer if final image size is zero</title>
<updated>2021-03-28T11:22:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-28T10:57:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=19289bad5ef60f4c5ca2b45c0e495db60ed34267'/>
<id>urn:sha1:19289bad5ef60f4c5ca2b45c0e495db60ed34267</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: initialize max_non_empty_row_no to -1, not 0</title>
<updated>2021-03-28T11:22:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-28T10:55:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3566be591a971a118dca6edc263dd7eefaa5f648'/>
<id>urn:sha1:3566be591a971a118dca6edc263dd7eefaa5f648</id>
<content type='text'>
0 is a perfectly valid row number, and if max_non_empty_row_no==0,
that means we have *1* sixel row, and after trimming the image, the
image will have a height of 6 pixels.

If the sixel sequence is empty (or at least doesn’t emit any non-empty
pixels), then trimming the image should result in an image height of
0.

When max_non_empty_row_no is initialized to -1, it will still have
that value in unhook(), which makes the final image height 0.
</content>
</entry>
<entry>
<title>term: runtime switch between a ‘fast’ and a ‘generic’ ASCII print function</title>
<updated>2021-03-16T07:45:18Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-14T18:19:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=60b3ccc64115fb7e4b303eb1b93ba16d10fff1b5'/>
<id>urn:sha1:60b3ccc64115fb7e4b303eb1b93ba16d10fff1b5</id>
<content type='text'>
term_print() is called whenever the client application “prints”
something to the grid. It is called for both ASCII and UTF-8
characters, and needs to handle sixels, insert mode and ASCII
vs. graphical charsets.

Since it’s on the hot path, this becomes unnecessarily slow.

This patch adds a “fast” version of term_print(), tailored for the
common case: ASCII characters in non-insert mode, without any sixels
and non-graphical charsets.

A new function, term_update_ascii_printer(), has been added, and must
be called whenever:

* The currently selected charset *index* changes
* The currently selected charset changes (from ASCII to graphical, or
  vice verse)
* Sixels are added to the grid
* Sixels are removed from the grid
* Insert mode is enabled/disabled
</content>
</entry>
<entry>
<title>sixel: sixel_overwrite_at_cursor(): early exit when the image list is empty</title>
<updated>2021-03-14T13:19:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-14T13:19:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c5c3447ca8a71ab3cfd84a2b5fd2c193ef5b4fb4'/>
<id>urn:sha1:c5c3447ca8a71ab3cfd84a2b5fd2c193ef5b4fb4</id>
<content type='text'>
This avoids a call to sixel_overwrite_by_row() (where we also exit
early if the image list is empty).

This saves a couple of instructions to set up the arguments for
sixel_overwrite_by_row().
</content>
</entry>
<entry>
<title>sixel: max geometry should be max geometry, not current window size</title>
<updated>2021-03-14T09:58:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-14T09:58:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6eb68ffbd99cc48aa688e59a230b4fca98fe0cb5'/>
<id>urn:sha1:6eb68ffbd99cc48aa688e59a230b4fca98fe0cb5</id>
<content type='text'>
“current geometry” will report whatever value is the smallest; the max
geometry or the current window size.

But “max geometry” always returns the configured max geometry.

This aligns foot’s behavior with XTerm.
</content>
</entry>
<entry>
<title>sixel: implement P2=1 - transparent pixels</title>
<updated>2021-03-11T16:34:19Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-09T16:23:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7d315d7bf9ab0376468929f0e41fbac98370e035'/>
<id>urn:sha1:7d315d7bf9ab0376468929f0e41fbac98370e035</id>
<content type='text'>
When P2=1, empty pixels are transparent.

This patch also changes the behavior of P2=0|2, from setting empty
pixels to the default background color, to instead use the *current*
background color.

To implement this, a couple of changes are needed:

* Sixel pixels always use alpha=1.0, except for *empty* cells when
  P2=1 (i.e. transparent pixels).
* The renderer draws sixels with the OVER operator, instead of the SRC
  operator.
* The renderer *must* now render the cells beneath the sixel. As an
  optimization, this is only done for sixels where P2=1. I.e. for
  fully opaque sixels, there’s no need to render the cells beneath.

The sixel renderer isn’t yet hooked into the multi-threaded
renderer. This means *rows* (not just the cells) beneath
maybe-transparent sixels are rendered single-threaded.

Closes #391.
</content>
</entry>
<entry>
<title>sixel: decgra: set max-non-empty-row-no when resizing the image</title>
<updated>2021-03-11T16:33:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-10T19:31:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6f6bcbc1bc5a9378bd16bd300ec89ddb35d9f863'/>
<id>urn:sha1:6f6bcbc1bc5a9378bd16bd300ec89ddb35d9f863</id>
<content type='text'>
This ensures we don’t trim off bottom rows in unhook().

This could happen either because the application used “Set Raster
Attributes” to configure an image size larger than the sixels later
emitted.

Or, the last sixel row contains empty pixel rows.

In either case, the size set with “Set Raster Attributes” defines
the *minimum* image size; the image may still end up being larger.
</content>
</entry>
<entry>
<title>sixel: decgri: handle a repeat count of 0, by ignoring it</title>
<updated>2021-03-11T16:32:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T15:53:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ae86043780df36d4dce8f38effd5023c4605b4ec'/>
<id>urn:sha1:ae86043780df36d4dce8f38effd5023c4605b4ec</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: add: add sixel_add_many(), improving performance of DECGRI</title>
<updated>2021-03-11T16:32:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T15:30:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6d208fa5e0dbb603ef87f83b825de36e35f7c1a3'/>
<id>urn:sha1:6d208fa5e0dbb603ef87f83b825de36e35f7c1a3</id>
<content type='text'>
DECGRI, i.e. repeat sixel character, only need to do image resizing,
and updating the current ‘column’ value *once*.

By adding sixel_add_many(), and doing the size/resize checking there,
the performance of sixel_add() is made much simpler.

This boosts performance quite noticeably when the application is
emitting many and/or long repeat sequences.
</content>
</entry>
<entry>
<title>sixel: add: calculate absolute row no inside the loop</title>
<updated>2021-03-11T16:32:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T14:45:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6e963dbf6837094f93921f47cdc83aada244be6d'/>
<id>urn:sha1:6e963dbf6837094f93921f47cdc83aada244be6d</id>
<content type='text'>
This results in the same number of instructions inside the loop, with
a ‘lea’ instead of a ‘mov’, but simplifies the post-loop logic to
update the global state.
</content>
</entry>
<entry>
<title>sixel: add: increase data pointer instead of offset</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T14:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=751ccf53162db0daf1f0318e421da31e337041e7'/>
<id>urn:sha1:751ccf53162db0daf1f0318e421da31e337041e7</id>
<content type='text'>
Same ‘add’ instruction to increase the offset, but simpler ‘mov’
instruction when writing the pixel data.
</content>
</entry>
<entry>
<title>sixel: decgri: avoid load inside for-loop</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T13:59:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=777576b66b1fff8d6da5696aac062aaa0dea1bb4'/>
<id>urn:sha1:777576b66b1fff8d6da5696aac062aaa0dea1bb4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: add optimized resize_horizontally() and resize_vertically()</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T13:44:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9f224a13df87d0c2db9057ce2ab531013c2ae6f6'/>
<id>urn:sha1:9f224a13df87d0c2db9057ce2ab531013c2ae6f6</id>
<content type='text'>
The resize operations performed in the “hot” path either change the
width, or the height, but not both at the same time.
</content>
</entry>
<entry>
<title>sixel: empty pixels in the last sixel row doesn’t contribute to the image height</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T13:44:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c181eb2bf68e2e776cff96b36489de5d45e67fe9'/>
<id>urn:sha1:c181eb2bf68e2e776cff96b36489de5d45e67fe9</id>
<content type='text'>
All-empty pixels rows in the last sixel row should not be included in
the final sixel image.

This allows applications to emit sixels whose height is not a multiple
of 6, and is how XTerm works.

This is done by tracking the largest row number that contains
non-empty pixels.

In unhook, when emitting the image, the image height is adjusted based
on this value.
</content>
</entry>
<entry>
<title>sixel: resize: width is no longer a multiple of 6</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T11:02:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d35963f584acce3d2493e24348215d60345c861e'/>
<id>urn:sha1:d35963f584acce3d2493e24348215d60345c861e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: set ‘col’ outside image boundaries when we’ve reached max height</title>
<updated>2021-03-11T16:32:58Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T10:51:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6ab7052be4932ae52df9aea550c2a8c5d1373f87'/>
<id>urn:sha1:6ab7052be4932ae52df9aea550c2a8c5d1373f87</id>
<content type='text'>
This is to optimize sixel_add(). It already checks ‘pos’, to see if it
needs to resize the image, and if the resize fails (either due to
allocation failures, or because we’ve reached the maximum width), we
bail out.

We need to do the same thing for height. But, we don’t want to add
another check to sixel_add() since its’s performance critical.

By setting ‘col’ outside the image boundaries when ‘row’ reaches the
maximum image height, we can “re-use” the existing code in
sixel_add().
</content>
</entry>
<entry>
<title>sixel: remove ‘max_col’</title>
<updated>2021-03-11T16:32:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-07T10:49:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4b0e9a6bee9699b9edce6b9afc6a66734ce00a49'/>
<id>urn:sha1:4b0e9a6bee9699b9edce6b9afc6a66734ce00a49</id>
<content type='text'>
The image width *is* the maximum number of columns we’ve seen.
</content>
</entry>
</feed>
