Changeset c6f08726 in mainline for uspace/srv/hid/console/gcons.c
- Timestamp:
- 2011-08-11T14:14:53Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d8eeb9
- Parents:
- 67b05ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/gcons.c
r67b05ff rc6f08726 60 60 #define COLOR_BACKGROUND 0xffffff 61 61 62 extern char _binary_gfx_anim_1_ppm_start[0];63 extern int _binary_gfx_anim_1_ppm_size;64 extern char _binary_gfx_anim_2_ppm_start[0];65 extern int _binary_gfx_anim_2_ppm_size;66 extern char _binary_gfx_anim_3_ppm_start[0];67 extern int _binary_gfx_anim_3_ppm_size;68 extern char _binary_gfx_anim_4_ppm_start[0];69 extern int _binary_gfx_anim_4_ppm_size;70 71 extern char _binary_gfx_cons_selected_ppm_start[0];72 extern int _binary_gfx_cons_selected_ppm_size;73 extern char _binary_gfx_cons_idle_ppm_start[0];74 extern int _binary_gfx_cons_idle_ppm_size;75 extern char _binary_gfx_cons_has_data_ppm_start[0];76 extern int _binary_gfx_cons_has_data_ppm_size;77 extern char _binary_gfx_cons_kernel_ppm_start[0];78 extern int _binary_gfx_cons_kernel_ppm_size;79 80 62 static bool use_gcons = false; 81 63 static sysarg_t xres; … … 84 66 static imgmap_t *helenos_img; 85 67 static imgmap_t *nameic_img; 68 69 static imgmap_t *anim_1_img; 70 static imgmap_t *anim_2_img; 71 static imgmap_t *anim_3_img; 72 static imgmap_t *anim_4_img; 73 74 static imgmap_t *cons_has_data_img; 75 static imgmap_t *cons_idle_img; 76 static imgmap_t *cons_kernel_img; 77 static imgmap_t *cons_selected_img; 86 78 87 79 enum butstate { … … 101 93 static int fbphone; 102 94 103 /** List of pixmaps identifying these icons */104 static int ic_ pixmaps[CONS_LAST] = {-1, -1, -1, -1, -1, -1};95 /** List of image maps identifying these icons */ 96 static int ic_imgmaps[CONS_LAST] = {-1, -1, -1, -1, -1, -1}; 105 97 static int animation = -1; 106 98 … … 149 141 enum butstate state = console_state[index]; 150 142 151 if (ic_ pixmaps[state] != -1)152 async_obsolete_msg_2(fbphone, FB_VP_DRAW_ PIXMAP, cstatus_vp[index],153 ic_ pixmaps[state]);143 if (ic_imgmaps[state] != -1) 144 async_obsolete_msg_2(fbphone, FB_VP_DRAW_IMGMAP, cstatus_vp[index], 145 ic_imgmaps[state]); 154 146 155 147 if ((state != CONS_DISCONNECTED) && (state != CONS_KERNEL) … … 388 380 389 381 /* Draw logo */ 390 async_obsolete_msg_2(fbphone, FB_DRAW_ PPM, x, y);382 async_obsolete_msg_2(fbphone, FB_DRAW_IMGMAP, x, y); 391 383 392 384 drop: … … 418 410 } 419 411 420 /** Creates a pixmap on framebuffer 421 * 422 * @param data PPM data 423 * @param size PPM data size 424 * 425 * @return Pixmap identification 426 * 427 */ 428 static int make_pixmap(char *data, size_t size) 429 { 412 /** Create an image map on framebuffer 413 * 414 * @param img Image map. 415 * 416 * @return Image map identification 417 * 418 */ 419 static int make_imgmap(imgmap_t *img) 420 { 421 if (img == NULL) 422 return -1; 423 430 424 /* Create area */ 431 char *shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |432 MAP_ ANONYMOUS, 0, 0);425 char *shm = mmap(NULL, img->size, PROTO_READ | PROTO_WRITE, 426 MAP_SHARED | MAP_ANONYMOUS, 0, 0); 433 427 if (shm == MAP_FAILED) 434 428 return -1; 435 429 436 memcpy(shm, data,size);437 438 int pxid = -1;430 memcpy(shm, img, img->size); 431 432 int id = -1; 439 433 440 434 /* Send area */ … … 447 441 goto drop; 448 442 449 /* Obtain pixmap*/450 rc = async_obsolete_req_0_0(fbphone, FB_SHM2 PIXMAP);443 /* Obtain image map identifier */ 444 rc = async_obsolete_req_0_0(fbphone, FB_SHM2IMGMAP); 451 445 if (rc < 0) 452 446 goto drop; 453 447 454 pxid = rc;448 id = rc; 455 449 456 450 drop: … … 460 454 exit: 461 455 /* Remove area */ 462 munmap(shm, size);463 464 return pxid;456 munmap(shm, img->size); 457 458 return id; 465 459 } 466 460 … … 472 466 return; 473 467 474 int pm = make_pixmap(_binary_gfx_anim_1_ppm_start, 475 (size_t) &_binary_gfx_anim_1_ppm_size); 476 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 477 478 pm = make_pixmap(_binary_gfx_anim_2_ppm_start, 479 (size_t) &_binary_gfx_anim_2_ppm_size); 480 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 481 482 pm = make_pixmap(_binary_gfx_anim_3_ppm_start, 483 (size_t) &_binary_gfx_anim_3_ppm_size); 484 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 485 486 pm = make_pixmap(_binary_gfx_anim_4_ppm_start, 487 (size_t) &_binary_gfx_anim_4_ppm_size); 488 async_obsolete_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 468 int pm = make_imgmap(anim_1_img); 469 async_obsolete_msg_2(fbphone, FB_ANIM_ADDIMGMAP, an, pm); 470 471 pm = make_imgmap(anim_2_img); 472 async_obsolete_msg_2(fbphone, FB_ANIM_ADDIMGMAP, an, pm); 473 474 pm = make_imgmap(anim_3_img); 475 async_obsolete_msg_2(fbphone, FB_ANIM_ADDIMGMAP, an, pm); 476 477 pm = make_imgmap(anim_4_img); 478 async_obsolete_msg_2(fbphone, FB_ANIM_ADDIMGMAP, an, pm); 489 479 490 480 async_obsolete_msg_1(fbphone, FB_ANIM_START, an); … … 506 496 507 497 /* Create image maps */ 508 helenos_img = imgmap_decode_tga((void *) helenos_tga); 509 nameic_img = imgmap_decode_tga((void *) nameic_tga); 498 helenos_img = imgmap_decode_tga((void *) helenos_tga, 499 helenos_tga_size); 500 nameic_img = imgmap_decode_tga((void *) nameic_tga, 501 nameic_tga_size); 502 503 anim_1_img = imgmap_decode_tga((void *) anim_1_tga, 504 anim_1_tga_size); 505 anim_2_img = imgmap_decode_tga((void *) anim_2_tga, 506 anim_2_tga_size); 507 anim_3_img = imgmap_decode_tga((void *) anim_3_tga, 508 anim_3_tga_size); 509 anim_4_img = imgmap_decode_tga((void *) anim_4_tga, 510 anim_4_tga_size); 511 512 cons_has_data_img = imgmap_decode_tga((void *) cons_has_data_tga, 513 cons_has_data_tga_size); 514 cons_idle_img = imgmap_decode_tga((void *) cons_idle_tga, 515 cons_idle_tga_size); 516 cons_kernel_img = imgmap_decode_tga((void *) cons_kernel_tga, 517 cons_kernel_tga_size); 518 cons_selected_img = imgmap_decode_tga((void *) cons_selected_tga, 519 cons_selected_tga_size); 510 520 511 521 /* Create console viewport */ … … 535 545 536 546 /* Initialize icons */ 537 ic_pixmaps[CONS_SELECTED] = 538 make_pixmap(_binary_gfx_cons_selected_ppm_start, 539 (size_t) &_binary_gfx_cons_selected_ppm_size); 540 ic_pixmaps[CONS_IDLE] = 541 make_pixmap(_binary_gfx_cons_idle_ppm_start, 542 (size_t) &_binary_gfx_cons_idle_ppm_size); 543 ic_pixmaps[CONS_HAS_DATA] = 544 make_pixmap(_binary_gfx_cons_has_data_ppm_start, 545 (size_t) &_binary_gfx_cons_has_data_ppm_size); 546 ic_pixmaps[CONS_DISCONNECTED] = 547 make_pixmap(_binary_gfx_cons_idle_ppm_start, 548 (size_t) &_binary_gfx_cons_idle_ppm_size); 549 ic_pixmaps[CONS_KERNEL] = 550 make_pixmap(_binary_gfx_cons_kernel_ppm_start, 551 (size_t) &_binary_gfx_cons_kernel_ppm_size); 552 ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; 547 ic_imgmaps[CONS_SELECTED] = make_imgmap(cons_selected_img); 548 ic_imgmaps[CONS_IDLE] = make_imgmap(cons_idle_img); 549 ic_imgmaps[CONS_HAS_DATA] = make_imgmap(cons_has_data_img); 550 ic_imgmaps[CONS_DISCONNECTED] = make_imgmap(cons_idle_img); 551 ic_imgmaps[CONS_KERNEL] = make_imgmap(cons_kernel_img); 552 ic_imgmaps[CONS_DISCONNECTED_SEL] = ic_imgmaps[CONS_SELECTED]; 553 553 554 554 make_anim();
Note:
See TracChangeset
for help on using the changeset viewer.