Changeset ff6e91b in mainline for uspace/lib/ui/src/slider.c


Ignore:
Timestamp:
2021-08-30T20:41:27Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
81ec7e1
Parents:
9b2e20c
Message:

Make use of code page 437 characters

To draw proper text boxes, for a nice round radio button light,
for a nice contiguous slider groove.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/slider.c

    r9b2e20c rff6e91b  
    332332        gfx_coord_t w, i;
    333333        char *buf;
     334        const char *gchar;
     335        size_t gcharsz;
    334336        errno_t rc;
    335337
     
    344346
    345347        w = slider->rect.p1.x - slider->rect.p0.x;
    346         buf = malloc(w + 1);
     348        gchar = "\u2550";
     349        gcharsz = str_size(gchar);
     350
     351        buf = malloc(w * gcharsz + 1);
    347352        if (buf == NULL)
    348353                return ENOMEM;
    349354
    350355        for (i = 0; i < w; i++)
    351                 buf[i] = '=';
    352         buf[w] = '\0';
     356                str_cpy(buf + i * gcharsz, (w - i) * gcharsz + 1, gchar);
     357        buf[w * gcharsz] = '\0';
    353358
    354359        rc = gfx_puttext(slider->res->font, &pos, &fmt, buf);
Note: See TracChangeset for help on using the changeset viewer.