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);
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;
{
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);
#ifdef HOST_WORDS_BIGENDIAN
surface->flags = QEMU_BIG_ENDIAN_FLAG;
#endif
- surface->data = data;
return surface;
}
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;
};
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