Fix 64 bit issue in slirp
[qemu/mini2440/sniper_sniper_test.git] / hw / g364fb_template.h
blob49796fa346f7a35c00332e53246e54d885ffbb3c
1 /*
2 * QEMU G364 framebuffer Emulator.
4 * Copyright (c) 2007 Hervé Poussineau
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.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update)
23 int i, j;
24 int w_display;
25 uint8_t *data_buffer;
26 uint8_t *data_display, *dd;
28 data_buffer = s->vram_buffer;
29 w_display = s->scr_width * PIXEL_WIDTH / 8;
30 data_display = ds_get_data(s->ds);
31 for(i = 0; i < s->scr_height; i++) {
32 dd = data_display;
33 for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
34 uint8_t index = *data_buffer;
35 *((glue(glue(uint, PIXEL_WIDTH), _t) *)dd) = glue(rgb_to_pixel, BPP)(
36 s->palette[index][0],
37 s->palette[index][1],
38 s->palette[index][2]);
40 data_display += ds_get_linesize(s->ds);