Changeset a8eed5f in mainline for uspace/lib/gfx


Ignore:
Timestamp:
2020-02-28T16:03:20Z (6 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/lib/gfx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.