Skip to content

Commit

Permalink
pixman: drop obsolete fields from DisplaySurface
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
kraxel committed Nov 1, 2012
1 parent 9436268 commit 64f7359
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
9 changes: 0 additions & 9 deletions console.c
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
23 changes: 13 additions & 10 deletions console.h
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 64f7359

Please sign in to comment.