aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ui/qemu-pixman.h1
-rw-r--r--ui/qemu-pixman.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h
index 090a3e2e8f..80ed94a05f 100644
--- a/include/ui/qemu-pixman.h
+++ b/include/ui/qemu-pixman.h
@@ -34,6 +34,7 @@
/* -------------------------------------------------------------------- */
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);
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index bdc1439e09..5d8bd46ed2 100644
--- a/ui/qemu-pixman.c
+++ b/ui/qemu-pixman.c
@@ -62,6 +62,31 @@ PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format)
return pf;
}
+pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian)
+{
+ if (native_endian) {
+ switch (bpp) {
+ case 15:
+ return PIXMAN_x1r5g5b5;
+ case 16:
+ return PIXMAN_r5g6b5;
+ case 24:
+ return PIXMAN_r8g8b8;
+ case 32:
+ return PIXMAN_x8r8g8b8;
+ }
+ } else {
+ switch (bpp) {
+ case 24:
+ return PIXMAN_b8g8r8;
+ case 32:
+ return PIXMAN_b8g8r8a8;
+ break;
+ }
+ }
+ g_assert_not_reached();
+}
+
int qemu_pixman_get_type(int rshift, int gshift, int bshift)
{
int type = PIXMAN_TYPE_OTHER;