Changeset 7e38970d in mainline for uspace/lib/congfx/src/console.c


Ignore:
Timestamp:
2020-12-07T00:08:37Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
25f26600
Parents:
7a873f0 (diff), 8596474 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'jxsvoboda-gfx' into master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/congfx/src/console.c

    r7a873f0 r7e38970d  
    207207
    208208        /* Check that we support all requested flags */
    209         if ((params->flags & ~bmpf_color_key) != 0)
     209        if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0)
    210210                return ENOTSUP;
    211211
     
    296296
    297297        if ((cbm->flags & bmpf_color_key) == 0) {
     298                /* Simple copy */
    298299                for (y = crect.p0.y; y < crect.p1.y; y++) {
    299300                        console_set_pos(cbm->cgc->con, crect.p0.x, y);
     
    312313                        }
    313314                }
    314         } else {
     315        } else if ((cbm->flags & bmpf_colorize) == 0) {
     316                /* Color key */
    315317                for (y = crect.p0.y; y < crect.p1.y; y++) {
    316318                        for (x = crect.p0.x; x < crect.p1.x; x++) {
     
    332334                        }
    333335                }
     336        } else {
     337                /* Color key & colorize */
     338                console_set_rgb_color(cbm->cgc->con, cbm->cgc->clr,
     339                    cbm->cgc->clr);
     340
     341                for (y = crect.p0.y; y < crect.p1.y; y++) {
     342                        for (x = crect.p0.x; x < crect.p1.x; x++) {
     343
     344                                clr = pixelmap_get_pixel(&pixelmap,
     345                                    x - offs.x - cbm->rect.p0.x,
     346                                    y - offs.y - cbm->rect.p0.y);
     347
     348                                if (clr != cbm->key_color) {
     349                                        console_set_pos(cbm->cgc->con, x, y);
     350                                        rv = fputc('X', cbm->cgc->fout);
     351                                        if (rv < 0)
     352                                                return EIO;
     353
     354                                        console_flush(cbm->cgc->con);
     355                                }
     356
     357                        }
     358                }
    334359        }
    335360
Note: See TracChangeset for help on using the changeset viewer.