mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
box-drawing: include pixman image in the buffer we’re passing around
This commit is contained in:
parent
ed60c66522
commit
8d09ba5bd2
1 changed files with 6 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ enum thickness {
|
||||||
|
|
||||||
struct buf {
|
struct buf {
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
pixman_image_t *pix;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int stride;
|
int stride;
|
||||||
|
|
@ -2278,11 +2279,13 @@ box_drawing(const struct terminal *term, wchar_t wc)
|
||||||
{
|
{
|
||||||
int width = term->cell_width;
|
int width = term->cell_width;
|
||||||
int height = term->cell_height;
|
int height = term->cell_height;
|
||||||
int stride = stride_for_format_and_width(PIXMAN_a1, width);
|
pixman_format_code_t fmt = PIXMAN_a1; /* TODO: use a8 when antialiasing=true */
|
||||||
|
|
||||||
|
int stride = stride_for_format_and_width(fmt, width);
|
||||||
uint8_t *data = xcalloc(height * stride, 1);
|
uint8_t *data = xcalloc(height * stride, 1);
|
||||||
|
|
||||||
pixman_image_t *pix = pixman_image_create_bits_no_clear(
|
pixman_image_t *pix = pixman_image_create_bits_no_clear(
|
||||||
PIXMAN_a1, width, height, (uint32_t*)data, stride);
|
fmt, width, height, (uint32_t*)data, stride);
|
||||||
|
|
||||||
if (pix == NULL) {
|
if (pix == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
|
|
@ -2292,6 +2295,7 @@ box_drawing(const struct terminal *term, wchar_t wc)
|
||||||
|
|
||||||
struct buf buf = {
|
struct buf buf = {
|
||||||
.data = data,
|
.data = data,
|
||||||
|
.pix = pix,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.stride = stride,
|
.stride = stride,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue