Statistics
| Branch: | Revision:

root / hw / g364fb_template.h @ 221bb2d5

History | View | Annotate | Download (1.5 kB)

1
/*
2
 * QEMU G364 framebuffer Emulator.
3
 *
4
 * Copyright (c) 2007 Hervé Poussineau
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License as
8
 * published by the Free Software Foundation; either version 2 of
9
 * the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19
 * MA 02111-1307 USA
20
 */
21

    
22
static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update)
23
{
24
    int i, j;
25
    int w_display;
26
    uint8_t *data_buffer;
27
    uint8_t *data_display, *dd;
28

    
29
    data_buffer = s->vram_buffer;
30
    w_display = s->scr_width * PIXEL_WIDTH / 8;
31
    data_display = s->ds->data;
32
    for(i = 0; i < s->scr_height; i++) {
33
        dd = data_display;
34
        for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
35
            uint8_t index = *data_buffer;
36
            *((glue(glue(uint, PIXEL_WIDTH), _t) *)dd) = glue(rgb_to_pixel, BPP)(
37
                s->palette[index][0],
38
                s->palette[index][1],
39
                s->palette[index][2]);
40
        }
41
        data_display += s->ds->linesize;
42
    }
43
}