Changeset 8a9a41e in mainline for uspace/app/gfxdemo/gfxdemo.c
- Timestamp:
- 2021-10-24T08:28:43Z (4 years ago)
- Children:
- 9ea3a41
- Parents:
- 2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
- git-committer:
- GitHub <noreply@…> (2021-10-24 08:28:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 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 width 78 * @param h Screen height 79 * @return @c true iff we are running in text mode 80 */ 81 static bool demo_is_text(gfx_coord_t w, gfx_coord_t h) 82 { 83 // XXX Need a proper way to determine text mode 84 return w <= 80; 85 } 86 75 87 /** Clear screen. 76 88 * … … 215 227 216 228 if (font != NULL) { 217 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); 218 if (rc != EOK) 219 goto error; 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 } 220 238 221 239 gfx_text_fmt_init(&fmt); … … 660 678 gfx_color_delete(color); 661 679 662 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color); 663 if (rc != EOK) 664 goto error; 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 } 665 689 666 690 gfx_text_fmt_init(&fmt); … … 682 706 goto error; 683 707 684 pos.x = rect.p1.x - 1;708 pos.x = rect.p1.x; 685 709 pos.y = rect.p0.y; 686 710 fmt.halign = gfx_halign_right; … … 705 729 goto error; 706 730 707 pos.x = rect.p1.x - 1;731 pos.x = rect.p1.x; 708 732 pos.y = (rect.p0.y + rect.p1.y - 1) / 2; 709 733 fmt.halign = gfx_halign_right; … … 722 746 723 747 pos.x = (rect.p0.x + rect.p1.x - 1) / 2; 724 pos.y = rect.p1.y - 1;748 pos.y = rect.p1.y; 725 749 fmt.halign = gfx_halign_center; 726 750 rc = gfx_puttext(font, &pos, &fmt, "Bottom center"); … … 728 752 goto error; 729 753 730 pos.x = rect.p1.x - 1;731 pos.y = rect.p1.y - 1;754 pos.x = rect.p1.x; 755 pos.y = rect.p1.y; 732 756 fmt.halign = gfx_halign_right; 733 757 rc = gfx_puttext(font, &pos, &fmt, "Bottom right"); … … 740 764 741 765 for (i = 0; i < 8; i++) { 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; 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 } 746 776 747 777 fmt.color = color;
Note:
See TracChangeset
for help on using the changeset viewer.