| 1654 | extern uint32 curframecolor; /* video.c */ |
| 1655 | |
| 1656 | static void |
| 1657 | vesa_WriteTextRow(int pixx, int pixy, struct VesaCharacter const *t_row, |
| 1658 | unsigned t_row_width) |
| 1659 | { |
| 1660 | int x, px, py; |
| 1661 | unsigned i; |
| 1662 | unsigned p_row_width = t_row_width * vesa_char_width * vesa_pixel_bytes; |
| 1663 | unsigned char *p_row = (unsigned char *) alloc(p_row_width); |
| 1664 | unsigned long offset = pixy * (unsigned long)vesa_scan_line + pixx * vesa_pixel_bytes; |
| 1665 | unsigned char fg[4], bg[4]; |
| 1666 | |
| 1667 | #if 0 |
| 1668 | /* Preprocess the background color */ |
| 1669 | if (vesa_pixel_bytes == 1) { |
| 1670 | bg[0] = BACKGROUND_VESA_COLOR; |
| 1671 | } else { |
| 1672 | unsigned long pix = vesa_palette[BACKGROUND_VESA_COLOR]; |
| 1673 | bg[0] = pix & 0xFF; |
| 1674 | bg[1] = (pix >> 8) & 0xFF; |
| 1675 | bg[2] = (pix >> 16) & 0xFF; |
| 1676 | bg[3] = (pix >> 24) & 0xFF; |
| 1677 | } |
| 1678 | #endif |
| 1679 | |
| 1680 | /* First loop: draw one raster line of all row entries */ |
| 1681 | for (py = 0; py < (int) vesa_char_height; ++py) { |
| 1682 | /* Second loop: draw one raster line of one character */ |
| 1683 | x = 0; |
| 1684 | for (i = 0; i < t_row_width; ++i) { |
| 1685 | uint32 chr = t_row[i].chr; |
| 1686 | uint32 colour = t_row[i].colour; |
| 1687 | |
| 1688 | /* background color */ |
| 1689 | if (vesa_pixel_bytes == 1) { |
| 1690 | bg[0] = BACKGROUND_VESA_COLOR; |
| 1691 | } else { |
| 1692 | unsigned long pix = vesa_palette[t_row[i].bgcolour]; |
| 1693 | bg[0] = pix & 0xFF; |
| 1694 | bg[1] = (pix >> 8) & 0xFF; |
| 1695 | bg[2] = (pix >> 16) & 0xFF; |
| 1696 | bg[3] = (pix >> 24) & 0xFF; |
| 1697 | } |
| 1698 | /* Preprocess the foreground color */ |
| 1699 | if (colour & 0x80000000) { |
| 1700 | fg[0] = colour & 0xFF; |
| 1701 | fg[1] = (colour >> 8) & 0xFF; |
| 1702 | fg[2] = (colour >> 16) & 0xFF; |
| 1703 | fg[3] = 0; |
| 1704 | } else if (vesa_pixel_bytes == 1) { |
| 1705 | fg[0] = colour + FIRST_TEXT_COLOR; |
| 1706 | } else { |
| 1707 | unsigned long pix = vesa_palette[colour + FIRST_TEXT_COLOR]; |
| 1708 | fg[0] = pix & 0xFF; |
| 1709 | fg[1] = (pix >> 8) & 0xFF; |
| 1710 | fg[2] = (pix >> 16) & 0xFF; |
| 1711 | fg[3] = (pix >> 24) & 0xFF; |
| 1712 | } |
| 1713 |
no test coverage detected