All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 14/14] pixman: drop obsolete fields from DisplaySurface
Date: Wed, 17 Oct 2012 15:29:14 +0200	[thread overview]
Message-ID: <1350480554-23281-15-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1350480554-23281-1-git-send-email-kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 console.c |    9 ---------
 console.h |   23 +++++++++++++----------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/console.c b/console.c
index d28b75e..048b48e 100644
--- a/console.c
+++ b/console.c
@@ -1297,14 +1297,10 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type)
 static void qemu_alloc_display(DisplaySurface *surface, int width, int height,
                                int linesize, PixelFormat pf, int newflags)
 {
-    surface->width = width;
-    surface->height = height;
-    surface->linesize = linesize;
     surface->pf = pf;
 
     qemu_pixman_image_unref(surface->image);
     surface->image = NULL;
-    surface->data = NULL;
 
     surface->format = qemu_pixman_get_format(&pf);
     assert(surface->format != 0);
@@ -1313,7 +1309,6 @@ static void qemu_alloc_display(DisplaySurface *surface, int width, int height,
                                               NULL, linesize);
     assert(surface->image != NULL);
 
-    surface->data = (uint8_t *)pixman_image_get_data(surface->image);
     surface->flags = newflags | QEMU_ALLOCATED_FLAG;
 #ifdef HOST_WORDS_BIGENDIAN
     surface->flags |= QEMU_BIG_ENDIAN_FLAG;
@@ -1347,9 +1342,6 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp,
 {
     DisplaySurface *surface = g_new0(DisplaySurface, 1);
 
-    surface->width = width;
-    surface->height = height;
-    surface->linesize = linesize;
     surface->pf = qemu_default_pixelformat(bpp);
 
     surface->format = qemu_pixman_get_format(&surface->pf);
@@ -1362,7 +1354,6 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp,
 #ifdef HOST_WORDS_BIGENDIAN
     surface->flags = QEMU_BIG_ENDIAN_FLAG;
 #endif
-    surface->data = data;
 
     return surface;
 }
diff --git a/console.h b/console.h
index 96ef165..f66fbfc 100644
--- a/console.h
+++ b/console.h
@@ -123,10 +123,6 @@ struct DisplaySurface {
     pixman_format_code_t format;
     pixman_image_t *image;
     uint8_t flags;
-    int width;
-    int height;
-    int linesize;        /* bytes per line */
-    uint8_t *data;
 
     struct PixelFormat pf;
 };
@@ -346,32 +342,39 @@ static inline bool dpy_cursor_define_supported(struct DisplayState *s)
 
 static inline int ds_get_linesize(DisplayState *ds)
 {
-    return ds->surface->linesize;
+    return pixman_image_get_stride(ds->surface->image);
 }
 
 static inline uint8_t* ds_get_data(DisplayState *ds)
 {
-    return ds->surface->data;
+    return (void *)pixman_image_get_data(ds->surface->image);
 }
 
 static inline int ds_get_width(DisplayState *ds)
 {
-    return ds->surface->width;
+    return pixman_image_get_width(ds->surface->image);
 }
 
 static inline int ds_get_height(DisplayState *ds)
 {
-    return ds->surface->height;
+    return pixman_image_get_height(ds->surface->image);
 }
 
 static inline int ds_get_bits_per_pixel(DisplayState *ds)
 {
-    return ds->surface->pf.bits_per_pixel;
+    int bits = PIXMAN_FORMAT_BPP(ds->surface->format);
+    return bits;
 }
 
 static inline int ds_get_bytes_per_pixel(DisplayState *ds)
 {
-    return ds->surface->pf.bytes_per_pixel;
+    int bits = PIXMAN_FORMAT_BPP(ds->surface->format);
+    return (bits + 7) / 8;
+}
+
+static inline pixman_format_code_t ds_get_format(DisplayState *ds)
+{
+    return ds->surface->format;
 }
 
 #ifdef CONFIG_CURSES
-- 
1.7.1

      parent reply	other threads:[~2012-10-17 13:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 13:29 [Qemu-devel] [PATCH 00/14] pixman patch series Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 01/14] console: remove DisplayAllocator Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 02/14] pixman: add submodule Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 03/14] pixman: windup in configure & makefiles Gerd Hoffmann
2012-10-17 14:26   ` Paolo Bonzini
2012-11-22 12:34   ` Stefano Stabellini
2012-11-22 12:59     ` Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 04/14] pixman: helper functions Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 05/14] pixman: add pixman image to DisplaySurface Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 06/14] console: make qemu_alloc_display static Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 07/14] console: don't set PixelFormat alpha fields for 32bpp Gerd Hoffmann
2012-10-19 17:02   ` Stefano Stabellini
2012-10-22  5:26     ` Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 08/14] qxl: stop direct access to DisplaySurface fields Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 09/14] vga: " Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 10/14] pixman: switch screendump function Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 11/14] pixman/vnc: use pixman images in vnc Gerd Hoffmann
2012-10-19 18:04   ` Stefano Stabellini
2012-10-22  5:40     ` Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 12/14] pixman/vnc: remove rgb_prepare_row* functions Gerd Hoffmann
2012-10-17 13:29 ` [Qemu-devel] [PATCH 13/14] pixman/vnc: remove dead code Gerd Hoffmann
2012-10-17 13:29 ` Gerd Hoffmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350480554-23281-15-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.