Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/dummygc.c

    rf7a90df r1fa6292  
    11/*
    2  * Copyright (c) 2020 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4141#include "../private/dummygc.h"
    4242
     43static errno_t dummygc_set_clip_rect(void *, gfx_rect_t *);
    4344static errno_t dummygc_set_color(void *, gfx_color_t *);
    4445static errno_t dummygc_fill_rect(void *, gfx_rect_t *);
     46static errno_t dummygc_update(void *);
    4547static errno_t dummygc_bitmap_create(void *, gfx_bitmap_params_t *,
    4648    gfx_bitmap_alloc_t *, void **);
     
    5153/** Dummy GC operations */
    5254gfx_context_ops_t dummygc_ops = {
     55        .set_clip_rect = dummygc_set_clip_rect,
    5356        .set_color = dummygc_set_color,
    5457        .fill_rect = dummygc_fill_rect,
     58        .update = dummygc_update,
    5559        .bitmap_create = dummygc_bitmap_create,
    5660        .bitmap_destroy = dummygc_bitmap_destroy,
     
    105109}
    106110
     111/** Set clipping rectangle on dummy GC
     112 *
     113 * @param arg Argument (dummy_gc_t)
     114 * @param rect Rectangle
     115 * @return EOK on success or an error code
     116 */
     117static errno_t dummygc_set_clip_rect(void *arg, gfx_rect_t *rect)
     118{
     119        (void) arg;
     120        (void) rect;
     121        return EOK;
     122}
     123
    107124/** Set color on dummy GC
    108125 *
     
    128145        (void) arg;
    129146        (void) rect;
     147        return EOK;
     148}
     149
     150/** Update dummy GC
     151 *
     152 * @param arg Argument (dummy_gc_t)
     153 * @return EOK on success or an error code
     154 */
     155static errno_t dummygc_update(void *arg)
     156{
     157        (void) arg;
    130158        return EOK;
    131159}
     
    153181                    sizeof(uint32_t);
    154182                tbm->alloc.off0 = 0;
    155                 tbm->alloc.pixels = calloc(sizeof(uint32_t),
     183                tbm->alloc.pixels = calloc(
    156184                    (params->rect.p1.x - params->rect.p0.x) *
    157                     (params->rect.p1.y - params->rect.p0.y));
     185                    (params->rect.p1.y - params->rect.p0.y),
     186                    sizeof(uint32_t));
    158187                tbm->myalloc = true;
    159188                if (tbm->alloc.pixels == NULL) {
     
    199228{
    200229        dummygc_bitmap_t *tbm = (dummygc_bitmap_t *)bm;
     230
    201231        tbm->dgc->bm_rendered = true;
    202         tbm->dgc->bm_srect = *srect;
    203         tbm->dgc->bm_offs = *offs;
     232
     233        tbm->dgc->bm_srect.p0.x = 0;
     234        tbm->dgc->bm_srect.p0.y = 0;
     235        tbm->dgc->bm_srect.p1.x = 0;
     236        tbm->dgc->bm_srect.p1.y = 0;
     237
     238        tbm->dgc->bm_offs.x = 0;
     239        tbm->dgc->bm_offs.y = 0;
     240
     241        if (srect != NULL)
     242                tbm->dgc->bm_srect = *srect;
     243
     244        if (offs != NULL)
     245                tbm->dgc->bm_offs = *offs;
     246
    204247        return EOK;
    205248}
Note: See TracChangeset for help on using the changeset viewer.