Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 159776f in mainline


Ignore:
Timestamp:
2019-10-10T10:17:17Z (13 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
78a71936
Parents:
bef51cf
git-author:
Jiri Svoboda <jiri@…> (2019-10-09 17:07:14)
git-committer:
Jiri Svoboda <jiri@…> (2019-10-10 10:17:17)
Message:

Provisional display server output via canvas/guigfx

Location:
uspace/srv/hid/display
Files:
2 added
8 edited

Legend:

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

    rbef51cf r159776f  
    3636#include <disp_srv.h>
    3737#include <errno.h>
     38#include <gfx/context.h>
    3839#include <io/log.h>
    3940#include <stdlib.h>
     
    8586/** Create display.
    8687 *
     88 * @param gc Graphics context for displaying output
    8789 * @param rdisp Place to store pointer to new display.
    8890 * @return EOK on success, ENOMEM if out of memory
    8991 */
    90 errno_t ds_display_create(ds_display_t **rdisp)
     92errno_t ds_display_create(gfx_context_t *gc, ds_display_t **rdisp)
    9193{
    9294        ds_display_t *disp;
     
    98100        list_initialize(&disp->windows);
    99101        disp->next_wnd_id = 1;
     102        disp->gc = gc;
    100103        *rdisp = disp;
    101104        return EOK;
  • uspace/srv/hid/display/display.h

    rbef51cf r159776f  
    2727 */
    2828
    29 /** @addtogroup inet
     29/** @addtogroup display
    3030 * @{
    3131 */
     
    4040#include <disp_srv.h>
    4141#include <errno.h>
     42#include <gfx/context.h>
    4243#include "types/display/display.h"
    4344#include "types/display/window.h"
     
    4546extern display_ops_t display_srv_ops;
    4647
    47 extern errno_t ds_display_create(ds_display_t **);
     48extern errno_t ds_display_create(gfx_context_t *, ds_display_t **);
    4849extern void ds_display_destroy(ds_display_t *);
    4950extern errno_t ds_display_add_window(ds_display_t *, ds_window_t *);
  • uspace/srv/hid/display/main.c

    rbef51cf r159776f  
    77 * are met:
    88 *
    9  * - Redistributions of source code must retain the above copyright
     9 * - Redistribution1s of source code must retain the above copyright
    1010 *   notice, this list of conditions and the following disclaimer.
    1111 * - Redistributions in binary form must reproduce the above copyright
     
    4646#include <task.h>
    4747#include "display.h"
     48#include "output.h"
    4849#include "window.h"
    4950
     
    5657{
    5758        ds_display_t *disp = NULL;
     59        gfx_context_t *gc = NULL;
    5860        errno_t rc;
    5961
    60         rc = ds_display_create(&disp);
     62        rc = output_init(&gc);
     63        if (rc != EOK)
     64                goto error;
     65
     66        rc = ds_display_create(gc, &disp);
    6167        if (rc != EOK)
    6268                goto error;
     
    8288        return EOK;
    8389error:
     90        if (gc != NULL)
     91                gfx_context_delete(gc);
    8492        if (disp != NULL)
    8593                ds_display_destroy(disp);
  • uspace/srv/hid/display/meson.build

    rbef51cf r159776f  
    3232        'display.c',
    3333        'main.c',
     34        'output.c',
    3435        'window.c',
    3536)
  • uspace/srv/hid/display/test/display.c

    rbef51cf r159776f  
    4545        errno_t rc;
    4646
    47         rc = ds_display_create(&disp);
     47        rc = ds_display_create(NULL, &disp);
    4848        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    4949
     
    5959        errno_t rc;
    6060
    61         rc = ds_display_create(&disp);
     61        rc = ds_display_create(NULL, &disp);
    6262        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    6363
  • uspace/srv/hid/display/test/window.c

    rbef51cf r159776f  
    4747        errno_t rc;
    4848
    49         rc = ds_display_create(&disp);
     49        rc = ds_display_create(NULL, &disp);
    5050        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    5151
  • uspace/srv/hid/display/types/display/display.h

    rbef51cf r159776f  
    3838
    3939#include <adt/list.h>
     40#include <gfx/context.h>
    4041#include "window.h"
    4142
     
    4546        /** Next ID to assign to a window */
    4647        ds_wnd_id_t next_wnd_id;
     48        /** Output GC */
     49        gfx_context_t *gc;
    4750} ds_display_t;
    4851
  • uspace/srv/hid/display/window.c

    rbef51cf r159776f  
    6565        ds_window_t *wnd = (ds_window_t *) arg;
    6666
    67         (void) wnd;
    6867        log_msg(LOG_DEFAULT, LVL_NOTE, "gc_set_color");
    69         return EOK;
     68        return gfx_set_color(wnd->display->gc, color);
    7069}
    7170
     
    8180        ds_window_t *wnd = (ds_window_t *) arg;
    8281
    83         (void) wnd;
    8482        log_msg(LOG_DEFAULT, LVL_NOTE, "gc_fill_rect");
    85         return EOK;
     83        return gfx_fill_rect(wnd->display->gc, rect);
    8684}
    8785
Note: See TracChangeset for help on using the changeset viewer.