diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-07-05 20:45:13 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-07-05 20:45:13 +0200 |
commit | f39d64f40bca094396d5002dcfcd38eaa281c9af (patch) | |
tree | 5e25c5d01bf1bd390f119ec3146f4f6b56dee2b4 /common | |
parent | 6dcf43912e752b8c61199017718ccfb067b45576 (diff) | |
download | spice-f39d64f40bca094396d5002dcfcd38eaa281c9af.tar.gz spice-f39d64f40bca094396d5002dcfcd38eaa281c9af.tar.xz spice-f39d64f40bca094396d5002dcfcd38eaa281c9af.zip |
Convert SpicePath.segments to a pointer array
Diffstat (limited to 'common')
-rw-r--r-- | common/canvas_base.c | 21 | ||||
-rw-r--r-- | common/gdi_canvas.c | 13 | ||||
-rw-r--r-- | common/gl_canvas.c | 12 |
3 files changed, 19 insertions, 27 deletions
diff --git a/common/canvas_base.c b/common/canvas_base.c index 53d13f25..a0429a6a 100644 --- a/common/canvas_base.c +++ b/common/canvas_base.c @@ -3062,7 +3062,6 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, stroke_fill_spans, stroke_fill_rects }; - SpicePathSeg *seg; StrokeLines lines; unsigned int i; int dashed; @@ -3165,24 +3164,22 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, CANVAS_ERROR("invalid brush type"); } - seg = (SpicePathSeg*)stroke->path->segments; - stroke_lines_init(&lines); for (i = 0; i < stroke->path->num_segments; i++) { - uint32_t flags = seg->flags; - SpicePointFix* point = seg->points; - SpicePointFix* end_point = point + seg->count; - ASSERT(point < end_point); - seg = (SpicePathSeg*)end_point; + SpicePathSeg *seg = stroke->path->segments[i]; + SpicePointFix* point, *end_point; + + point = seg->points; + end_point = point + seg->count; - if (flags & SPICE_PATH_BEGIN) { + if (seg->flags & SPICE_PATH_BEGIN) { stroke_lines_draw(&lines, (lineGC *)&gc, dashed); stroke_lines_append_fix(&lines, point); point++; } - if (flags & SPICE_PATH_BEZIER) { + if (seg->flags & SPICE_PATH_BEZIER) { ASSERT((point - end_point) % 3 == 0); for (; point + 2 < end_point; point += 3) { stroke_lines_append_bezier(&lines, @@ -3196,8 +3193,8 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, stroke_lines_append_fix(&lines, point); } } - if (flags & SPICE_PATH_END) { - if (flags & SPICE_PATH_CLOSE) { + if (seg->flags & SPICE_PATH_END) { + if (seg->flags & SPICE_PATH_CLOSE) { stroke_lines_append(&lines, lines.points[0].x, lines.points[0].y); } diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c index e3489941..9c520024 100644 --- a/common/gdi_canvas.c +++ b/common/gdi_canvas.c @@ -310,17 +310,14 @@ uint32_t raster_ops[] = { static void set_path(GdiCanvas *canvas, SpicePath *s) { - SpicePathSeg* seg = (SpicePathSeg*)s->segments; unsigned int i; for (i = 0; i < s->num_segments; i++) { - uint32_t flags = seg->flags; + SpicePathSeg* seg = s->segments[0]; SpicePointFix* point = seg->points; SpicePointFix* end_point = point + seg->count; - ASSERT(point < end_point); - seg = (SpicePathSeg*)end_point; - if (flags & SPICE_PATH_BEGIN) { + if (seg->flags & SPICE_PATH_BEGIN) { BeginPath(canvas->dc); if (!MoveToEx(canvas->dc, (int)fix_to_double(point->x), (int)fix_to_double(point->y), NULL)) { @@ -330,7 +327,7 @@ static void set_path(GdiCanvas *canvas, SpicePath *s) point++; } - if (flags & SPICE_PATH_BEZIER) { + if (seg->flags & SPICE_PATH_BEZIER) { ASSERT((point - end_point) % 3 == 0); for (; point + 2 < end_point; point += 3) { POINT points[3]; @@ -355,9 +352,9 @@ static void set_path(GdiCanvas *canvas, SpicePath *s) } } - if (flags & SPICE_PATH_END) { + if (seg->flags & SPICE_PATH_END) { - if (flags & SPICE_PATH_CLOSE) { + if (seg->flags & SPICE_PATH_CLOSE) { if (!CloseFigure(canvas->dc)) { CANVAS_ERROR("CloseFigure failed"); } diff --git a/common/gl_canvas.c b/common/gl_canvas.c index 3e02a25e..f0e10dd7 100644 --- a/common/gl_canvas.c +++ b/common/gl_canvas.c @@ -115,20 +115,18 @@ static GLCPath get_path(GLCanvas *canvas, SpicePath *s) { GLCPath path = glc_path_create(canvas->glc); int i; - SpicePathSeg* seg = (SpicePathSeg*)s->segments; for (i = 0; i < s->num_segments; i++) { - uint32_t flags = seg->flags; + SpicePathSeg* seg = s->segments[i]; SpicePointFix* point = seg->points; SpicePointFix* end_point = point + seg->count; - seg = (SpicePathSeg*)end_point; - if (flags & SPICE_PATH_BEGIN) { + if (seg->flags & SPICE_PATH_BEGIN) { glc_path_move_to(path, fix_to_double(point->x), fix_to_double(point->y)); point++; } - if (flags & SPICE_PATH_BEZIER) { + if (seg->flags & SPICE_PATH_BEZIER) { ASSERT((point - end_point) % 3 == 0); for (; point + 2 < end_point; point += 3) { glc_path_curve_to(path, @@ -141,8 +139,8 @@ static GLCPath get_path(GLCanvas *canvas, SpicePath *s) glc_path_line_to(path, fix_to_double(point->x), fix_to_double(point->y)); } } - if (flags & SPICE_PATH_END) { - if (flags & SPICE_PATH_CLOSE) { + if (seg->flags & SPICE_PATH_END) { + if (seg->flags & SPICE_PATH_CLOSE) { glc_path_close(path); } } |