diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2014-06-18 11:31:42 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-09-05 13:27:11 +0200 |
commit | 1527a25ec90f34693fbe24c81c1107e78cead1d7 (patch) | |
tree | cf63ac594ad885624da86396efd8a5d54348a4a8 /ui/qemu-pixman.c | |
parent | a93a3af9ec44710b2f7de8eb1c36f93ee3ec0d10 (diff) | |
download | qemu-1527a25ec90f34693fbe24c81c1107e78cead1d7.zip qemu-1527a25ec90f34693fbe24c81c1107e78cead1d7.tar.gz qemu-1527a25ec90f34693fbe24c81c1107e78cead1d7.tar.bz2 |
console: add qemu_default_pixman_format
Function returning the default pixman format for a given depth.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/qemu-pixman.c')
-rw-r--r-- | ui/qemu-pixman.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index bdc1439..5d8bd46 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; |