Changeset 2ab8ab3 in mainline for uspace/lib/gfx
- Timestamp:
- 2021-02-16T18:12:05Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68a552f
- Parents:
- ef734b7
- Location:
- uspace/lib/gfx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfx/include/gfx/render.h
ref734b7 r2ab8ab3 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 extern errno_t gfx_set_color(gfx_context_t *, gfx_color_t *); 45 45 extern errno_t gfx_fill_rect(gfx_context_t *, gfx_rect_t *); 46 extern errno_t gfx_update(gfx_context_t *); 46 47 47 48 #endif -
uspace/lib/gfx/include/types/gfx/ops/context.h
ref734b7 r2ab8ab3 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 51 51 /** Fill rectangle using the current drawing color */ 52 52 errno_t (*fill_rect)(void *, gfx_rect_t *); 53 /** Update display */ 54 errno_t (*update)(void *); 53 55 /** Create bitmap */ 54 56 errno_t (*bitmap_create)(void *, gfx_bitmap_params_t *, -
uspace/lib/gfx/src/render.c
ref734b7 r2ab8ab3 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 63 63 } 64 64 65 /** Update display. 66 * 67 * Finish any deferred rendering. 68 * 69 * @param gc Graphic context 70 * 71 * @return EOK on success, ENOMEM if insufficient resources, 72 * EIO if grahic device connection was lost 73 */ 74 errno_t gfx_update(gfx_context_t *gc) 75 { 76 return gc->ops->update(gc->arg); 77 } 78 65 79 /** @} 66 80 */ -
uspace/lib/gfx/test/render.c
ref734b7 r2ab8ab3 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 32 32 #include <pcut/pcut.h> 33 33 #include <mem.h> 34 #include <stdbool.h> 34 35 35 36 PCUT_INIT; … … 39 40 static errno_t testgc_set_color(void *, gfx_color_t *); 40 41 static errno_t testgc_fill_rect(void *, gfx_rect_t *); 42 static errno_t testgc_update(void *); 41 43 42 44 static gfx_context_ops_t ops = { 43 45 .set_color = testgc_set_color, 44 .fill_rect = testgc_fill_rect 46 .fill_rect = testgc_fill_rect, 47 .update = testgc_update 45 48 }; 46 49 … … 49 52 gfx_color_t *dclr; 50 53 gfx_rect_t *rect; 54 bool updated; 51 55 } test_gc_t; 52 56 … … 107 111 } 108 112 113 PCUT_TEST(update) 114 { 115 errno_t rc; 116 gfx_context_t *gc = NULL; 117 test_gc_t tgc; 118 119 memset(&tgc, 0, sizeof(tgc)); 120 121 rc = gfx_context_new(&ops, &tgc, &gc); 122 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 123 124 PCUT_ASSERT_FALSE(tgc.updated); 125 gfx_update(gc); 126 PCUT_ASSERT_TRUE(tgc.updated); 127 128 rc = gfx_context_delete(gc); 129 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 130 } 131 109 132 static errno_t testgc_set_color(void *arg, gfx_color_t *color) 110 133 { … … 125 148 } 126 149 150 static errno_t testgc_update(void *arg) 151 { 152 test_gc_t *tgc = (test_gc_t *) arg; 153 154 tgc->updated = true; 155 return EOK; 156 } 157 127 158 PCUT_EXPORT(render);
Note:
See TracChangeset
for help on using the changeset viewer.