summaryrefslogtreecommitdiff
path: root/ui/qemu-pixman.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2015-01-09 08:49:20 +0100
committerGerd Hoffmann <kraxel@redhat.com>2015-01-19 13:33:26 +0100
commit8cd996f493d4fc10844bd13bde4b9c9c5e38cc3a (patch)
tree54e181b01d65abf7657b8d253e8142438404e5ca /ui/qemu-pixman.c
parent49743df399ca1029f4e22b52e9238d8e25c26bb2 (diff)
downloadqemu-8cd996f493d4fc10844bd13bde4b9c9c5e38cc3a.tar.gz
ui/pixman: add qemu_pixman_check_format
Convinience check_format function for UIs using pixman. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/qemu-pixman.c')
-rw-r--r--ui/qemu-pixman.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index 6a889e93e7..4116e1507b 100644
--- a/ui/qemu-pixman.c
+++ b/ui/qemu-pixman.c
@@ -125,6 +125,33 @@ pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf)
return format;
}
+/*
+ * Return true for known-good pixman conversions.
+ *
+ * UIs using pixman for format conversion can hook this into
+ * DisplayChangeListenerOps->dpy_gfx_check_format
+ */
+bool qemu_pixman_check_format(DisplayChangeListener *dcl,
+ pixman_format_code_t format)
+{
+ switch (format) {
+ /* 32 bpp */
+ case PIXMAN_x8r8g8b8:
+ case PIXMAN_a8r8g8b8:
+ case PIXMAN_b8g8r8x8:
+ case PIXMAN_b8g8r8a8:
+ /* 24 bpp */
+ case PIXMAN_r8g8b8:
+ case PIXMAN_b8g8r8:
+ /* 16 bpp */
+ case PIXMAN_x1r5g5b5:
+ case PIXMAN_r5g6b5:
+ return true;
+ default:
+ return false;
+ }
+}
+
pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
int width)
{