From 9fcd7fa957c072b87804f2daa90233739628fca9 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 25 Jun 2010 16:20:25 +0200 Subject: [PATCH] qxl-abi: handle clip rect and path references. red_parse_qxl.c starts to follow QXLPHYSICAL references and build up data structures. Can zap a bunch of get_virt calls in red_worker.c, followed by cleanups. (de-) marshaller needs updates to deal with that. Also I suspect with the get_virt() calls being gone we can offload more work to generated marshaller code. client doesn't build. --- canvas_base.c | 9 ++++----- gl_canvas.c | 18 ++++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/canvas_base.c b/canvas_base.c index c5ab88a..ba0fb21 100644 --- a/canvas_base.c +++ b/canvas_base.c @@ -1991,13 +1991,12 @@ static void canvas_clip_pixman(CanvasBase *canvas, case SPICE_CLIP_TYPE_NONE: break; case SPICE_CLIP_TYPE_RECTS: { - uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data); - - SpiceRect *now = (SpiceRect *)(n + 1); + uint32_t n = clip->rects->num_rects; + SpiceRect *now = clip->rects->rects; pixman_region32_t clip; - if (spice_pixman_region32_init_rects(&clip, now, *n)) { + if (spice_pixman_region32_init_rects(&clip, now, n)) { pixman_region32_intersect(dest_region, dest_region, &clip); pixman_region32_fini(&clip); } @@ -3191,7 +3190,7 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, do { uint32_t flags = seg->flags; - SpicePointFix* point = (SpicePointFix*)seg->data; + SpicePointFix* point = seg->points; SpicePointFix* end_point = point + seg->count; ASSERT(point < end_point); more -= ((unsigned long)end_point - (unsigned long)seg); diff --git a/gl_canvas.c b/gl_canvas.c index 059bd04..59fb1a7 100644 --- a/gl_canvas.c +++ b/gl_canvas.c @@ -111,17 +111,15 @@ static pixman_image_t *canvas_surf_to_trans_surf(GLCImage *image, return ret; } -static GLCPath get_path(GLCanvas *canvas, void *addr) +static GLCPath get_path(GLCanvas *canvas, SpicePath *s) { GLCPath path = glc_path_create(canvas->glc); - uint32_t* data_size = (uint32_t*)addr; - uint32_t more = *data_size; - - SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1); + uint32_t more = s->size; + SpicePathSeg* seg = s->segments; do { uint32_t flags = seg->flags; - SpicePointFix* point = (SpicePointFix*)seg->data; + SpicePointFix* point = seg->points; SpicePointFix* end_point = point + seg->count; ASSERT(point < end_point); more -= ((unsigned long)end_point - (unsigned long)seg); @@ -178,11 +176,11 @@ static void set_clip(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip) case SPICE_CLIP_TYPE_NONE: break; case SPICE_CLIP_TYPE_RECTS: { - uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data); - SpiceRect *now = (SpiceRect *)(n + 1); - SpiceRect *end = now + *n; + uint32_t n = clip->rects->num_rects; + SpiceRect *now = clip->rects->rects; + SpiceRect *end = now + n; - if (*n == 0) { + if (n == 0) { rect.x = rect.y = 0; rect.width = rect.height = 0; glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET);