Revision a8aa669b hw/vga_template.h

b/hw/vga_template.h
434 434
#endif
435 435
}
436 436

  
437
#if DEPTH != 15
438
void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1, 
439
                                        const uint8_t *src1, 
440
                                        int poffset, int w,
441
                                        unsigned int color0, 
442
                                        unsigned int color1,
443
                                        unsigned int color_xor)
444
{
445
    const uint8_t *plane0, *plane1;
446
    int x, b0, b1;
447
    uint8_t *d;
448

  
449
    d = d1;
450
    plane0 = src1;
451
    plane1 = src1 + poffset;
452
    for(x = 0; x < w; x++) {
453
        b0 = (plane0[x >> 3] >> (7 - (x & 7))) & 1;
454
        b1 = (plane1[x >> 3] >> (7 - (x & 7))) & 1;
455
#if DEPTH == 8
456
        switch(b0 | (b1 << 1)) {
457
        case 0:
458
            break;
459
        case 1:
460
            d[0] ^= color_xor;
461
            break;
462
        case 2:
463
            d[0] = color0;
464
            break;
465
        case 3:
466
            d[0] = color1;
467
            break;
468
        }
469
#elif DEPTH == 16
470
        switch(b0 | (b1 << 1)) {
471
        case 0:
472
            break;
473
        case 1:
474
            ((uint16_t *)d)[0] ^= color_xor;
475
            break;
476
        case 2:
477
            ((uint16_t *)d)[0] = color0;
478
            break;
479
        case 3:
480
            ((uint16_t *)d)[0] = color1;
481
            break;
482
        }
483
#elif DEPTH == 32
484
        switch(b0 | (b1 << 1)) {
485
        case 0:
486
            break;
487
        case 1:
488
            ((uint32_t *)d)[0] ^= color_xor;
489
            break;
490
        case 2:
491
            ((uint32_t *)d)[0] = color0;
492
            break;
493
        case 3:
494
            ((uint32_t *)d)[0] = color1;
495
            break;
496
        }
497
#else
498
#error unsupported depth
499
#endif
500
        d += (DEPTH / 8);
501
    }
502
}
503
#endif
504

  
437 505
#undef PUT_PIXEL2
438 506
#undef DEPTH
439 507
#undef BPP

Also available in: Unified diff