Changes in uspace/app/gfxdemo/gfxdemo.c [232bf2c:da15002] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r232bf2c rda15002 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2020 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 73 73 static gfx_coord_t vpad; 74 74 75 /** Determine if we are running in text mode.76 *77 * @param w Screen width78 * @param h Screen height79 * @return @c true iff we are running in text mode80 */81 static bool demo_is_text(gfx_coord_t w, gfx_coord_t h)82 {83 // XXX Need a proper way to determine text mode84 return w <= 80;85 }86 87 75 /** Clear screen. 88 76 * … … 227 215 228 216 if (font != NULL) { 229 if (demo_is_text(w, h)) { 230 rc = gfx_color_new_ega(0x1e, &color); 231 if (rc != EOK) 232 goto error; 233 } else { 234 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); 235 if (rc != EOK) 236 goto error; 237 } 217 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); 218 if (rc != EOK) 219 goto error; 238 220 239 221 gfx_text_fmt_init(&fmt); … … 678 660 gfx_color_delete(color); 679 661 680 if (demo_is_text(w, h)) { 681 rc = gfx_color_new_ega(0x1f, &color); 682 if (rc != EOK) 683 goto error; 684 } else { 685 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); 686 if (rc != EOK) 687 goto error; 688 } 662 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); 663 if (rc != EOK) 664 goto error; 689 665 690 666 gfx_text_fmt_init(&fmt); … … 706 682 goto error; 707 683 708 pos.x = rect.p1.x ;684 pos.x = rect.p1.x - 1; 709 685 pos.y = rect.p0.y; 710 686 fmt.halign = gfx_halign_right; … … 729 705 goto error; 730 706 731 pos.x = rect.p1.x ;707 pos.x = rect.p1.x - 1; 732 708 pos.y = (rect.p0.y + rect.p1.y - 1) / 2; 733 709 fmt.halign = gfx_halign_right; … … 746 722 747 723 pos.x = (rect.p0.x + rect.p1.x - 1) / 2; 748 pos.y = rect.p1.y ;724 pos.y = rect.p1.y - 1; 749 725 fmt.halign = gfx_halign_center; 750 726 rc = gfx_puttext(font, &pos, &fmt, "Bottom center"); … … 752 728 goto error; 753 729 754 pos.x = rect.p1.x ;755 pos.y = rect.p1.y ;730 pos.x = rect.p1.x - 1; 731 pos.y = rect.p1.y - 1; 756 732 fmt.halign = gfx_halign_right; 757 733 rc = gfx_puttext(font, &pos, &fmt, "Bottom right"); … … 764 740 765 741 for (i = 0; i < 8; i++) { 766 if (demo_is_text(w, h)) { 767 rc = gfx_color_new_ega(i != 0 ? i : 0x10, &color); 768 if (rc != EOK) 769 goto error; 770 } else { 771 rc = gfx_color_new_rgb_i16((i & 4) ? 0xffff : 0, 772 (i & 2) ? 0xffff : 0, (i & 1) ? 0xffff : 0, &color); 773 if (rc != EOK) 774 goto error; 775 } 742 rc = gfx_color_new_rgb_i16((i & 4) ? 0xffff : 0, 743 (i & 2) ? 0xffff : 0, (i & 1) ? 0xffff : 0, &color); 744 if (rc != EOK) 745 goto error; 776 746 777 747 fmt.color = color; … … 1129 1099 errno_t rc; 1130 1100 const char *display_svc = DISPLAY_DEFAULT; 1131 const char *ui_display_spec = UI_DISPLAY_DEFAULT;1132 1101 int i; 1133 1102 … … 1142 1111 } 1143 1112 1144 display_svc = ui_display_spec =argv[i++];1113 display_svc = argv[i++]; 1145 1114 } else { 1146 1115 printf("Invalid option '%s'.\n", argv[i]); … … 1159 1128 return 1; 1160 1129 } else if (str_cmp(argv[i], "ui") == 0) { 1161 rc = demo_ui( ui_display_spec);1130 rc = demo_ui(display_svc); 1162 1131 if (rc != EOK) 1163 1132 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.