diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-10-03 12:09:00 -0400 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2013-10-10 13:52:06 -0400 |
commit | 0f94ff3dba6cff515a1b91bd1d705651705d8f3d (patch) | |
tree | d8b45ae7729401cc3c1b6dcb20e5f24cb051dcd5 | |
parent | 0ff2d4b969729b0a2d8e4d69a188a0d2c7a1c81b (diff) |
red_worker: use bitmap cropping option for drawables that contain a src-bitmapbitmap-crop.v2
-rw-r--r-- | server/red_worker.c | 123 |
1 files changed, 95 insertions, 28 deletions
diff --git a/server/red_worker.c b/server/red_worker.c index 28ed7f4..50dcfb2 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -7527,9 +7527,10 @@ static void red_lossy_marshall_qxl_draw_fill(RedWorker *worker, } static SpiceImageCompressType red_marshall_qxl_draw_opaque(RedWorker *worker, - RedChannelClient *rcc, - SpiceMarshaller *base_marshaller, - DrawablePipeItem *dpi, int src_allowed_lossy) + RedChannelClient *rcc, + SpiceMarshaller *base_marshaller, + DrawablePipeItem *dpi, + int src_allowed_lossy) { Drawable *item = dpi->drawable; DisplayChannelClient *dcc = RCC_TO_DCC(rcc); @@ -7539,18 +7540,29 @@ static SpiceImageCompressType red_marshall_qxl_draw_opaque(RedWorker *worker, SpiceMarshaller *mask_bitmap_out; SpiceOpaque opaque; SpiceImageCompressType src_send_type; + SpiceImage enc_src_bitmap; + int crop_src_bitmap = TRUE; red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE, &dpi->dpi_pipe_item); fill_base(base_marshaller, item); opaque = drawable->u.opaque; + + encode_spice_image(dcc, + opaque.src_bitmap, + item, + &enc_src_bitmap, + src_allowed_lossy, + &crop_src_bitmap, + &opaque.src_area); + + src_send_type = spice_image_get_compress_type(&enc_src_bitmap); spice_marshall_Opaque(base_marshaller, &opaque, &src_bitmap_out, &brush_pat_out, &mask_bitmap_out); - src_send_type = fill_bits(dcc, src_bitmap_out, opaque.src_bitmap, item, - src_allowed_lossy); + spice_image_marshall(&enc_src_bitmap, src_bitmap_out, TRUE); if (brush_pat_out) { fill_bits(dcc, brush_pat_out, opaque.brush.u.pattern.pat, item, FALSE); @@ -7627,9 +7639,10 @@ static void red_lossy_marshall_qxl_draw_opaque(RedWorker *worker, } static SpiceImageCompressType red_marshall_qxl_draw_copy(RedWorker *worker, - RedChannelClient *rcc, - SpiceMarshaller *base_marshaller, - DrawablePipeItem *dpi, int src_allowed_lossy) + RedChannelClient *rcc, + SpiceMarshaller *base_marshaller, + DrawablePipeItem *dpi, + int src_allowed_lossy) { Drawable *item = dpi->drawable; RedDrawable *drawable = item->red_drawable; @@ -7638,16 +7651,28 @@ static SpiceImageCompressType red_marshall_qxl_draw_copy(RedWorker *worker, SpiceMarshaller *mask_bitmap_out; SpiceCopy copy; SpiceImageCompressType src_send_type; + SpiceImage enc_src_bitmap; + int crop_src_bitmap = TRUE; red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, &dpi->dpi_pipe_item); fill_base(base_marshaller, item); copy = drawable->u.copy; + + encode_spice_image(dcc, + copy.src_bitmap, + item, + &enc_src_bitmap, + src_allowed_lossy, + &crop_src_bitmap, + ©.src_area); + + src_send_type = spice_image_get_compress_type(&enc_src_bitmap); spice_marshall_Copy(base_marshaller, ©, &src_bitmap_out, &mask_bitmap_out); - src_send_type = fill_bits(dcc, src_bitmap_out, copy.src_bitmap, item, src_allowed_lossy); + spice_image_marshall(&enc_src_bitmap, src_bitmap_out, TRUE); fill_mask(rcc, mask_bitmap_out, copy.mask.bitmap, item); return src_send_type; @@ -7680,24 +7705,34 @@ static void red_lossy_marshall_qxl_draw_copy(RedWorker *worker, } static void red_marshall_qxl_draw_transparent(RedWorker *worker, - RedChannelClient *rcc, - SpiceMarshaller *base_marshaller, - DrawablePipeItem *dpi) + RedChannelClient *rcc, + SpiceMarshaller *base_marshaller, + DrawablePipeItem *dpi) { Drawable *item = dpi->drawable; DisplayChannelClient *dcc = RCC_TO_DCC(rcc); RedDrawable *drawable = item->red_drawable; SpiceMarshaller *src_bitmap_out; SpiceTransparent transparent; + SpiceImage enc_src_bitmap; + int crop_src_bitmap = TRUE; red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, &dpi->dpi_pipe_item); fill_base(base_marshaller, item); transparent = drawable->u.transparent; + encode_spice_image(dcc, + transparent.src_bitmap, + item, + &enc_src_bitmap, + FALSE, + &crop_src_bitmap, + &transparent.src_area); + spice_marshall_Transparent(base_marshaller, &transparent, &src_bitmap_out); - fill_bits(dcc, src_bitmap_out, transparent.src_bitmap, item, FALSE); + spice_image_marshall(&enc_src_bitmap, src_bitmap_out, TRUE); } static void red_lossy_marshall_qxl_draw_transparent(RedWorker *worker, @@ -7729,10 +7764,10 @@ static void red_lossy_marshall_qxl_draw_transparent(RedWorker *worker, } static SpiceImageCompressType red_marshall_qxl_draw_alpha_blend(RedWorker *worker, - RedChannelClient *rcc, - SpiceMarshaller *base_marshaller, - DrawablePipeItem *dpi, - int src_allowed_lossy) + RedChannelClient *rcc, + SpiceMarshaller *base_marshaller, + DrawablePipeItem *dpi, + int src_allowed_lossy) { Drawable *item = dpi->drawable; DisplayChannelClient *dcc = RCC_TO_DCC(rcc); @@ -7740,16 +7775,27 @@ static SpiceImageCompressType red_marshall_qxl_draw_alpha_blend(RedWorker *worke SpiceMarshaller *src_bitmap_out; SpiceAlphaBlend alpha_blend; SpiceImageCompressType src_send_type; + SpiceImage enc_src_bitmap; + int crop_src_bitmap = TRUE; red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, &dpi->dpi_pipe_item); fill_base(base_marshaller, item); alpha_blend = drawable->u.alpha_blend; + encode_spice_image(dcc, + alpha_blend.src_bitmap, + item, + &enc_src_bitmap, + src_allowed_lossy, + &crop_src_bitmap, + &alpha_blend.src_area); + + src_send_type = spice_image_get_compress_type(&enc_src_bitmap); + spice_marshall_AlphaBlend(base_marshaller, &alpha_blend, &src_bitmap_out); - src_send_type = fill_bits(dcc, src_bitmap_out, alpha_blend.src_bitmap, item, - src_allowed_lossy); + spice_image_marshall(&enc_src_bitmap, src_bitmap_out, TRUE); return src_send_type; } @@ -7830,9 +7876,9 @@ static void red_lossy_marshall_qxl_copy_bits(RedWorker *worker, } static void red_marshall_qxl_draw_blend(RedWorker *worker, - RedChannelClient *rcc, - SpiceMarshaller *base_marshaller, - DrawablePipeItem *dpi) + RedChannelClient *rcc, + SpiceMarshaller *base_marshaller, + DrawablePipeItem *dpi) { Drawable *item = dpi->drawable; DisplayChannelClient *dcc = RCC_TO_DCC(rcc); @@ -7840,16 +7886,26 @@ static void red_marshall_qxl_draw_blend(RedWorker *worker, SpiceMarshaller *src_bitmap_out; SpiceMarshaller *mask_bitmap_out; SpiceBlend blend; + SpiceImage enc_src_bitmap; + int crop_src_bitmap = TRUE; red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND, &dpi->dpi_pipe_item); fill_base(base_marshaller, item); blend = drawable->u.blend; + encode_spice_image(dcc, + blend.src_bitmap, + item, + &enc_src_bitmap, + FALSE, + &crop_src_bitmap, + &blend.src_area); + spice_marshall_Blend(base_marshaller, &blend, &src_bitmap_out, &mask_bitmap_out); - fill_bits(dcc, src_bitmap_out, blend.src_bitmap, item, FALSE); + spice_image_marshall(&enc_src_bitmap, src_bitmap_out, TRUE); fill_mask(rcc, mask_bitmap_out, blend.mask.bitmap, item); } @@ -7998,9 +8054,9 @@ static void red_lossy_marshall_qxl_draw_inverse(RedWorker *worker, } static void red_marshall_qxl_draw_rop3(RedWorker *worker, - RedChannelClient *rcc, - SpiceMarshaller *base_marshaller, - DrawablePipeItem *dpi) + RedChannelClient *rcc, + SpiceMarshaller *base_marshaller, + DrawablePipeItem *dpi) { Drawable *item = dpi->drawable; DisplayChannelClient *dcc = RCC_TO_DCC(rcc); @@ -8009,17 +8065,27 @@ static void red_marshall_qxl_draw_rop3(RedWorker *worker, SpiceMarshaller *src_bitmap_out; SpiceMarshaller *brush_pat_out; SpiceMarshaller *mask_bitmap_out; + SpiceImage enc_src_bitmap; + int crop_src_bitmap = TRUE; red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3, &dpi->dpi_pipe_item); fill_base(base_marshaller, item); rop3 = drawable->u.rop3; + encode_spice_image(dcc, + rop3.src_bitmap, + item, + &enc_src_bitmap, + FALSE, + &crop_src_bitmap, + &rop3.src_area); + spice_marshall_Rop3(base_marshaller, &rop3, &src_bitmap_out, &brush_pat_out, &mask_bitmap_out); - fill_bits(dcc, src_bitmap_out, rop3.src_bitmap, item, FALSE); + spice_image_marshall(&enc_src_bitmap, src_bitmap_out, TRUE); if (brush_pat_out) { fill_bits(dcc, brush_pat_out, rop3.brush.u.pattern.pat, item, FALSE); @@ -8083,6 +8149,7 @@ static void red_lossy_marshall_qxl_draw_rop3(RedWorker *worker, } } +// todo: support crop? static void red_marshall_qxl_draw_composite(RedWorker *worker, RedChannelClient *rcc, SpiceMarshaller *base_marshaller, @@ -9081,7 +9148,7 @@ static void red_display_marshall_upgrade(RedChannelClient *rcc, SpiceMarshaller spice_marshall_msg_display_draw_copy(m, ©, &src_bitmap_out, &mask_bitmap_out); - +// todo: support crop? fill_bits(dcc, src_bitmap_out, copy.data.src_bitmap, item->drawable, FALSE); } |