Changeset c79545e in mainline for uspace/srv/hid/display/display.c


Ignore:
Timestamp:
2020-01-19T10:00:11Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2012fe0
Parents:
946a666
Message:

Paint desktop background with a solid color

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/display.c

    r946a666 rc79545e  
    3636#include <errno.h>
    3737#include <gfx/context.h>
     38#include <gfx/render.h>
    3839#include <io/log.h>
    3940#include <stdlib.h>
     
    5253{
    5354        ds_display_t *disp;
     55        errno_t rc;
    5456
    5557        disp = calloc(1, sizeof(ds_display_t));
    5658        if (disp == NULL)
    5759                return ENOMEM;
     60
     61        rc = gfx_color_new_rgb_i16(0x8000, 0xc800, 0xffff, &disp->bg_color);
     62        if (rc != EOK) {
     63                free(disp);
     64                return ENOMEM;
     65        }
    5866
    5967        list_initialize(&disp->clients);
     
    7482        assert(list_empty(&disp->clients));
    7583        assert(list_empty(&disp->seats));
     84        gfx_color_delete(disp->bg_color);
    7685        free(disp);
    7786}
     
    401410}
    402411
     412/** Paint display background.
     413 *
     414 * @param display Display
     415 * @param rect Bounding rectangle or @c NULL to repaint entire display
     416 */
     417errno_t ds_display_paint_bg(ds_display_t *disp, gfx_rect_t *rect)
     418{
     419        gfx_rect_t dsrect;
     420        gfx_rect_t crect;
     421        gfx_context_t *gc;
     422        errno_t rc;
     423
     424        dsrect.p0.x = 0;
     425        dsrect.p0.y = 0;
     426        dsrect.p1.x = 1024;
     427        dsrect.p1.y = 768;
     428
     429        if (rect != NULL)
     430                gfx_rect_clip(&dsrect, rect, &crect);
     431        else
     432                crect = dsrect;
     433
     434        gc = ds_display_get_gc(disp); // XXX
     435
     436        rc = gfx_set_color(gc, disp->bg_color);
     437        if (rc != EOK)
     438                return rc;
     439
     440        return gfx_fill_rect(gc, &crect);
     441}
     442
    403443/** @}
    404444 */
Note: See TracChangeset for help on using the changeset viewer.