hw/display/tc6393xb: Expand out macros in template header
[qemu/ar7.git] / hw / display / tc6393xb_template.h
blob7789ffc4399faf485fe2bbe2ac40d3d270df3154
1 /*
2 * Toshiba TC6393XB I/O Controller.
3 * Found in Sharp Zaurus SL-6000 (tosa) or some
4 * Toshiba e-Series PDAs.
6 * FB support code. Based on G364 fb emulator
8 * Copyright (c) 2007 Hervé Poussineau
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, see <http://www.gnu.org/licenses/>.
24 static void tc6393xb_draw_graphic32(TC6393xbState *s)
26 DisplaySurface *surface = qemu_console_surface(s->con);
27 int i;
28 uint16_t *data_buffer;
29 uint8_t *data_display;
31 data_buffer = s->vram_ptr;
32 data_display = surface_data(surface);
33 for(i = 0; i < s->scr_height; i++) {
34 int j;
35 for (j = 0; j < s->scr_width; j++, data_display += 4, data_buffer++) {
36 uint16_t color = *data_buffer;
37 uint32_t dest_color = rgb_to_pixel32(
38 ((color & 0xf800) * 0x108) >> 11,
39 ((color & 0x7e0) * 0x41) >> 9,
40 ((color & 0x1f) * 0x21) >> 2
42 *(uint32_t *)data_display = dest_color;