[Spice-devel] [PATCH 20/30] Convert cairo canvas to use pixman for draw_stroke

Izik Eidus ieidus at redhat.com
Sun Feb 21 01:07:52 PST 2010


On Thu, 18 Feb 2010 21:58:46 +0100
Alexander Larsson <alexl at redhat.com> wrote:

>  void canvas_draw_stroke(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
>  {
> -    cairo_t *cairo = canvas->cairo;
> +    StrokeGC gc = { {0} };
> +    lineGCOps ops = {
> +        stroke_fill_spans,
> +        stroke_fill_rects
> +    };
> +    uint32_t *data_size;
> +    uint32_t more;
> +    SpicePathSeg *seg;
> +    SpicePoint *points;
> +    int num_points, points_size, i;
> +    int dashed;
> +
> +    pixman_region32_init_rect (&gc.dest_region,
> +                               bbox->left, bbox->top,
> +                               bbox->right - bbox->left,
> +                               bbox->bottom - bbox->top);
>  
> -    cairo_save(cairo);
> -    canvas_clip(canvas, clip);
> -
> -    canvas_set_line_attr_no_dash(canvas, &stroke->attr);
> -    canvas_set_path(canvas, SPICE_GET_ADDRESS(stroke->path));
> -    if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
> -        canvas_draw(canvas, &stroke->brush, stroke->back_mode,
> -                    (DrawMethod)cairo_stroke_preserve, cairo);
> -        canvas_set_dash(canvas, stroke->attr.style_nseg, stroke->attr.style,
> -                        !!(stroke->attr.flags & SPICE_LINE_ATTR_STARTGAP));
> -    }
> -    canvas_draw(canvas, &stroke->brush, stroke->fore_mode, (DrawMethod)cairo_stroke_preserve,
> -                cairo);
> -    cairo_new_path(cairo);
> -    cairo_restore(cairo);
> +
> +    canvas_clip_pixman (canvas, &gc.dest_region, clip);
> +
> +    if (pixman_region32_n_rects (&gc.dest_region) == 0 ||
> +        stroke->brush.type == SPICE_BRUSH_TYPE_NONE) {
> +        touch_brush (canvas, &stroke->brush);
> +        pixman_region32_fini (&gc.dest_region);
> +        return;
> +    }

sending again due to problem i had in the mail:

That line is think is wrong beacuse we can get:
SPICE_ROPD_OP_INVERS and therefore we dont need any brush.

Thanks.


More information about the Spice-devel mailing list