While we are at it: How should surfaces_dest (and surfaces_rect) be
filled for spice 0.4 commands? Right now they are just zero-initialized
(see red_get_compat_drawable() in red_parse_qxl.c).

Best to fill surfaces_dest with -1. For consistency (though not
necessary right now), in QXL_COPY_BITS scenario, fill surfaces_dest[0]
with the drawable surface id, and surfaces_rect[0] with the rect of the
drawabele transformed to src_pos (i.e., starts at src_pos and its width
and hight are equal to the drawable destination).

Oh, and I've just seen self bitmaps are not handled yet.

spice 0.4 has:

uint16_t bitmap_offset;
QXLRect bitmap_area;

spice 0.6 has:

uint8_t self_bitmap;
QXLRect self_bitmap_area;

I suspect the area can just be used as-is. What about bitmap_offset /
self_bitmap?

if bitmap_offset != 0, it means self_bitmap = TRUE

Ok.  How does the attached patch look?  Fine or missed I something?

cheers,
  Gerd
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index e6e700b..e0eba20 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -820,6 +820,13 @@ void red_get_compat_drawable(RedMemSlotInfo *slots, int 
group_id,
     red->effect           = qxl->effect;
     red->mm_time          = qxl->mm_time;
 
+    red->self_bitmap = (qxl->bitmap_offset != 0);
+    red_get_rect_ptr(&red->self_bitmap_area, &qxl->bitmap_area);
+
+    red->surfaces_dest[0] = -1;
+    red->surfaces_dest[1] = -1;
+    red->surfaces_dest[2] = -1;
+
     red->type = qxl->type;
     switch (red->type) {
     case QXL_DRAW_ALPHA_BLEND:
@@ -837,6 +844,13 @@ void red_get_compat_drawable(RedMemSlotInfo *slots, int 
group_id,
         break;
     case QXL_COPY_BITS:
         red_get_point_ptr(&red->u.copy_bits.src_pos, 
&qxl->u.copy_bits.src_pos);
+        red->surfaces_dest[0] = 0;
+        red->surfaces_rects[0].left   = red->u.copy_bits.src_pos.x;
+        red->surfaces_rects[0].right  = red->u.copy_bits.src_pos.x +
+            (red->bbox.right - red->bbox.left);
+        red->surfaces_rects[0].top    = red->u.copy_bits.src_pos.y;
+        red->surfaces_rects[0].bottom = red->u.copy_bits.src_pos.y +
+            (red->bbox.bottom - red->bbox.top);
         break;
     case QXL_DRAW_FILL:
         red_get_fill_ptr(slots, group_id, &red->u.fill, &qxl->u.fill);
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to