Changeset 211fd68 in mainline for uspace/app/barber/barber.c
- Timestamp:
- 2024-03-08T10:41:31Z (10 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.