From 7241cc9544de818eb07de7dd99d72f8451ed8038 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 12 Aug 2013 15:20:38 +0300 Subject: server: move surface_format_to_image_type to spice_bitmap_utils --- server/spice_bitmap_utils.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'server/spice_bitmap_utils.c') diff --git a/server/spice_bitmap_utils.c b/server/spice_bitmap_utils.c index 90446222..ce0a5ed0 100644 --- a/server/spice_bitmap_utils.c +++ b/server/spice_bitmap_utils.c @@ -5,6 +5,23 @@ #include "spice_bitmap_utils.h" +int spice_bitmap_from_surface_type(uint32_t surface_format) +{ + switch (surface_format) { + case SPICE_SURFACE_FMT_16_555: + return SPICE_BITMAP_FMT_16BIT; + case SPICE_SURFACE_FMT_32_xRGB: + return SPICE_BITMAP_FMT_32BIT; + case SPICE_SURFACE_FMT_32_ARGB: + return SPICE_BITMAP_FMT_RGBA; + case SPICE_SURFACE_FMT_8_A: + return SPICE_BITMAP_FMT_8BIT_A; + default: + spice_critical("Unsupported surface format"); + } + return 0; +} + #define RAM_PATH "/tmp/tmpfs" static void dump_palette(FILE *f, SpicePalette* plt) -- cgit