Changes in uspace/app/gfxdemo/gfxdemo.c [400a16d:da15002] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r400a16d 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;
Note:
See TracChangeset
for help on using the changeset viewer.