Changeset dbef30f in mainline for uspace/lib/memgfx/src/memgc.c


Ignore:
Timestamp:
2020-06-03T16:36:35Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
978c9bc5
Parents:
f8375f7
Message:

Use memory GC to render window in display server

File:
1 edited

Legend:

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

    rf8375f7 rdbef30f  
    9595        mem_gc_t *mgc = (mem_gc_t *) arg;
    9696        gfx_rect_t crect;
    97         gfx_coord2_t dims;
    9897        gfx_coord_t x, y;
    9998        pixelmap_t pixelmap;
     
    102101        gfx_rect_clip(rect, &mgc->rect, &crect);
    103102
    104         gfx_rect_dims(&mgc->rect, &dims);
    105         pixelmap.width = dims.x;
    106         pixelmap.height = dims.y;
     103        assert(mgc->rect.p0.x == 0);
     104        assert(mgc->rect.p0.y == 0);
     105        assert(mgc->alloc.pitch == mgc->rect.p1.x * (int)sizeof(uint32_t));
     106        pixelmap.width = mgc->rect.p1.x;
     107        pixelmap.height = mgc->rect.p1.y;
    107108        pixelmap.data = mgc->alloc.pixels;
    108109
     
    150151        mgc->alloc = *alloc;
    151152
    152         /*
    153          * These are the limitations of pixelmap which we are using.
    154          * Rather than falling back to an ad-hoc method of pixel access
    155          * (which is not searchable), use pixelmap for now and switch
    156          * to a better, more universal method later (e.g. supporting
    157          * different color depths).
    158          */
    159         assert(rect->p0.x == 0);
    160         assert(rect->p0.y == 0);
    161         assert(alloc->pitch == rect->p1.x * (int)sizeof(uint32_t));
    162 
    163153        mgc->update = update_cb;
    164154        mgc->cb_arg = cb_arg;
     
    187177        free(mgc);
    188178        return EOK;
     179}
     180
     181/** Retarget memory GC to a different block of memory.
     182 *
     183 * @param mgc Memory GC
     184 * @param rect New bounding rectangle
     185 * @param alloc Allocation info of the new block
     186 */
     187void mem_gc_retarget(mem_gc_t *mgc, gfx_rect_t *rect,
     188    gfx_bitmap_alloc_t *alloc)
     189{
     190        mgc->rect = *rect;
     191        mgc->alloc = *alloc;
    189192}
    190193
     
    283286        gfx_coord2_t dim;
    284287        gfx_coord_t x, y;
    285         gfx_coord2_t sdims;
    286         gfx_coord2_t ddims;
    287288        pixelmap_t smap;
    288289        pixelmap_t dmap;
     
    306307        gfx_coord2_subtract(&drect.p1, &drect.p0, &dim);
    307308
    308         gfx_rect_dims(&mbm->rect, &sdims);
    309         smap.width = sdims.x;
    310         smap.height = sdims.y;
     309        assert(mbm->rect.p0.x == 0);
     310        assert(mbm->rect.p0.y == 0);
     311        assert(mbm->alloc.pitch == mbm->rect.p1.x * (int)sizeof(uint32_t));
     312        smap.width = mbm->rect.p1.x;
     313        smap.height = mbm->rect.p1.y;
    311314        smap.data = mbm->alloc.pixels;
    312315
    313         gfx_rect_dims(&mbm->mgc->rect, &ddims);
    314         dmap.width = ddims.x;
    315         dmap.height = ddims.y;
     316        assert(mbm->mgc->rect.p0.x == 0);
     317        assert(mbm->mgc->rect.p0.y == 0);
     318        assert(mbm->mgc->alloc.pitch == mbm->mgc->rect.p1.x * (int)sizeof(uint32_t));
     319        dmap.width = mbm->mgc->rect.p1.x;
     320        dmap.height = mbm->mgc->rect.p1.y;
    316321        dmap.data = mbm->mgc->alloc.pixels;
    317322
Note: See TracChangeset for help on using the changeset viewer.