Changeset bc52b5b in mainline for uspace/lib/gfxfont/src/text.c


Ignore:
Timestamp:
2021-08-15T10:02:32Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
99589a9
Parents:
de0c55a
Message:

Allow the use of EGA attributes/24-bit characters alongside RGB

In a big hack (since we cannot have different pixel formats yet) we
use a pixel format that allows both 24-bit RGB (without character)
or 24-bit character with 8-bit attributes. Thus in GFX we cannot
currently have characters with any RGB color, but we can set
foreground and background individually (and it even works in EGA mode).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfxfont/src/text.c

    rde0c55a rbc52b5b  
    110110        gfx_bitmap_t *bitmap;
    111111        gfx_bitmap_alloc_t alloc;
    112         uint16_t r, g, b;
     112        uint8_t attr;
    113113        pixelmap_t pmap;
    114114        gfx_coord_t x;
    115115        pixel_t pixel;
     116        char32_t c;
     117        size_t off;
    116118        errno_t rc;
    117119
     
    121123         */
    122124
    123         gfx_color_get_rgb_i16(color, &r, &g, &b);
    124 
    125         /*
    126          * We are setting the *background* color, the foreground color
    127          * will be set to its complement.
    128          */
    129         r = 0xff ^ (r >> 8);
    130         g = 0xff ^ (g >> 8);
    131         b = 0xff ^ (b >> 8);
     125        gfx_color_get_ega(color, &attr);
    132126
    133127        gfx_bitmap_params_init(&params);
     
    156150        pmap.data = alloc.pixels;
    157151
     152        off = 0;
    158153        for (x = 0; x < params.rect.p1.x; x++) {
    159                 pixel = PIXEL(str[x], r, g, b);
     154                c = str_decode(str, &off, STR_NO_LIMIT);
     155                pixel = PIXEL(attr,
     156                    (c >> 16) & 0xff,
     157                    (c >> 8) & 0xff,
     158                    c & 0xff);
    160159                pixelmap_put_pixel(&pmap, x, 0, pixel);
    161160        }
Note: See TracChangeset for help on using the changeset viewer.