[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 3/8] ui/pixman: add qemu_pixman_check_format
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 3/8] ui/pixman: add qemu_pixman_check_format |
Date: |
Mon, 19 Jan 2015 13:55:04 +0100 |
Convinience check_format function for UIs using pixman.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
include/ui/qemu-pixman.h | 2 ++
ui/qemu-pixman.c | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
index 381969d..3dee576 100644
--- a/include/ui/qemu-pixman.h
+++ b/include/ui/qemu-pixman.h
@@ -37,6 +37,8 @@ PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t
format);
pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian);
int qemu_pixman_get_type(int rshift, int gshift, int bshift);
pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf);
+bool qemu_pixman_check_format(DisplayChangeListener *dcl,
+ pixman_format_code_t format);
pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
int width);
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index 6a889e9..4116e15 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)
{
--
1.8.3.1
- [Qemu-devel] [PULL 0/8] ui: add shared surface format negotiation., Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 8/8] ui/sdl2: Support shared surface for more pixman formats, Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 4/8] ui/vnc: Support shared surface for most pixman formats, Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 3/8] ui/pixman: add qemu_pixman_check_format,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 5/8] ui/spice: Support shared surface for most pixman formats, Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 2/8] ui: Add dpy_gfx_check_format() to check backend shared surface support, Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 6/8] ui/gtk: Support shared surface for most pixman formats, Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 1/8] ui: Make qemu_default_pixman_format() return 0 on unsupported formats, Gerd Hoffmann, 2015/01/19
- [Qemu-devel] [PULL 7/8] ui/sdl: Support shared surface for more pixman formats, Gerd Hoffmann, 2015/01/19
- Re: [Qemu-devel] [PULL 0/8] ui: add shared surface format negotiation., Peter Maydell, 2015/01/19