summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-10-10 10:11:43 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-10-23 15:44:11 -0400
commit5af5154c14ee3beed537965b36481dfa97cd2491 (patch)
treed5764bd71492fa42ded3fa617606fe8b7b4f816a
parentcd4321560a8578d579516b3fdfdc45a4c28fd3ce (diff)
red_worker: rename FillBitsType to SpiceImageCompressType
Also minimize the enum to include only the required values.
-rw-r--r--server/red_worker.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 9685382..6a92357 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -6786,39 +6786,33 @@ static void spice_image_encode(DisplayChannelClient *dcc,
}
typedef enum {
- FILL_BITS_TYPE_INVALID,
- FILL_BITS_TYPE_CACHE,
- FILL_BITS_TYPE_SURFACE,
- FILL_BITS_TYPE_COMPRESS_LOSSLESS,
- FILL_BITS_TYPE_COMPRESS_LOSSY,
- FILL_BITS_TYPE_BITMAP,
-} FillBitsType;
+ SPICE_IMAGE_COMPRESS_TYPE_INVALID,
+ SPICE_IMAGE_COMPRESS_TYPE_NONE, // SURFACE, CACHE, BITMAP
+ SPICE_IMAGE_COMPRESS_TYPE_LOSSLESS,
+ SPICE_IMAGE_COMPRESS_TYPE_LOSSY,
+} SpiceImageCompressType;
-static FillBitsType spice_image_get_compress_type(SpiceImage *image)
+static SpiceImageCompressType spice_image_get_compress_type(SpiceImage *image)
{
- FillBitsType ret = FILL_BITS_TYPE_INVALID;
+ SpiceImageCompressType ret = SPICE_IMAGE_COMPRESS_TYPE_INVALID;
switch (image->descriptor.type) {
case SPICE_IMAGE_TYPE_BITMAP:
- ret = FILL_BITS_TYPE_BITMAP;
- break;
case SPICE_IMAGE_TYPE_SURFACE:
- ret = FILL_BITS_TYPE_SURFACE;
- break;
case SPICE_IMAGE_TYPE_FROM_CACHE:
case SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS:
- ret = FILL_BITS_TYPE_CACHE;
+ ret = SPICE_IMAGE_COMPRESS_TYPE_NONE;
break;
case SPICE_IMAGE_TYPE_JPEG:
case SPICE_IMAGE_TYPE_JPEG_ALPHA:
- ret = FILL_BITS_TYPE_COMPRESS_LOSSY;
+ ret = SPICE_IMAGE_COMPRESS_TYPE_LOSSY;
break;
case SPICE_IMAGE_TYPE_QUIC:
case SPICE_IMAGE_TYPE_GLZ_RGB:
case SPICE_IMAGE_TYPE_LZ_RGB:
case SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB:
case SPICE_IMAGE_TYPE_LZ_PLT:
- ret = FILL_BITS_TYPE_COMPRESS_LOSSLESS;
+ ret = SPICE_IMAGE_COMPRESS_TYPE_LOSSLESS;
break;
default:
spice_error("invalid image type %u", image->descriptor.type);
@@ -6829,7 +6823,7 @@ static FillBitsType spice_image_get_compress_type(SpiceImage *image)
/* if the number of times fill_bits can be called per one qxl_drawable increases -
MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
-static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
+static SpiceImageCompressType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
SpiceImage *src_image, Drawable *drawable, int can_lossy)
{
SpiceImage dst_image;
@@ -7366,7 +7360,7 @@ static void red_lossy_marshall_qxl_draw_fill(RedWorker *worker,
}
}
-static FillBitsType red_marshall_qxl_draw_opaque(RedWorker *worker,
+static SpiceImageCompressType red_marshall_qxl_draw_opaque(RedWorker *worker,
RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
DrawablePipeItem *dpi, int src_allowed_lossy)
@@ -7378,7 +7372,7 @@ static FillBitsType red_marshall_qxl_draw_opaque(RedWorker *worker,
SpiceMarshaller *src_bitmap_out;
SpiceMarshaller *mask_bitmap_out;
SpiceOpaque opaque;
- FillBitsType src_send_type;
+ SpiceImageCompressType src_send_type;
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE, &dpi->dpi_pipe_item);
fill_base(base_marshaller, item);
@@ -7433,13 +7427,13 @@ static void red_lossy_marshall_qxl_draw_opaque(RedWorker *worker,
if (!(brush_is_lossy && (brush_bitmap_data.type == BITMAP_DATA_TYPE_SURFACE)) &&
!(src_is_lossy && (src_bitmap_data.type == BITMAP_DATA_TYPE_SURFACE))) {
- FillBitsType src_send_type;
+ SpiceImageCompressType src_send_type;
int has_mask = !!drawable->u.opaque.mask.bitmap;
src_send_type = red_marshall_qxl_draw_opaque(worker, rcc, m, dpi, src_allowed_lossy);
- if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSY) {
+ if (src_send_type == SPICE_IMAGE_COMPRESS_TYPE_LOSSY) {
src_is_lossy = TRUE;
- } else if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSLESS) {
+ } else if (src_send_type == SPICE_IMAGE_COMPRESS_TYPE_LOSSLESS) {
src_is_lossy = FALSE;
}
@@ -7466,7 +7460,7 @@ static void red_lossy_marshall_qxl_draw_opaque(RedWorker *worker,
}
}
-static FillBitsType red_marshall_qxl_draw_copy(RedWorker *worker,
+static SpiceImageCompressType red_marshall_qxl_draw_copy(RedWorker *worker,
RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
DrawablePipeItem *dpi, int src_allowed_lossy)
@@ -7477,7 +7471,7 @@ static FillBitsType red_marshall_qxl_draw_copy(RedWorker *worker,
SpiceMarshaller *src_bitmap_out;
SpiceMarshaller *mask_bitmap_out;
SpiceCopy copy;
- FillBitsType src_send_type;
+ SpiceImageCompressType src_send_type;
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, &dpi->dpi_pipe_item);
fill_base(base_marshaller, item);
@@ -7504,15 +7498,15 @@ static void red_lossy_marshall_qxl_draw_copy(RedWorker *worker,
int has_mask = !!drawable->u.copy.mask.bitmap;
int src_is_lossy;
BitmapData src_bitmap_data;
- FillBitsType src_send_type;
+ SpiceImageCompressType src_send_type;
src_is_lossy = is_bitmap_lossy(rcc, drawable->u.copy.src_bitmap,
&drawable->u.copy.src_area, item, &src_bitmap_data);
src_send_type = red_marshall_qxl_draw_copy(worker, rcc, base_marshaller, dpi, TRUE);
- if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSY) {
+ if (src_send_type == SPICE_IMAGE_COMPRESS_TYPE_LOSSY) {
src_is_lossy = TRUE;
- } else if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSLESS) {
+ } else if (src_send_type == SPICE_IMAGE_COMPRESS_TYPE_LOSSLESS) {
src_is_lossy = FALSE;
}
surface_lossy_region_update(worker, dcc, item, has_mask,
@@ -7568,7 +7562,7 @@ static void red_lossy_marshall_qxl_draw_transparent(RedWorker *worker,
}
}
-static FillBitsType red_marshall_qxl_draw_alpha_blend(RedWorker *worker,
+static SpiceImageCompressType red_marshall_qxl_draw_alpha_blend(RedWorker *worker,
RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
DrawablePipeItem *dpi,
@@ -7579,7 +7573,7 @@ static FillBitsType red_marshall_qxl_draw_alpha_blend(RedWorker *worker,
RedDrawable *drawable = item->red_drawable;
SpiceMarshaller *src_bitmap_out;
SpiceAlphaBlend alpha_blend;
- FillBitsType src_send_type;
+ SpiceImageCompressType src_send_type;
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND,
&dpi->dpi_pipe_item);
@@ -7604,16 +7598,16 @@ static void red_lossy_marshall_qxl_draw_alpha_blend(RedWorker *worker,
RedDrawable *drawable = item->red_drawable;
int src_is_lossy;
BitmapData src_bitmap_data;
- FillBitsType src_send_type;
+ SpiceImageCompressType src_send_type;
src_is_lossy = is_bitmap_lossy(rcc, drawable->u.alpha_blend.src_bitmap,
&drawable->u.alpha_blend.src_area, item, &src_bitmap_data);
src_send_type = red_marshall_qxl_draw_alpha_blend(worker, rcc, base_marshaller, dpi, TRUE);
- if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSY) {
+ if (src_send_type == SPICE_IMAGE_COMPRESS_TYPE_LOSSY) {
src_is_lossy = TRUE;
- } else if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSLESS) {
+ } else if (src_send_type == SPICE_IMAGE_COMPRESS_TYPE_LOSSLESS) {
src_is_lossy = FALSE;
}