From patchwork Thu Apr 4 07:28:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 233655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CC58A2C00CA for ; Thu, 4 Apr 2013 18:31:45 +1100 (EST) Received: from localhost ([::1]:53805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNee7-0001y1-KL for incoming@patchwork.ozlabs.org; Thu, 04 Apr 2013 03:31:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNebl-0007J1-L3 for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNebf-0004ua-Od for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNebf-0004uI-Go for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:11 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r347TAGV007834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Apr 2013 03:29:11 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r347T9HY019591; Thu, 4 Apr 2013 03:29:09 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 458BC40E92; Thu, 4 Apr 2013 09:29:07 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 4 Apr 2013 09:28:51 +0200 Message-Id: <1365060546-24638-10-git-send-email-kraxel@redhat.com> In-Reply-To: <1365060546-24638-1-git-send-email-kraxel@redhat.com> References: <1365060546-24638-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 09/24] console: switch color_table_rgb to pixman_color_t X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- ui/console.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/ui/console.c b/ui/console.c index e2a4535..41005c1 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 = 0xffff } + +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)