Changeset 8aef01c in mainline for uspace/lib/memgfx/src


Ignore:
Timestamp:
2020-06-07T10:18:14Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a65b0c8
Parents:
6301a24f
git-author:
Jiri Svoboda <jiri@…> (2020-06-07 10:11:32)
git-committer:
Jiri Svoboda <jiri@…> (2020-06-07 10:18:14)
Message:

Configurable display double-buffering

On by default (since turning off creates flicker in the absence of
front-to-back rendering). This is the quick and dirty way: display
server renders locally to a bitmap (using mem GC) and renders the
bitmap when ready.

The more sophisticated way would be to implement buffering in the
display device. That would require, however, enhancing the protocols
to communicate frame boundaries.

File:
1 edited

Legend:

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

    r6301a24f r8aef01c  
    284284        gfx_rect_t drect;
    285285        gfx_coord2_t offs;
    286         gfx_coord2_t dim;
    287286        gfx_coord_t x, y;
    288287        pixelmap_t smap;
     
    305304        gfx_rect_translate(&offs, &srect, &drect);
    306305
    307         gfx_coord2_subtract(&drect.p1, &drect.p0, &dim);
    308 
    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;
     306        assert(mbm->alloc.pitch == (mbm->rect.p1.x - mbm->rect.p0.x) *
     307            (int)sizeof(uint32_t));
     308        smap.width = mbm->rect.p1.x - mbm->rect.p0.x;
     309        smap.height = mbm->rect.p1.y - mbm->rect.p0.y;
    314310        smap.data = mbm->alloc.pixels;
    315311
     
    324320                for (y = drect.p0.y; y < drect.p1.y; y++) {
    325321                        for (x = drect.p0.x; x < drect.p1.x; x++) {
    326                                 pixel = pixelmap_get_pixel(&smap, x - offs.x,
    327                                     y - offs.y);
     322                                pixel = pixelmap_get_pixel(&smap,
     323                                    x - mbm->rect.p0.x - offs.x,
     324                                    y - mbm->rect.p0.y - offs.y);
    328325                                pixelmap_put_pixel(&dmap, x, y, pixel);
    329326                        }
     
    332329                for (y = drect.p0.y; y < drect.p1.y; y++) {
    333330                        for (x = drect.p0.x; x < drect.p1.x; x++) {
    334                                 pixel = pixelmap_get_pixel(&smap, x - offs.x,
    335                                     y - offs.y);
     331                                pixel = pixelmap_get_pixel(&smap,
     332                                    x - mbm->rect.p0.x - offs.x,
     333                                    y - mbm->rect.p0.y - offs.y);
    336334                                if (pixel != mbm->key_color)
    337335                                        pixelmap_put_pixel(&dmap, x, y, pixel);
Note: See TracChangeset for help on using the changeset viewer.