Changeset 43ffecf in mainline


Ignore:
Timestamp:
2021-05-06T17:26:49Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1167ad34
Parents:
fe333f8e
Message:

Fix bitmap clipping in memory GC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/memgfx/src/memgc.c

    rfe333f8e r43ffecf  
    372372        gfx_rect_t srect;
    373373        gfx_rect_t drect;
     374        gfx_rect_t crect;
    374375        gfx_coord2_t offs;
    375376        gfx_coord_t x, y;
     
    393394        gfx_rect_translate(&offs, &srect, &drect);
    394395
    395         /* XXX Clip destination rectangle?! */
     396        /* Clip destination rectangle */
     397        gfx_rect_clip(&drect, &mbm->mgc->clip_rect, &crect);
    396398
    397399        assert(mbm->alloc.pitch == (mbm->rect.p1.x - mbm->rect.p0.x) *
     
    412414        } else if ((mbm->flags & bmpf_color_key) == 0) {
    413415                /* Simple copy */
    414                 for (y = drect.p0.y; y < drect.p1.y; y++) {
    415                         for (x = drect.p0.x; x < drect.p1.x; x++) {
     416                for (y = crect.p0.y; y < crect.p1.y; y++) {
     417                        for (x = crect.p0.x; x < crect.p1.x; x++) {
    416418                                pixel = pixelmap_get_pixel(&smap,
    417419                                    x - mbm->rect.p0.x - offs.x,
     
    422424        } else if ((mbm->flags & bmpf_colorize) == 0) {
    423425                /* Color key */
    424                 for (y = drect.p0.y; y < drect.p1.y; y++) {
    425                         for (x = drect.p0.x; x < drect.p1.x; x++) {
     426                for (y = crect.p0.y; y < crect.p1.y; y++) {
     427                        for (x = crect.p0.x; x < crect.p1.x; x++) {
    426428                                pixel = pixelmap_get_pixel(&smap,
    427429                                    x - mbm->rect.p0.x - offs.x,
     
    433435        } else {
    434436                /* Color key & colorization */
    435                 for (y = drect.p0.y; y < drect.p1.y; y++) {
    436                         for (x = drect.p0.x; x < drect.p1.x; x++) {
     437                for (y = crect.p0.y; y < crect.p1.y; y++) {
     438                        for (x = crect.p0.x; x < crect.p1.x; x++) {
    437439                                pixel = pixelmap_get_pixel(&smap,
    438440                                    x - mbm->rect.p0.x - offs.x,
     
    445447        }
    446448
    447         mem_gc_invalidate_rect(mbm->mgc, &drect);
     449        mem_gc_invalidate_rect(mbm->mgc, &crect);
    448450        return EOK;
    449451}
Note: See TracChangeset for help on using the changeset viewer.