aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-02-28 15:24:14 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-03-18 10:21:58 +0100
commit626e3b34e30bc62d4f25f7aa4e23a346eba1a2c0 (patch)
treeaa9a9c5e75e9ef934a4fe297dc31347bf3b49775 /include
parentc12aeb860c63ba83190f962e2f0a1c5fe18ad3a6 (diff)
console: add surface_*() getters
Add convinence wrappers to query DisplaySurface properties. Simliar to ds_get_*, but operating in the DisplaySurface not the DisplayState. With this patch in place ui frontents can stop using DisplayState in the rendering code paths, they can simply operate using the DisplaySurface passed in via dpy_gfx_switch callback. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/ui/console.h46
1 files changed, 38 insertions, 8 deletions
diff --git a/include/ui/console.h b/include/ui/console.h
index c8f0050cd6..a35b71aba2 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -244,36 +244,66 @@ void dpy_mouse_set(struct DisplayState *s, int x, int y, int on);
void dpy_cursor_define(struct DisplayState *s, QEMUCursor *cursor);
bool dpy_cursor_define_supported(struct DisplayState *s);
+static inline int surface_stride(DisplaySurface *s)
+{
+ return pixman_image_get_stride(s->image);
+}
+
+static inline void *surface_data(DisplaySurface *s)
+{
+ return pixman_image_get_data(s->image);
+}
+
+static inline int surface_width(DisplaySurface *s)
+{
+ return pixman_image_get_width(s->image);
+}
+
+static inline int surface_height(DisplaySurface *s)
+{
+ return pixman_image_get_height(s->image);
+}
+
+static inline int surface_bits_per_pixel(DisplaySurface *s)
+{
+ int bits = PIXMAN_FORMAT_BPP(s->format);
+ return bits;
+}
+
+static inline int surface_bytes_per_pixel(DisplaySurface *s)
+{
+ int bits = PIXMAN_FORMAT_BPP(s->format);
+ return (bits + 7) / 8;
+}
+
static inline int ds_get_linesize(DisplayState *ds)
{
- return pixman_image_get_stride(ds->surface->image);
+ return surface_stride(ds->surface);
}
static inline uint8_t* ds_get_data(DisplayState *ds)
{
- return (void *)pixman_image_get_data(ds->surface->image);
+ return surface_data(ds->surface);
}
static inline int ds_get_width(DisplayState *ds)
{
- return pixman_image_get_width(ds->surface->image);
+ return surface_width(ds->surface);
}
static inline int ds_get_height(DisplayState *ds)
{
- return pixman_image_get_height(ds->surface->image);
+ return surface_height(ds->surface);
}
static inline int ds_get_bits_per_pixel(DisplayState *ds)
{
- int bits = PIXMAN_FORMAT_BPP(ds->surface->format);
- return bits;
+ return surface_bits_per_pixel(ds->surface);
}
static inline int ds_get_bytes_per_pixel(DisplayState *ds)
{
- int bits = PIXMAN_FORMAT_BPP(ds->surface->format);
- return (bits + 7) / 8;
+ return surface_bytes_per_pixel(ds->surface);
}
static inline pixman_format_code_t ds_get_format(DisplayState *ds)