[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/15] console: switch color_table_rgb to pixman_col
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 05/15] console: switch color_table_rgb to pixman_color_t |
Date: |
Mon, 18 Mar 2013 13:09:32 +0100 |
Now that all text console rendering uses pixman we can easily
switch the color tables to use pixman_color_t directly.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/console.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 4e79268..fbec6cb 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -32,9 +32,6 @@
#define MAX_CONSOLES 12
#define CONSOLE_CURSOR_PERIOD 500
-#define QEMU_RGBA(r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-#define QEMU_RGB(r, g, b) QEMU_RGBA(r, g, b, 0xff)
-
typedef struct TextAttributes {
uint8_t fgcol:4;
uint8_t bgcol:4;
@@ -210,17 +207,15 @@ void vga_hw_text_update(console_ch_t *chardata)
static void vga_fill_rect(QemuConsole *con,
int posx, int posy, int width, int height,
- uint32_t color)
+ pixman_color_t color)
{
DisplaySurface *surface = qemu_console_surface(con);
pixman_rectangle16_t rect = {
.x = posx, .y = posy, .width = width, .height = height
};
- pixman_color_t pcolor;
- pcolor = qemu_pixman_color(&surface->pf, color);
pixman_image_fill_rectangles(PIXMAN_OP_SRC, surface->image,
- &pcolor, 1, &rect);
+ &color, 1, &rect);
}
/* copy from (xs, ys) to (xd, yd) a rectangle of size (w, h) */
@@ -255,7 +250,10 @@ enum color_names {
};
#endif
-static const uint32_t color_table_rgb[2][8] = {
+#define QEMU_RGB(r, g, b) \
+ { .red = r << 8, .green = g << 8, .blue = b << 8, .alpha = 0 }
+
+static const pixman_color_t color_table_rgb[2][8] = {
{ /* dark */
QEMU_RGB(0x00, 0x00, 0x00), /* black */
QEMU_RGB(0xaa, 0x00, 0x00), /* red */
@@ -316,9 +314,7 @@ static void vga_putcharxy(QemuConsole *s, int x, int y, int
ch,
{
static pixman_image_t *glyphs[256];
DisplaySurface *surface = qemu_console_surface(s);
- unsigned int fgcol, bgcol;
- pixman_image_t *ifg, *ibg;
- pixman_color_t cfg, cbg;
+ pixman_color_t fgcol, bgcol;
if (t_attrib->invers) {
bgcol = color_table_rgb[t_attrib->bold][t_attrib->fgcol];
@@ -327,16 +323,12 @@ static void vga_putcharxy(QemuConsole *s, int x, int y,
int ch,
fgcol = color_table_rgb[t_attrib->bold][t_attrib->fgcol];
bgcol = color_table_rgb[t_attrib->bold][t_attrib->bgcol];
}
- cfg = qemu_pixman_color(&surface->pf, fgcol);
- cbg = qemu_pixman_color(&surface->pf, bgcol);
- ifg = pixman_image_create_solid_fill(&cfg);
- ibg = pixman_image_create_solid_fill(&cbg);
if (!glyphs[ch]) {
glyphs[ch] = qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16,
ch);
}
qemu_pixman_glyph_render(glyphs[ch], surface->image,
- &cfg, &cbg, x, y, FONT_WIDTH, FONT_HEIGHT);
+ &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT);
}
static void text_console_resize(QemuConsole *s)
--
1.7.9.7
- [Qemu-devel] [PATCH 00/15] console: overhaul continued., Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 07/15] console: displaystate init revamp, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 04/15] console: use pixman for font rendering, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 12/15] console: move gui_update+gui_setup_refresh from vl.c into console.c, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 11/15] console: zap g_width + g_height, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 03/15] console: use pixman for fill+blit, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 09/15] console: give each QemuConsole its own DisplaySurface, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 06/15] console: add trace events, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 02/15] pixman: render vgafont glyphs into pixman images, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 13/15] console: make DisplayState private to console.c, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 05/15] console: switch color_table_rgb to pixman_color_t,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 15/15] console: gui timer fixes, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 08/15] console: rename vga_hw_*, add QemuConsole param, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 01/15] pixman: add qemu_pixman_color(), Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 10/15] console: simplify screendump, Gerd Hoffmann, 2013/03/18
- [Qemu-devel] [PATCH 14/15] console: add GraphicHwOps, Gerd Hoffmann, 2013/03/18