summaryrefslogtreecommitdiff
path: root/common/gl_canvas.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-06-29 21:42:59 +0200
committerGerd Hoffmann <kraxel@redhat.com>2010-06-30 22:35:17 +0200
commita24a8ff72ae40432f2ffe246f973057e38b042b0 (patch)
tree34fa9ddf1033ec22e3bc113582bef07f7e29c6b5 /common/gl_canvas.c
parent0f5a6f57b70bb7c94e15e908db4627d44c339b9c (diff)
Store SpicePath segment count rather than size
Internally and in the network protocol (for the new version) we now store the actual number of segments rather than the size of the full segments array in bytes. This change consists of multiple changes to handle this: * Make the qxl parser calculate num_segments * Make the canvas stroke code handle the new SpicePath layout. * Fix up is_equal_path in red_worker.c for the new layout * replace multiple calls to spice_marshall_PathSegment with a single spice_marshall_Path call * Make the byte_size() array size handling do the conversion from network size to number of elements when marshalling/demarshalling. * Update the current spice protocol to send the segment count rather than the size * Update the old spice protocol to use the new byte_size functionallity to calculate the size sent and the number of elements recieved
Diffstat (limited to 'common/gl_canvas.c')
-rw-r--r--common/gl_canvas.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index 59fb1a7..5a03d15 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -114,15 +114,13 @@ static pixman_image_t *canvas_surf_to_trans_surf(GLCImage *image,
static GLCPath get_path(GLCanvas *canvas, SpicePath *s)
{
GLCPath path = glc_path_create(canvas->glc);
- uint32_t more = s->size;
+ int i;
SpicePathSeg* seg = s->segments;
- do {
+ for (i = 0; i < s->num_segments; i++) {
uint32_t flags = seg->flags;
SpicePointFix* point = seg->points;
SpicePointFix* end_point = point + seg->count;
- ASSERT(point < end_point);
- more -= ((unsigned long)end_point - (unsigned long)seg);
seg = (SpicePathSeg*)end_point;
if (flags & SPICE_PATH_BEGIN) {
@@ -148,7 +146,7 @@ static GLCPath get_path(GLCanvas *canvas, SpicePath *s)
glc_path_close(path);
}
}
- } while (more);
+ }
return path;
}
@@ -621,7 +619,7 @@ static void gl_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, Sp
}
glc_set_line_width(canvas->glc, fix_to_double(stroke->attr.width));
- path = get_path(canvas, SPICE_GET_ADDRESS(stroke->path));
+ path = get_path(canvas, stroke->path);
glc_stroke_path(canvas->glc, path);
glc_path_destroy(path);
}