Revision 15342721 hw/vga.c

b/hw/vga.c
1418 1418
static void vga_draw_graphic(VGAState *s, int full_update)
1419 1419
{
1420 1420
    int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask;
1421
    int width, height, shift_control, line_offset, page0, page1, bwidth;
1421
    int width, height, shift_control, line_offset, page0, page1, bwidth, bits;
1422 1422
    int disp_width, multi_scan, multi_run;
1423 1423
    uint8_t *d;
1424 1424
    uint32_t v, addr1, addr;
......
1454 1454
        } else {
1455 1455
            v = VGA_DRAW_LINE4;
1456 1456
        }
1457
        bits = 4;
1457 1458
    } else if (shift_control == 1) {
1458 1459
        full_update |= update_palette16(s);
1459 1460
        if (s->sr[0x01] & 8) {
......
1462 1463
        } else {
1463 1464
            v = VGA_DRAW_LINE2;
1464 1465
        }
1466
        bits = 4;
1465 1467
    } else {
1466 1468
        switch(s->get_bpp(s)) {
1467 1469
        default:
1468 1470
        case 0:
1469 1471
            full_update |= update_palette256(s);
1470 1472
            v = VGA_DRAW_LINE8D2;
1473
            bits = 4;
1471 1474
            break;
1472 1475
        case 8:
1473 1476
            full_update |= update_palette256(s);
1474 1477
            v = VGA_DRAW_LINE8;
1478
            bits = 8;
1475 1479
            break;
1476 1480
        case 15:
1477 1481
            v = VGA_DRAW_LINE15;
1482
            bits = 16;
1478 1483
            break;
1479 1484
        case 16:
1480 1485
            v = VGA_DRAW_LINE16;
1486
            bits = 16;
1481 1487
            break;
1482 1488
        case 24:
1483 1489
            v = VGA_DRAW_LINE24;
1490
            bits = 24;
1484 1491
            break;
1485 1492
        case 32:
1486 1493
            v = VGA_DRAW_LINE32;
1494
            bits = 32;
1487 1495
            break;
1488 1496
        }
1489 1497
    }
......
1507 1515
           width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]);
1508 1516
#endif
1509 1517
    addr1 = (s->start_addr * 4);
1510
    bwidth = width * 4;
1518
    bwidth = (width * bits + 7) / 8;
1511 1519
    y_start = -1;
1512 1520
    page_min = 0x7fffffff;
1513 1521
    page_max = -1;

Also available in: Unified diff