aboutsummaryrefslogtreecommitdiff
path: root/render.c (follow)
Commit message (Collapse)AuthorAgeLines
...
* render: special case worker-count == 0Daniel Eklöf2019-08-01-31/+60
| | | | | Allow render worker count to be 0, in which case the main thread renders the entire screen.
* threads: set thread titlesDaniel Eklöf2019-08-01-0/+8
|
* render: always damage two cells when rendering the cursorDaniel Eklöf2019-07-31-1/+1
| | | | | Hack to render cursor-at-double-width-characters correctly. Should be replaced with something better.
* render: draw cell decorations (cursor, underline etc) correctly for double-width charactersDaniel Eklöf2019-07-31-37/+38
|
* font: initial support for double-width *and* color emoji glyphsDaniel Eklöf2019-07-31-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fonts are now loaded with FT_LOAD_COLOR and we recognize and support the FT_PIXEL_MODE_BGRA pixel mode. This is mapped to a CAIRO_FORMAT_ARGB32 surface, that is blitted as-is (instead of used as a mask like we do for gray and mono glyphs). Furthermore, since many emojis are double-width, we add initial support for double-width glyphs. These are assumed to always be utf8. When PRINT:ing an utf8 character, we check its width, and add empty "spacer" cells after the cell with the multi-column glyph. When rendering, we render the columns in each row backwards. This ensures the spacer cells get cleared *before* we render the glyph (so that we don't end up erasing part of the glyph). Finally, emoji fonts are usually bitmap fonts with *large* glyphs. These aren't automatically scaled down. I.e. even if we request a glyph of 13 pixels, we might end up getting a 100px glyph. To handle this, fontconfig must be configured to scale bitmap fonts. When it is, we can look at the 'scalable' and 'pixelsizefixup' properties, and use these to scale the rendered glyph.
* render: make resize log messages debug messagesDaniel Eklöf2019-07-30-1/+1
|
* render: don't pass a struct buffer when all we need is a cairo_tDaniel Eklöf2019-07-30-23/+18
|
* render: don't call wl_surface_set_buffer_scale()Daniel Eklöf2019-07-30-3/+4
| | | | | | Since we don't support scaling, don't call wl_surface_set_buffer_scale(). This way, at least will get auto-scaled by the compositor.
* render: remove #if 0 codeDaniel Eklöf2019-07-30-15/+0
|
* render: fix 'suggest braces around initialization...' warning (clang)Daniel Eklöf2019-07-30-1/+1
|
* render: only explicitly re-render old cursor cell if it isn't dirtyDaniel Eklöf2019-07-30-13/+11
| | | | | If it is dirty, it will be rendered in the normal rendering process.
* render: remove all traces of glyph-sequenceDaniel Eklöf2019-07-30-61/+0
| | | | | This was used to optimize the call(s) to cairo_show_glyphs(), which we aren't using anymore.
* font: add support for fallback fontsDaniel Eklöf2019-07-30-36/+14
| | | | | | | | | | | | | | | A top-level font now has a list of fallback fonts. When a glyph cannot be found, we try each fallback font in turn, until we either find one that has the glyph, or until we've exhausted the list. To make this actually work in practise (read: to make performance acceptable), the cache is re-worked and is now populated on demand. It also supports non-ASCII characters, by using the 4-byte unicode character as index instead. Since having an array that can be indexed by a 4-byte value isn't really viable, we now have a simple hash table instead of an array.
* render: add a 'clean' bit to each cell; only render cells that aren't cleanDaniel Eklöf2019-07-30-3/+8
| | | | | | | | | | | This patch takes a bit from the foreground color value in a cell (todo: split up foreground/background into bitfields with a separate field for 'foreground/background' has been set), and only re-renders cells that aren't marked as clean. Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy to erase cells - we can (keep doing) do that by simply memsetting a cell range to 0.
* wip: initial multithreaded rendererDaniel Eklöf2019-07-29-55/+144
|
* font: populate glyph cache (ASCII characters only) when instantiating fontDaniel Eklöf2019-07-28-76/+13
|
* font: add font_glyph_for_utf8()Daniel Eklöf2019-07-28-73/+11
| | | | | | This function fills in a struct glyph with glyph bitmap data for the provided utf-8 character (essentially a FT_Bitmap wrapped in a cairo surface).
* cairo-ft: remove all usages of cairo-ftDaniel Eklöf2019-07-28-1/+3
|
* render: use FreeType face from font, instead of from cairo's scaled fontDaniel Eklöf2019-07-28-6/+2
|
* font: load FreeType face, and set it's pixel sizesDaniel Eklöf2019-07-28-2/+0
|
* render: poc: use freetype to render glyphsDaniel Eklöf2019-07-26-0/+124
| | | | | | | | | | | | | | Initial POC that uses freetype to render the glyphs. The bitmap produced by freetype contains the alpha value. We use this bitmap in a mask surface and then draw the final glyph with cairo by applying the source rgb using the OVER operator and the freetype generated alpha mask as surface mask. Note that we only support grayscale antialiasing (and no antialiasing). We are probably not setting the antialias options correctly either.
* render: reset "last cursor" when resizingDaniel Eklöf2019-07-26-2/+2
| | | | | The cell pointer is likely invalid since we realloc the grids. Besides. we're redrawing the entire window anyway.
* render: flush glyph sequence after erase previous cursorDaniel Eklöf2019-07-26-4/+8
| | | | | If not, we may have scrolled when we later flush the glyph sequence, causing the glyph to be rendered in wrong location.
* render: add render_row()Daniel Eklöf2019-07-24-7/+13
|
* render: minorDaniel Eklöf2019-07-24-1/+2
|
* render: move local static variables into the terminal structDaniel Eklöf2019-07-24-31/+26
|
* render: move frame_callback to term.renderDaniel Eklöf2019-07-24-6/+6
|
* render: add render_refresh()Daniel Eklöf2019-07-24-2/+8
|
* render: bug: previous cursor wasn't always redrawn correctlyDaniel Eklöf2019-07-24-39/+56
| | | | | | | | | | | | | | | | | | | | The main problem is knowing: * The correct *cell* (to be able to render the *content* when erasing the old cursor) * Whether the cursor has moved (to determine whether to stop the rendering loop or not) * Where on the *screen* the cursor is/was (since the terminal may be partly scrolled back) This patch stores three static variables: * last_cursor is used to compare against current cursor to see if the cursor has moved or not * last_cursor_on_screen is the actual screen coordinates the cursor was rendered at (typically the same as last_cursor, but may be offset by the view) * last_cursor_cell is a pointer to the cell to render
* conf: allow the user to configure a fixed cursor colorDaniel Eklöf2019-07-23-2/+10
| | | | | | | | | | | | | | | | | | | The default is to reverse the foreground/background colors in the cell with the cursor. But, if the user configures a specific set of cursor colors, those will always be used, regardless of other cell attributes (dim, reverse etc). The cursor color is specified as two color values, 'text' and 'cursor'. The block cursor uses the 'cursor' color as background, and the 'text' color for the glyph. All other cursor styles uses the 'cursor' color for the cursor, but uses the cell's foreground color for the glyph (meaning, dim/reverse/etc applies).
* render: implement cursor styles 'bar' and 'underline'Daniel Eklöf2019-07-22-47/+94
|
* term: group 'blink' state together in a structDaniel Eklöf2019-07-22-8/+8
|
* term: group 'flash' state together in a structDaniel Eklöf2019-07-22-4/+4
|
* blink: implement 'blink'Daniel Eklöf2019-07-21-1/+51
|
* flash: implement 'flash'Daniel Eklöf2019-07-21-21/+37
| | | | | | | | | | Use our own escape sequence for the 'flash' terminfo entry. Implemented by arming a timer FD and setting a boolean that indicates we're currently "flashing". The renderer draws a semi-transparent yellowish layer over the entire window when "flashing" is active.
* render: make "new buffer" a debug log message, not warningDaniel Eklöf2019-07-21-1/+1
|
* term: prepare for configurable colors; add color variables to terminalDaniel Eklöf2019-07-21-3/+3
|
* glyph-cache: generate at startup, never update while renderingDaniel Eklöf2019-07-18-13/+1
|
* render: commentsDaniel Eklöf2019-07-18-0/+3
|
* render: make frame rendering time measuring optionalDaniel Eklöf2019-07-18-0/+6
|
* render: cache generated glyphs for regular ASCII charactersDaniel Eklöf2019-07-18-7/+37
| | | | | | | | To avoid having to re-generate glyphs, cache the glyphs. For now, we only cache ASCII characters, as this allows us to lookup the cache by simply indexing with the character (into a 256-entry array).
* render: break out color conversionDaniel Eklöf2019-07-18-36/+26
|
* render: time how long time it takes to render a frameDaniel Eklöf2019-07-18-0/+12
|
* render: use cairo_rel_line_to()Daniel Eklöf2019-07-16-2/+2
|
* render: shorten foreground/background local variable namesDaniel Eklöf2019-07-16-21/+21
|
* render: implement strikeoutDaniel Eklöf2019-07-16-3/+17
|
* render: implement 'underline'Daniel Eklöf2019-07-16-23/+41
|
* render: implement 'dim'Daniel Eklöf2019-07-16-49/+27
|
* terminal: foreground/background in cell attributes are now uint32_tDaniel Eklöf2019-07-16-13/+64
| | | | This reduces the cell size, and thus improves the cache behavour
* render: bug: don't render cursor when hide cursor is enabledDaniel Eklöf2019-07-11-1/+1
|
* selection: selections can be made, and are renderedDaniel Eklöf2019-07-11-1/+27
| | | | | | | * Start selection on mouse button down * Update selection on motion * Button release cancels selection if there were no motion after start * Renderer detects cells inside the selection and inverts their colors
* render: reduce scrollback line countDaniel Eklöf2019-07-10-1/+1
| | | | More than 1000 lines and we start exhibiting bad cache behavior
* cell: we only need 4 bytes for the longest utf8 sequenceDaniel Eklöf2019-07-10-1/+1
| | | | | | We don't *have* to NULL-terminate the utf8 string. So don't. This makes the cell glyph 4 bytes exactly, which is better for alignment and cache usage.
* grid: don't pre-allocate the entire grid (with all scrollback lines)Daniel Eklöf2019-07-10-27/+20
| | | | | | | | | | The row array may now contain NULL pointers. This means the corresponding row hasn't yet been allocated and initialized. On a resize, we explicitly allocate the visible rows. Uninitialized rows are then allocated the first time they are referenced.
* render: damage the *view* too, when resizingDaniel Eklöf2019-07-10-1/+1
|
* render: reset 'normal' grid's view correctlyDaniel Eklöf2019-07-10-1/+1
|
* render: don't render cursor if it is not in viewDaniel Eklöf2019-07-10-18/+28
|
* wip: initial scroll back supportDaniel Eklöf2019-07-09-6/+28
| | | | | | | | | | | | | | | | | | | | | | | Can scroll up and down, and stops when the beginning/end of history is reached. However, it probably breaks when the entire scrollback buffer has been filled - we need to detect when the view has wrapped around to the current terminal offset. The detection of when we've reached the bottom of the history is also flawed, and only works when we overshoot the bottom with at least a page. Resizing the windows while in a view most likely doesn't work. The view will not detect a wrapped around scrollback buffer. I.e. if the user has scrolled back, and is stationary at a view, but there is still output being produced. Then eventually the scrollback buffer will wrap around. In this case, the correct thing to do is make the view start following the beginning of the history. Right now it doesn't, meaning once the scrollback buffer wraps around, you'll start seeing command output...
* render: store frame callback pointer in terminal structDaniel Eklöf2019-07-09-5/+6
| | | | This allows us to free it when exiting
* cleanupDaniel Eklöf2019-07-09-302/+1
|
* render: copy old contents to new grids when resizingDaniel Eklöf2019-07-09-67/+57
| | | | Eventually, we'll add text reflow here as well.
* render: hackermanDaniel Eklöf2019-07-08-1/+1
|
* rgba: drop alpha channel supportDaniel Eklöf2019-07-08-19/+13
|
* render: use CAIRO_OPERATER_SOURCE to draw glyphsDaniel Eklöf2019-07-08-2/+0
| | | | This is *much* faster.
* render: use doubles instead of intsDaniel Eklöf2019-07-08-4/+4
|
* render: use pointers to rgba foreground/background colorsDaniel Eklöf2019-07-08-11/+13
| | | | | This is faster, since we don't have to copy several large doubles when swapping the colors.
* wip: grid is now represented as a grid, not a linear arrayDaniel Eklöf2019-07-08-4/+209
| | | | | | | | | | | | The grid is now represented with an array of row *pointers*. Each row contains an array of cells (the row's columns). The main point of having row pointers is we can now move rows around almost for free. This is useful when scrolling with scroll margins for example, where we previously had to copy the lines in the margins. Now it's just a matter of swapping two pointers.
* render: collect glyphs over *all* update damagesDaniel Eklöf2019-07-07-12/+12
|
* render: performance: don't stack allocate glyph sequenceDaniel Eklöf2019-07-06-1/+4
|
* render: reverse video only reverses the default background/foregroundDaniel Eklöf2019-07-05-8/+4
|
* csi: implement reverse videoDaniel Eklöf2019-07-05-6/+13
|
* render: fill area outside the cell grid with default bg colorDaniel Eklöf2019-07-05-2/+20
|
* render: load cursor theme from XCURSOR_THEME and XCURSOR_SIZEDaniel Eklöf2019-07-05-0/+29
|
* render: break out rendering functions to render.{c,h}Daniel Eklöf2019-07-05-0/+532