MCPcopy Create free account
hub / github.com/NetHack/NetHack / vesa_GetCharPixelRow

Function vesa_GetCharPixelRow

sys/msdos/vidvesa.c:1760–1804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1758}
1759
1760static unsigned char
1761vesa_GetCharPixelRow(uint32 ch, unsigned x, unsigned y)
1762{
1763 unsigned fnt_width;
1764 unsigned x1;
1765 unsigned char fnt;
1766 size_t offset;
1767
1768 if (x >= vesa_char_width) return 0;
1769 if (y >= vesa_char_height) return 0;
1770
1771 fnt_width = (vesa_char_width + 7) / 8;
1772 x1 = x / 8;
1773
1774 if (vesa_font != NULL) {
1775 const unsigned char *fp;
1776
1777 offset = y * fnt_width + x1;
1778 fp = get_font_glyph(vesa_font, ch, SYMHANDLING(H_UTF8));
1779 fnt = fp[offset];
1780 } else {
1781 const unsigned char __far *fp;
1782
1783 if (255 < ch) return 0;
1784 offset = (ch * vesa_char_height + y) * fnt_width + x1;
1785 fp = font;
1786 fnt = READ_ABSOLUTE((fp + offset));
1787
1788 if (vesa_char_width != 8) {
1789 unsigned long fnt2 = fnt;
1790 unsigned width = vesa_char_width;
1791 if (width % 3 == 0) {
1792 fnt2 = vesa_TriplePixels(fnt2);
1793 width /= 3;
1794 }
1795 while (width > 8) {
1796 fnt2 = vesa_DoublePixels(fnt2);
1797 width /= 2;
1798 }
1799 fnt2 <<= 32 - vesa_char_width;
1800 fnt = (unsigned char)(fnt2 >> (24 - 8 * x1));
1801 }
1802 }
1803 return fnt;
1804}
1805
1806/* Scale font pixels horizontally */
1807static unsigned long

Callers 2

vesa_WriteTextRowFunction · 0.85
vesa_GetCharPixelFunction · 0.85

Calls 3

get_font_glyphFunction · 0.85
vesa_TriplePixelsFunction · 0.85
vesa_DoublePixelsFunction · 0.85

Tested by

no test coverage detected