Changeset a4e4e29 in mainline
- Timestamp:
- 2026-02-17T11:57:13Z (3 days ago)
- Branches:
- master
- Children:
- 2c12135
- Parents:
- 00d26202
- git-author:
- Jiri Svoboda <jiri@…> (2026-02-17 18:56:50)
- git-committer:
- Jiri Svoboda <jiri@…> (2026-02-17 11:57:13)
- Location:
- uspace
- Files:
-
- 3 edited
-
app/gfxdemo/gfxdemo.c (modified) (8 diffs)
-
lib/congfx/include/congfx/console.h (modified) (1 diff)
-
lib/congfx/src/console.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r00d26202 ra4e4e29 79 79 static console_ctrl_t *con = NULL; 80 80 static bool textmode; 81 static console_gc_t *cgc = NULL; 82 static unsigned scr_width, scr_height; 81 83 static ui_t *ui; 82 84 … … 99 101 usec_t usec; 100 102 cons_event_t cevent; 103 sysarg_t cols, rows; 101 104 102 105 if (ui != NULL) … … 113 116 demo_kbd_event(&cevent.ev.key); 114 117 fibril_mutex_lock(&quit_lock); 118 } else if (cevent.type == CEV_RESIZE) { 119 rc = console_get_size(con, 120 &cols, &rows); 121 if (rc == EOK) { 122 scr_width = cols; 123 scr_height = rows; 124 } 125 rc = console_gc_resize(cgc); 126 if (rc != EOK) 127 exit(1); 115 128 } 116 129 } … … 1024 1037 * 1025 1038 * @param gc Graphic context 1026 * @param w Width 1027 * @param h Height 1028 */ 1029 static errno_t demo_loop(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h) 1030 { 1031 errno_t rc; 1032 1033 (void) demo_font_init(gc, w, h); 1039 */ 1040 static errno_t demo_loop(gfx_context_t *gc) 1041 { 1042 errno_t rc; 1043 1044 (void) demo_font_init(gc, scr_width, scr_height); 1034 1045 1035 1046 while (!quit) { 1036 rc = demo_rects(gc, w, h);1037 if (rc != EOK) 1038 goto error; 1039 1040 rc = demo_bitmap(gc, w, h);1041 if (rc != EOK) 1042 goto error; 1043 1044 rc = demo_bitmap2(gc, w, h);1045 if (rc != EOK) 1046 goto error; 1047 1048 rc = demo_bitmap_kc(gc, w, h);1049 if (rc != EOK) 1050 goto error; 1051 1052 rc = demo_text(gc, w, h);1053 if (rc != EOK) 1054 goto error; 1055 1056 rc = demo_text_abbr(gc, w, h);1057 if (rc != EOK) 1058 goto error; 1059 1060 rc = demo_clip(gc, w, h);1047 rc = demo_rects(gc, scr_width, scr_height); 1048 if (rc != EOK) 1049 goto error; 1050 1051 rc = demo_bitmap(gc, scr_width, scr_height); 1052 if (rc != EOK) 1053 goto error; 1054 1055 rc = demo_bitmap2(gc, scr_width, scr_height); 1056 if (rc != EOK) 1057 goto error; 1058 1059 rc = demo_bitmap_kc(gc, scr_width, scr_height); 1060 if (rc != EOK) 1061 goto error; 1062 1063 rc = demo_text(gc, scr_width, scr_height); 1064 if (rc != EOK) 1065 goto error; 1066 1067 rc = demo_text_abbr(gc, scr_width, scr_height); 1068 if (rc != EOK) 1069 goto error; 1070 1071 rc = demo_clip(gc, scr_width, scr_height); 1061 1072 if (rc != EOK) 1062 1073 goto error; … … 1073 1084 static errno_t demo_console(void) 1074 1085 { 1075 console_gc_t *cgc = NULL;1076 1086 gfx_context_t *gc; 1077 1087 sysarg_t cols, rows; … … 1095 1105 textmode = true; 1096 1106 1097 rc = demo_loop(gc, cols, rows); 1107 scr_width = cols; 1108 scr_height = rows; 1109 1110 rc = demo_loop(gc); 1098 1111 if (rc != EOK) 1099 1112 return rc; … … 1112 1125 1113 1126 ui_lock(args->ui); 1114 rc = demo_loop(args->gc, args->dims.x, args->dims.y); 1127 scr_width = args->dims.x; 1128 scr_height = args->dims.y; 1129 rc = demo_loop(args->gc); 1115 1130 ui_unlock(args->ui); 1116 1131 ui_quit(args->ui); … … 1259 1274 textmode = false; 1260 1275 1261 rc = demo_loop(gc, 400, 300); 1276 scr_width = 400; 1277 scr_height = 300; 1278 rc = demo_loop(gc); 1262 1279 if (rc != EOK) 1263 1280 return rc; -
uspace/lib/congfx/include/congfx/console.h
r00d26202 ra4e4e29 49 49 extern errno_t console_gc_suspend(console_gc_t *); 50 50 extern errno_t console_gc_resume(console_gc_t *); 51 extern errno_t console_gc_resize(console_gc_t *); 51 52 extern gfx_context_t *console_gc_get_ctx(console_gc_t *); 52 53 -
uspace/lib/congfx/src/console.c
r00d26202 ra4e4e29 314 314 } 315 315 316 /** Update console GC size after console resize. 317 * 318 * @param con Console object 319 * 320 * @return EOK on success or an error code 321 */ 322 errno_t console_gc_resize(console_gc_t *cgc) 323 { 324 sysarg_t rows; 325 sysarg_t cols; 326 charfield_t *buf = NULL; 327 errno_t rc; 328 329 console_unmap(cgc->con, cgc->buf); 330 cgc->buf = NULL; 331 332 rc = console_get_size(cgc->con, &cols, &rows); 333 if (rc != EOK) 334 goto error; 335 336 rc = console_map(cgc->con, cols, rows, &buf); 337 if (rc != EOK) 338 goto error; 339 340 cgc->rect.p0.x = 0; 341 cgc->rect.p0.y = 0; 342 cgc->rect.p1.x = cols; 343 cgc->rect.p1.y = rows; 344 cgc->clip_rect = cgc->rect; 345 cgc->buf = buf; 346 return EOK; 347 error: 348 return rc; 349 } 350 351 316 352 /** Get generic graphic context from console GC. 317 353 *
Note:
See TracChangeset
for help on using the changeset viewer.
