Changeset a8eed5f in mainline


Ignore:
Timestamp:
2020-02-28T16:03:20Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7bb45e3
Parents:
0e6e77f
git-author:
Jiri Svoboda <jiri@…> (2020-02-27 18:02:55)
git-committer:
Jiri Svoboda <jiri@…> (2020-02-28 16:03:20)
Message:

Future-proof gfx_bitmap_params_t with initialization function

Location:
uspace
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/gfxdemo/gfxdemo.c

    r0e6e77f ra8eed5f  
    232232                return rc;
    233233
     234        gfx_bitmap_params_init(&params);
    234235        params.rect.p0.x = 0;
    235236        params.rect.p0.y = 0;
  • uspace/app/terminal/terminal.c

    r0e6e77f ra8eed5f  
    775775        }
    776776
     777        gfx_bitmap_params_init(&params);
    777778        params.rect.p0.x = 0;
    778779        params.rect.p0.y = 0;
  • uspace/lib/display/src/display.c

    r0e6e77f ra8eed5f  
    137137/** Initialize window parameters structure.
    138138 *
     139 * Window parameters structure must always be initialized using this function
     140 * first.
     141 *
    139142 * @param params Window parameters structure
    140143 */
  • uspace/lib/gfx/include/gfx/bitmap.h

    r0e6e77f ra8eed5f  
    4242#include <types/gfx/bitmap.h>
    4343
     44extern void gfx_bitmap_params_init(gfx_bitmap_params_t *);
    4445extern errno_t gfx_bitmap_create(gfx_context_t *, gfx_bitmap_params_t *,
    4546    gfx_bitmap_alloc_t *, gfx_bitmap_t **);
  • uspace/lib/gfx/src/bitmap.c

    r0e6e77f ra8eed5f  
    3535
    3636#include <gfx/bitmap.h>
     37#include <mem.h>
    3738#include <stdint.h>
    3839#include <stdlib.h>
    3940#include "../private/bitmap.h"
    4041#include "../private/context.h"
     42
     43/** Initialize bitmap parameters structure.
     44 *
     45 * Bitmap parameters structure must always be initialized using this function
     46 * first.
     47 *
     48 * @param params Bitmap parameters structure
     49 */
     50void gfx_bitmap_params_init(gfx_bitmap_params_t *params)
     51{
     52        memset(params, 0, sizeof(gfx_bitmap_params_t));
     53}
    4154
    4255/** Allocate bitmap in a graphics context.
  • uspace/lib/gfx/test/bitmap.c

    r0e6e77f ra8eed5f  
    8484        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    8585
     86        gfx_bitmap_params_init(&params);
    8687        params.rect.p0.x = 1;
    8788        params.rect.p0.y = 2;
     
    120121        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    121122
     123        gfx_bitmap_params_init(&params);
     124
    122125        rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
    123126        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     
    159162        rc = gfx_context_new(&ops, &tgc, &gc);
    160163        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     164
     165        gfx_bitmap_params_init(&params);
    161166
    162167        rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
  • uspace/lib/gfx/test/coord.c

    r0e6e77f ra8eed5f  
    598598
    599599/** Rectangle dimensions for reversed rectangle are computed correctly */
    600 PCUT_TEST(rect_dims_straight)
     600PCUT_TEST(rect_dims_reversed)
    601601{
    602602        gfx_rect_t rect;
  • uspace/lib/gui/window.c

    r0e6e77f ra8eed5f  
    405405                return;
    406406
     407        gfx_bitmap_params_init(&params);
    407408        params.rect.p0.x = 0;
    408409        params.rect.p0.y = 0;
  • uspace/lib/ipcgfx/test/ipcgfx.c

    r0e6e77f ra8eed5f  
    330330        resp.rc = ENOMEM;
    331331        resp.bitmap_create_called = false;
     332
     333        gfx_bitmap_params_init(&params);
    332334        params.rect.p0.x = 1;
    333335        params.rect.p0.y = 2;
     
    387389        resp.rc = EOK;
    388390        resp.bitmap_create_called = false;
     391
     392        gfx_bitmap_params_init(&params);
    389393        params.rect.p0.x = 1;
    390394        params.rect.p0.y = 2;
     
    448452
    449453        resp.rc = EOK;
     454        gfx_bitmap_params_init(&params);
    450455        params.rect.p0.x = 1;
    451456        params.rect.p0.y = 2;
     
    502507
    503508        resp.rc = EOK;
     509        gfx_bitmap_params_init(&params);
    504510        params.rect.p0.x = 1;
    505511        params.rect.p0.y = 2;
     
    569575
    570576        resp.rc = EOK;
     577        gfx_bitmap_params_init(&params);
    571578        params.rect.p0.x = 1;
    572579        params.rect.p0.y = 2;
     
    635642
    636643        resp.rc = EOK;
     644        gfx_bitmap_params_init(&params);
    637645        params.rect.p0.x = 1;
    638646        params.rect.p0.y = 2;
  • uspace/srv/hid/display/window.c

    r0e6e77f ra8eed5f  
    282282        ds_display_add_window(client->display, wnd);
    283283
     284        gfx_bitmap_params_init(&bparams);
    284285        bparams.rect = params->rect;
    285286
     
    355356        dgc = ds_display_get_gc(wnd->display); // XXX
    356357        if (dgc != NULL) {
     358                gfx_bitmap_params_init(&bparams);
    357359                bparams.rect = *nrect;
    358360
Note: See TracChangeset for help on using the changeset viewer.