Changeset 71cbe5c in mainline


Ignore:
Timestamp:
2019-12-06T17:48:48Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b63dc2
Parents:
87a7cdb
Message:

Make bitmaps work with IPC GC / RFB

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ipcgfx/src/client.c

    r87a7cdb r71cbe5c  
    123123        gfx_coord2_t dim;
    124124        async_exch_t *exch = NULL;
     125        as_area_info_t info;
    125126        ipc_call_t answer;
     127        size_t asize;
    126128        aid_t req;
    127129        errno_t rc;
     
    148150        } else {
    149151                /*
    150                  * XXX We could allow this if the pixels point to a shareable
    151                  * area or we could do a copy of the data when rendering
     152                 * Accept user allocation if it points to a an acceptable
     153                 * memory area.
    152154                 */
    153                 rc = ENOTSUP;
    154                 goto error;
     155                rc = as_area_get_info(alloc->pixels, &info);
     156                if (rc != EOK)
     157                        goto error;
     158
     159                /* Pixels should start at the beginning of the area */
     160                if (info.start_addr != (uintptr_t) alloc->pixels) {
     161                        rc = EINVAL;
     162                        goto error;
     163                }
     164
     165                /* Size of area should be size of bitmap rounded up to page size */
     166                asize = PAGES2SIZE(SIZE2PAGES(alloc->pitch * dim.y));
     167                if (info.size != asize) {
     168                        rc = EINVAL;
     169                        goto error;
     170                }
     171
     172                ipcbm->alloc = *alloc;
    155173        }
    156174
  • uspace/srv/hid/rfb/main.c

    r87a7cdb r71cbe5c  
    224224        gfx_rect_t drect;
    225225        gfx_coord2_t offs;
     226        gfx_coord2_t bmdim;
    226227        gfx_coord2_t dim;
     228        gfx_coord_t x, y;
     229        pixelmap_t pbm;
     230        pixel_t color;
    227231
    228232        if (srect0 != NULL)
     
    240244        /* Destination rectangle */
    241245        gfx_rect_translate(&offs, &srect, &drect);
    242 
    243246        gfx_coord2_subtract(&drect.p1, &drect.p0, &dim);
     247        gfx_coord2_subtract(&rfbbm->rect.p1, &rfbbm->rect.p0, &bmdim);
     248
     249        pbm.width = bmdim.x;
     250        pbm.height = bmdim.y;
     251        pbm.data = rfbbm->alloc.pixels;
     252
     253        for (y = srect.p0.y; y < srect.p1.y; y++) {
     254                for (x = srect.p0.x; x < srect.p1.x; x++) {
     255                        color = pixelmap_get_pixel(&pbm, x, y);
     256                        pixelmap_put_pixel(&rfbbm->rfb->rfb.framebuffer,
     257                            x + offs.x, y + offs.y, color);
     258                }
     259        }
     260
     261        rfb_gc_invalidate_rect(rfbbm->rfb, &drect);
    244262
    245263        return EOK;
Note: See TracChangeset for help on using the changeset viewer.