| 495 | } |
| 496 | |
| 497 | static void |
| 498 | vesa_FillRect(unsigned left, unsigned top, unsigned width, |
| 499 | unsigned height, unsigned color) |
| 500 | { |
| 501 | unsigned p_row_size = width * vesa_pixel_bytes; |
| 502 | unsigned char *p_row = (unsigned char *) alloc(p_row_size); |
| 503 | unsigned long c32 = vesa_palette[color & 0xFF]; |
| 504 | unsigned long offset = top * (unsigned long)vesa_scan_line + left * vesa_pixel_bytes; |
| 505 | unsigned x, y; |
| 506 | |
| 507 | switch (vesa_pixel_bytes) { |
| 508 | case 1: |
| 509 | memset(p_row, color, p_row_size); |
| 510 | break; |
| 511 | |
| 512 | case 2: |
| 513 | for (x = 0; x < width; ++x) { |
| 514 | ((uint16_t *)p_row)[x] = c32; |
| 515 | } |
| 516 | break; |
| 517 | |
| 518 | case 3: |
| 519 | for (x = 0; x < width; ++x) { |
| 520 | p_row[3*x + 0] = c32 & 0xFF; |
| 521 | p_row[3*x + 1] = (c32 >> 8) & 0xFF; |
| 522 | p_row[3*x + 2] = c32 >> 16 ; |
| 523 | } |
| 524 | break; |
| 525 | |
| 526 | case 4: |
| 527 | for (x = 0; x < width; ++x) { |
| 528 | ((uint32_t *)p_row)[x] = c32; |
| 529 | } |
| 530 | break; |
| 531 | } |
| 532 | |
| 533 | for (y = 0; y < height; ++y) { |
| 534 | vesa_WritePixelRow(offset, p_row, p_row_size); |
| 535 | offset += vesa_scan_line; |
| 536 | } |
| 537 | |
| 538 | free(p_row); |
| 539 | } |
| 540 | |
| 541 | void |
| 542 | vesa_get_scr_size(void) |
no test coverage detected