Changeset 0d62c10 in mainline for uspace/drv/fb/kfb/port.c


Ignore:
Timestamp:
2020-10-09T20:27:24Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f80690a
Parents:
8bf9058
Message:

Rendering text in different colors via colorization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/fb/kfb/port.c

    r8bf9058 r0d62c10  
    200200
    201201        /* Check that we support all required flags */
    202         if ((params->flags & ~bmpf_color_key) != 0)
     202        if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0)
    203203                return ENOTSUP;
    204204
     
    307307
    308308        if ((kfbbm->flags & bmpf_color_key) != 0) {
     309                /* Simple copy */
    309310                for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
    310311                        for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
     
    319320                        }
    320321                }
     322        } else if ((kfbbm->flags & bmpf_colorize) != 0) {
     323                /* Color key */
     324                for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
     325                        for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
     326                                gfx_coord2_subtract(&pos, &kfbbm->rect.p0, &sp);
     327                                gfx_coord2_add(&pos, &offs, &dp);
     328
     329                                color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
     330                                kfb->pixel2visual(kfb->addr +
     331                                    FB_POS(kfb, dp.x, dp.y), color);
     332                        }
     333                }
    321334        } else {
     335                /* Color key & colorize */
    322336                for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
    323337                        for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
Note: See TracChangeset for help on using the changeset viewer.