Statistics
| Branch: | Revision:

root / hw / g364fb_template.h @ e927bb00

History | View | Annotate | Download (1.5 kB)

1 1fc3d392 aurel32
/*
2 1fc3d392 aurel32
 * QEMU G364 framebuffer Emulator.
3 1fc3d392 aurel32
 *
4 1fc3d392 aurel32
 * Copyright (c) 2007 Hervé Poussineau
5 1fc3d392 aurel32
 *
6 1fc3d392 aurel32
 * This program is free software; you can redistribute it and/or
7 1fc3d392 aurel32
 * modify it under the terms of the GNU General Public License as
8 1fc3d392 aurel32
 * published by the Free Software Foundation; either version 2 of
9 1fc3d392 aurel32
 * the License, or (at your option) any later version.
10 1fc3d392 aurel32
 *
11 1fc3d392 aurel32
 * This program is distributed in the hope that it will be useful,
12 1fc3d392 aurel32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 1fc3d392 aurel32
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 1fc3d392 aurel32
 * GNU General Public License for more details.
15 1fc3d392 aurel32
 *
16 1fc3d392 aurel32
 * You should have received a copy of the GNU General Public License
17 1fc3d392 aurel32
 * along with this program; if not, write to the Free Software
18 1fc3d392 aurel32
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 1fc3d392 aurel32
 * MA 02111-1307 USA
20 1fc3d392 aurel32
 */
21 1fc3d392 aurel32
22 1fc3d392 aurel32
static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update)
23 1fc3d392 aurel32
{
24 1fc3d392 aurel32
    int i, j;
25 1fc3d392 aurel32
    int w_display;
26 1fc3d392 aurel32
    uint8_t *data_buffer;
27 1fc3d392 aurel32
    uint8_t *data_display, *dd;
28 1fc3d392 aurel32
29 1fc3d392 aurel32
    data_buffer = s->vram_buffer;
30 1fc3d392 aurel32
    w_display = s->last_scr_width * PIXEL_WIDTH / 8;
31 1fc3d392 aurel32
    data_display = s->ds->data;
32 1fc3d392 aurel32
    for(i = 0; i < s->last_scr_height; i++) {
33 1fc3d392 aurel32
        dd = data_display;
34 1fc3d392 aurel32
        for (j = 0; j < s->last_scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
35 1fc3d392 aurel32
            uint8_t index = *data_buffer;
36 1fc3d392 aurel32
            *((glue(glue(uint, PIXEL_WIDTH), _t) *)dd) = glue(rgb_to_pixel, BPP)(
37 1fc3d392 aurel32
                s->palette[index][0],
38 1fc3d392 aurel32
                s->palette[index][1],
39 1fc3d392 aurel32
                s->palette[index][2]);
40 1fc3d392 aurel32
        }
41 1fc3d392 aurel32
        data_display += s->ds->linesize;
42 1fc3d392 aurel32
    }
43 1fc3d392 aurel32
}