Changeset dcc4cb31 in mainline
- Timestamp:
- 2019-10-17T23:20:18Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e0545de
- Parents:
- 78a71936
- Location:
- uspace/lib/gfx
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfx/include/gfx/bitmap.h
r78a71936 rdcc4cb31 43 43 44 44 extern errno_t gfx_bitmap_create(gfx_context_t *, gfx_bitmap_params_t *, 45 46 extern errno_t gfx_bitmap_de lete(gfx_bitmap_t *);45 gfx_bitmap_alloc_t *, gfx_bitmap_t **); 46 extern errno_t gfx_bitmap_destroy(gfx_bitmap_t *); 47 47 extern errno_t gfx_bitmap_render(gfx_bitmap_t *, gfx_rect_t *, gfx_coord2_t *); 48 48 extern errno_t gfx_bitmap_get_alloc(gfx_bitmap_t *, gfx_bitmap_alloc_t *); -
uspace/lib/gfx/include/types/gfx/ops/context.h
r78a71936 rdcc4cb31 52 52 errno_t (*fill_rect)(void *, gfx_rect_t *); 53 53 /** Create bitmap */ 54 errno_t (*bitmap_create)(void *, gfx_bitmap_params_t *, void *,55 gfx_bitmap_ t**);56 /** De letebitmap */57 errno_t (*bitmap_de lete)(void *, gfx_bitmap_t*);54 errno_t (*bitmap_create)(void *, gfx_bitmap_params_t *, 55 gfx_bitmap_alloc_t *, void **); 56 /** Destroy bitmap */ 57 errno_t (*bitmap_destroy)(void *); 58 58 /** Render bitmap */ 59 errno_t (*bitmap_render)(void *, gfx_bitmap_t *, gfx_rect_t *, 60 gfx_coord2_t *); 59 errno_t (*bitmap_render)(void *, gfx_rect_t *, gfx_coord2_t *); 61 60 /** Get bitmap allocation info */ 62 errno_t (*bitmap_get_alloc)(void *, gfx_bitmap_t *, 63 gfx_bitmap_alloc_t *); 61 errno_t (*bitmap_get_alloc)(void *, gfx_bitmap_alloc_t *); 64 62 } gfx_context_ops_t; 65 63 -
uspace/lib/gfx/meson.build
r78a71936 rdcc4cb31 1 1 # 2 # Copyright (c) 201 5Jiri Svoboda2 # Copyright (c) 2019 Jiri Svoboda 3 3 # All rights reserved. 4 4 # … … 35 35 36 36 test_src = files( 37 'test/bitmap.c', 37 38 'test/color.c', 38 39 'test/main.c', -
uspace/lib/gfx/src/bitmap.c
r78a71936 rdcc4cb31 55 55 gfx_bitmap_alloc_t *alloc, gfx_bitmap_t **rbitmap) 56 56 { 57 return gc->ops->bitmap_create(gc->arg, params, alloc, rbitmap); 57 void *bm_priv; 58 gfx_bitmap_t *bitmap; 59 errno_t rc; 60 61 bitmap = calloc(1, sizeof(gfx_bitmap_t)); 62 if (bitmap == NULL) 63 return ENOMEM; 64 65 rc = gc->ops->bitmap_create(gc->arg, params, alloc, &bm_priv); 66 if (rc != EOK) 67 return rc; 68 69 bitmap->gc = gc; 70 bitmap->gc_priv = bm_priv; 71 *rbitmap = bitmap; 72 return EOK; 58 73 } 59 74 60 /** De letebitmap from graphics context.75 /** Destroy bitmap from graphics context. 61 76 * 62 77 * @param bitmap Bitmap … … 64 79 * @return EOK on success, EIO if grahic device connection was lost 65 80 */ 66 errno_t gfx_bitmap_de lete(gfx_bitmap_t *bitmap)81 errno_t gfx_bitmap_destroy(gfx_bitmap_t *bitmap) 67 82 { 68 return bitmap->gc->ops->bitmap_delete(bitmap->gc->arg, bitmap); 83 errno_t rc; 84 85 rc = bitmap->gc->ops->bitmap_destroy(bitmap->gc_priv); 86 if (rc != EOK) 87 return rc; 88 89 free(bitmap); 90 return EOK; 69 91 } 70 92 … … 80 102 gfx_coord2_t *offs) 81 103 { 82 return bitmap->gc->ops->bitmap_render(bitmap->gc->arg, bitmap, 83 srect, offs); 104 return bitmap->gc->ops->bitmap_render(bitmap->gc_priv, srect, offs); 84 105 } 85 106 … … 93 114 errno_t gfx_bitmap_get_alloc(gfx_bitmap_t *bitmap, gfx_bitmap_alloc_t *alloc) 94 115 { 95 return bitmap->gc->ops->bitmap_get_alloc(bitmap->gc->arg, bitmap, 96 alloc); 116 return bitmap->gc->ops->bitmap_get_alloc(bitmap->gc_priv, alloc); 97 117 } 98 118 -
uspace/lib/gfx/test/main.c
r78a71936 rdcc4cb31 31 31 PCUT_INIT; 32 32 33 PCUT_IMPORT(bitmap); 33 34 PCUT_IMPORT(color); 34 35 PCUT_IMPORT(render);
Note:
See TracChangeset
for help on using the changeset viewer.