- Timestamp:
- 2024-03-08T10:41:31Z (19 months ago)
- Branches:
- master
- Children:
- 0a411bbf
- Parents:
- cd27cd1
- git-author:
- Jiri Svoboda <jiri@…> (2024-03-07 18:41:21)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-03-08 10:41:31)
- Location:
- uspace
- Files:
-
- 30 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/aboutos/meson.build
rcd27cd1 r211fd68 35 35 input : _images, 36 36 output : [ 'images.zip' ], 37 command : [ mkarray, '@OUTDIR@', 'images', 'image', uspace_as_prolog, '.data', '@INPUT@' ],37 command : [ mkarray, '@OUTDIR@', 'images', 'image', 'image', uspace_as_prolog, '.data', '@INPUT@' ], 38 38 ) 39 39 _imgs_s = custom_target('aboutos_images.s', -
uspace/app/barber/barber.c
rcd27cd1 r211fd68 50 50 #include <ui/image.h> 51 51 #include "images.h" 52 #include "images_tiny.h" 52 53 53 54 #define NAME "barber" … … 60 61 #define MIN_LOAD (LOAD_UNIT / 4) 61 62 #define MAX_LOAD (LOAD_UNIT / 3) 62 63 #define FRAME_WIDTH 5964 #define FRAME_HEIGHT 19265 63 66 64 #define LED_PERIOD 1000000 … … 97 95 static unsigned int frame = 0; 98 96 static unsigned int fps = MIN_FPS; 97 static gfx_coord_t frame_width; 98 static gfx_coord_t frame_height; 99 99 100 100 static void led_timer_callback(void *); … … 119 119 } 120 120 121 static bool decode_frames(gfx_context_t *gc )121 static bool decode_frames(gfx_context_t *gc, image_t *img) 122 122 { 123 123 gfx_rect_t rect; … … 125 125 126 126 for (unsigned int i = 0; i < FRAMES; i++) { 127 rc = decode_tga_gz(gc, im ages[i].addr, images[i].size,127 rc = decode_tga_gz(gc, img[i].addr, img[i].size, 128 128 &frame_bmp[i], &rect); 129 129 if (rc != EOK) { … … 132 132 } 133 133 134 (void) 134 (void)rect; 135 135 } 136 136 … … 238 238 rect.p0.x = 0; 239 239 rect.p0.y = 0; 240 rect.p1.x = FRAME_WIDTH;241 rect.p1.y = FRAME_HEIGHT;240 rect.p1.x = frame_width; 241 rect.p1.y = frame_height; 242 242 243 243 ui_image_set_bmp(frame_img, frame_bmp[frame], &rect); … … 299 299 int main(int argc, char *argv[]) 300 300 { 301 const char *display_spec = UI_ DISPLAY_DEFAULT;301 const char *display_spec = UI_ANY_DEFAULT; 302 302 barber_t barber; 303 303 ui_t *ui; … … 310 310 gfx_context_t *gc; 311 311 gfx_coord2_t off; 312 image_t *img; 312 313 int i; 313 314 … … 355 356 } 356 357 358 if (ui_is_textmode(ui)) { 359 frame_width = 10; 360 frame_height = 16; 361 } else { 362 frame_width = 59; 363 frame_height = 192; 364 } 365 357 366 rect.p0.x = 0; 358 367 rect.p0.y = 0; 359 rect.p1.x = FRAME_WIDTH;360 rect.p1.y = FRAME_HEIGHT;368 rect.p1.x = frame_width; 369 rect.p1.y = frame_height; 361 370 362 371 ui_wnd_params_init(¶ms); … … 367 376 * to rect 368 377 */ 369 ui_wdecor_rect_from_app( params.style, &rect, &wrect);378 ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect); 370 379 off = wrect.p0; 371 380 gfx_rect_rtranslate(&off, &wrect, ¶ms.rect); … … 384 393 ui_window_set_cb(window, &window_cb, (void *) &barber); 385 394 386 if (!decode_frames(gc)) 395 img = ui_is_textmode(ui) ? image_tinys : images; 396 397 if (!decode_frames(gc, img)) 387 398 return 1; 388 399 -
uspace/app/barber/meson.build
rcd27cd1 r211fd68 62 62 ) 63 63 64 _images_tiny = files( 65 'gfx-tiny/frame01t.tga.gz', 66 'gfx-tiny/frame02t.tga.gz', 67 'gfx-tiny/frame03t.tga.gz', 68 'gfx-tiny/frame04t.tga.gz', 69 'gfx-tiny/frame05t.tga.gz', 70 'gfx-tiny/frame06t.tga.gz', 71 'gfx-tiny/frame07t.tga.gz', 72 'gfx-tiny/frame08t.tga.gz', 73 'gfx-tiny/frame09t.tga.gz', 74 'gfx-tiny/frame10t.tga.gz', 75 'gfx-tiny/frame11t.tga.gz', 76 'gfx-tiny/frame12t.tga.gz', 77 'gfx-tiny/frame13t.tga.gz', 78 'gfx-tiny/frame14t.tga.gz', 79 'gfx-tiny/frame15t.tga.gz', 80 'gfx-tiny/frame16t.tga.gz', 81 'gfx-tiny/frame17t.tga.gz', 82 'gfx-tiny/frame18t.tga.gz', 83 'gfx-tiny/frame19t.tga.gz', 84 'gfx-tiny/frame20t.tga.gz', 85 'gfx-tiny/frame21t.tga.gz', 86 'gfx-tiny/frame22t.tga.gz', 87 'gfx-tiny/frame23t.tga.gz', 88 'gfx-tiny/frame24t.tga.gz', 89 'gfx-tiny/frame25t.tga.gz', 90 'gfx-tiny/frame26t.tga.gz', 91 'gfx-tiny/frame27t.tga.gz', 92 'gfx-tiny/frame28t.tga.gz', 93 'gfx-tiny/frame29t.tga.gz', 94 'gfx-tiny/frame30t.tga.gz', 95 ) 96 64 97 _tarball = custom_target('barber_images.tar', 65 98 input: _images, … … 70 103 # TODO 71 104 105 # Normal images 106 72 107 _images_zip = custom_target('barber_images.zip', 73 108 input : _images, 74 109 output : [ 'images.zip' ], 75 command : [ mkarray, '@OUTDIR@', 'images', 'image', uspace_as_prolog, '.data', '@INPUT@' ],110 command : [ mkarray, '@OUTDIR@', 'images', 'image', 'image', uspace_as_prolog, '.data', '@INPUT@' ], 76 111 ) 77 112 _imgs_s = custom_target('barber_images.s', … … 94 129 ) 95 130 96 src = [ files('barber.c'), _imgs_s, _imgs_h, _imgs_desc_c ] 131 # Tiny images 132 133 _images_tiny_zip = custom_target('barber_images_tiny.zip', 134 input : _images_tiny, 135 output : [ 'images_tiny.zip' ], 136 command : [ mkarray, '@OUTDIR@', 'images_tiny', 'image', 'image_tiny', uspace_as_prolog, '.data', '@INPUT@' ], 137 ) 138 _imgs_tiny_s = custom_target('barber_images_tiny.s', 139 input : _images_tiny_zip, 140 output : [ 'images_tiny.s' ], 141 command : [ unzip, '-p', '@INPUT@', 'images_tiny.s' ], 142 capture : true, 143 ) 144 _imgs_tiny_h = custom_target('barber_images_tiny.h', 145 input : _images_tiny_zip, 146 output : [ 'images_tiny.h' ], 147 command : [ unzip, '-p', '@INPUT@', 'images_tiny.h' ], 148 capture : true, 149 ) 150 _imgs_tiny_desc_c = custom_target('barber_images_tiny_desc.c', 151 input : _images_tiny_zip, 152 output : [ 'images_tiny_desc.c' ], 153 command : [ unzip, '-p', '@INPUT@', 'images_tiny_desc.c' ], 154 capture : true, 155 ) 156 157 src = [ files('barber.c'), _imgs_s, _imgs_h, _imgs_desc_c, 158 _imgs_tiny_s, _imgs_tiny_h, _imgs_tiny_desc_c ] -
uspace/app/fontedit/fontedit.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 787 787 * to rect 788 788 */ 789 ui_wdecor_rect_from_app( params.style, &rect, &wrect);789 ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect); 790 790 off = wrect.p0; 791 791 gfx_rect_rtranslate(&off, &wrect, ¶ms.rect); -
uspace/app/gfxdemo/gfxdemo.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 1160 1160 * to rect 1161 1161 */ 1162 ui_wdecor_rect_from_app( params.style, &rect, &wrect);1162 ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect); 1163 1163 off = wrect.p0; 1164 1164 gfx_rect_rtranslate(&off, &wrect, ¶ms.rect); -
uspace/app/terminal/terminal.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * Copyright (c) 2012 Petr Koupy 4 4 * All rights reserved. … … 974 974 wparams.placement = ui_wnd_place_top_left; 975 975 976 rc = ui_create(display_spec, &term->ui); 977 if (rc != EOK) { 978 printf("Error creating UI on %s.\n", display_spec); 979 goto error; 980 } 981 976 982 /* 977 983 * Compute window rectangle such that application area corresponds 978 984 * to rect 979 985 */ 980 ui_wdecor_rect_from_app( wparams.style, &rect, &wrect);986 ui_wdecor_rect_from_app(term->ui, wparams.style, &rect, &wrect); 981 987 off = wrect.p0; 982 988 gfx_rect_rtranslate(&off, &wrect, &wparams.rect); 983 989 984 990 term->off = off; 985 986 rc = ui_create(display_spec, &term->ui);987 if (rc != EOK) {988 printf("Error creating UI on %s.\n", display_spec);989 goto error;990 }991 991 992 992 rc = ui_window_create(term->ui, &wparams, &term->window); -
uspace/app/viewer/viewer.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * Copyright (c) 2013 Martin Decky 4 4 * All rights reserved. … … 314 314 * to rect 315 315 */ 316 ui_wdecor_rect_from_app( params.style, &lrect, &wrect);316 ui_wdecor_rect_from_app(ui, params.style, &lrect, &wrect); 317 317 off = wrect.p0; 318 318 gfx_rect_rtranslate(&off, &wrect, &rect); -
uspace/lib/congfx/src/console.c
rcd27cd1 r211fd68 91 91 uint8_t attr; 92 92 93 if ((clr >> 24) == 0 ) {93 if ((clr >> 24) == 0xff) { 94 94 /* RGB (no text) */ 95 95 ch->ch = 0; -
uspace/lib/gfx/src/color.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 64 64 color->g = g; 65 65 color->b = b; 66 color->attr = 0xff; 66 67 67 68 *rcolor = color; -
uspace/lib/ui/include/ui/wdecor.h
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 #include <types/ui/event.h> 45 45 #include <types/ui/resource.h> 46 #include <types/ui/ui.h> 46 47 #include <types/ui/wdecor.h> 47 48 … … 58 59 extern ui_evclaim_t ui_wdecor_kbd_event(ui_wdecor_t *, kbd_event_t *); 59 60 extern ui_evclaim_t ui_wdecor_pos_event(ui_wdecor_t *, pos_event_t *); 60 extern void ui_wdecor_rect_from_app(ui_ wdecor_style_t, gfx_rect_t *,61 extern void ui_wdecor_rect_from_app(ui_t *, ui_wdecor_style_t, gfx_rect_t *, 61 62 gfx_rect_t *); 62 63 extern void ui_wdecor_app_from_rect(ui_wdecor_style_t, gfx_rect_t *, -
uspace/lib/ui/src/wdecor.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 45 45 #include <ui/paint.h> 46 46 #include <ui/pbutton.h> 47 #include <ui/ui.h> 47 48 #include <ui/wdecor.h> 48 49 #include "../private/resource.h" … … 94 95 /** Window resizing edge height */ 95 96 wdecor_edge_h = 4, 97 /** Window resizing edge witdth */ 98 wdecor_edge_w_text = 1, 99 /** Window resizing edge height */ 100 wdecor_edge_h_text = 1, 96 101 /** Title bar height */ 97 102 wdecor_tbar_h = 22, … … 860 865 * and its decoration. 861 866 * 867 * @param ui UI 862 868 * @param style Decoration style 863 869 * @param app Application area rectangle 864 870 * @param rect Place to store (outer) window decoration rectangle 865 871 */ 866 void ui_wdecor_rect_from_app(ui_wdecor_style_t style, gfx_rect_t *app, 867 gfx_rect_t *rect) 868 { 872 void ui_wdecor_rect_from_app(ui_t *ui, ui_wdecor_style_t style, 873 gfx_rect_t *app, gfx_rect_t *rect) 874 { 875 bool textmode; 876 gfx_coord_t edge_w, edge_h; 869 877 *rect = *app; 870 878 879 textmode = ui_is_textmode(ui); 880 if (textmode) { 881 edge_w = wdecor_edge_w_text; 882 edge_h = wdecor_edge_h_text; 883 } else { 884 edge_w = wdecor_edge_w; 885 edge_h = wdecor_edge_h; 886 } 887 871 888 if ((style & ui_wds_frame) != 0) { 872 rect->p0.x -= wdecor_edge_w;873 rect->p0.y -= wdecor_edge_h;874 rect->p1.x += wdecor_edge_w;875 rect->p1.y += wdecor_edge_h;876 } 877 878 if ((style & ui_wds_titlebar) != 0 )879 rect->p0.y -= 22;889 rect->p0.x -= edge_w; 890 rect->p0.y -= edge_h; 891 rect->p1.x += edge_w; 892 rect->p1.y += edge_h; 893 } 894 895 if ((style & ui_wds_titlebar) != 0 && !textmode) 896 rect->p0.y -= wdecor_tbar_h; 880 897 } 881 898 -
uspace/lib/ui/test/wdecor.c
rcd27cd1 r211fd68 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 34 34 #include <ui/pbutton.h> 35 35 #include <ui/resource.h> 36 #include <ui/ui.h> 36 37 #include <ui/wdecor.h> 37 38 #include "../private/wdecor.h" … … 1322 1323 PCUT_TEST(rect_from_app) 1323 1324 { 1325 errno_t rc; 1326 ui_t *ui = NULL; 1324 1327 gfx_rect_t arect; 1325 1328 gfx_rect_t rect; 1329 1330 rc = ui_create_disp(NULL, &ui); 1331 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1326 1332 1327 1333 arect.p0.x = 14; … … 1330 1336 arect.p1.y = 196; 1331 1337 1332 ui_wdecor_rect_from_app(ui _wds_none, &arect, &rect);1338 ui_wdecor_rect_from_app(ui, ui_wds_none, &arect, &rect); 1333 1339 1334 1340 PCUT_ASSERT_INT_EQUALS(14, rect.p0.x); … … 1337 1343 PCUT_ASSERT_INT_EQUALS(196, rect.p1.y); 1338 1344 1339 ui_wdecor_rect_from_app(ui _wds_frame, &arect, &rect);1345 ui_wdecor_rect_from_app(ui, ui_wds_frame, &arect, &rect); 1340 1346 1341 1347 PCUT_ASSERT_INT_EQUALS(10, rect.p0.x); … … 1344 1350 PCUT_ASSERT_INT_EQUALS(200, rect.p1.y); 1345 1351 1346 ui_wdecor_rect_from_app(ui _wds_decorated, &arect, &rect);1352 ui_wdecor_rect_from_app(ui, ui_wds_decorated, &arect, &rect); 1347 1353 1348 1354 PCUT_ASSERT_INT_EQUALS(10, rect.p0.x); … … 1351 1357 PCUT_ASSERT_INT_EQUALS(200, rect.p1.y); 1352 1358 1359 ui_destroy(ui); 1353 1360 } 1354 1361
Note:
See TracChangeset
for help on using the changeset viewer.