st/egl: Remove.
[mesa.git] / src / gallium / state_trackers / vega / path.c
index 31a043ea9b77c90ccbbe7bda9dc766068f632921..6448e642cd61c1bdd82cab448d697f2085d7fe2b 100644 (file)
@@ -192,7 +192,7 @@ struct path * path_create(VGPathDatatype dt, VGfloat scale, VGfloat bias,
 
    vg_init_object(&path->base, vg_current_context(), VG_OBJECT_PATH);
    path->caps = capabilities & VG_PATH_CAPABILITY_ALL;
-   vg_context_add_object(vg_current_context(), VG_OBJECT_PATH, path);
+   vg_context_add_object(vg_current_context(), &path->base);
 
    path->datatype = dt;
    path->scale = scale;
@@ -224,7 +224,7 @@ static void polygon_array_cleanup(struct polygon_array *polyarray)
 
 void path_destroy(struct path *p)
 {
-   vg_context_remove_object(vg_current_context(), VG_OBJECT_PATH, p);
+   vg_context_remove_object(vg_current_context(), &p->base);
 
    array_destroy(p->segments);
    array_destroy(p->control_points);
@@ -234,6 +234,8 @@ void path_destroy(struct path *p)
    if (p->stroked.path)
       path_destroy(p->stroked.path);
 
+   vg_free_object(&p->base);
+
    FREE(p);
 }
 
@@ -367,6 +369,8 @@ static struct polygon_array * path_get_fill_polygons(struct path *p, struct matr
    void *coords = (VGfloat *)p->control_points->data;
    struct array *array;
 
+   memset(data, 0, sizeof(data));
+
    if (p->fill_polys.polygon_array.array)
    {
       if (memcmp( &p->fill_polys.matrix,
@@ -1083,10 +1087,8 @@ static INLINE VGubyte normalize_coords(struct path_iter_data *pd,
    }
       break;
    case VG_SCUBIC_TO: {
-      VGfloat x0, y0, x1, y1, x2, y2, x3, y3;
+      VGfloat x1, y1, x2, y2, x3, y3;
       data_at(&pd->coords, pd->path, 0, 4, data);
-      x0 = pd->ox;
-      y0 = pd->oy;
       x1 = 2*pd->ox-pd->px;
       y1 = 2*pd->oy-pd->py;
       x2 = data[0];
@@ -1126,6 +1128,7 @@ static INLINE VGubyte normalize_coords(struct path_iter_data *pd,
    default:
       abort();
       assert(!"Unknown segment!");
+      return 0;
    }
 }
 
@@ -1565,10 +1568,11 @@ void path_render(struct path *p, VGbitfield paintModes,
                            mat,
                            &paint_matrix)) {
       /* First the fill */
+      shader_set_surface_matrix(ctx->shader, mat);
       shader_set_paint(ctx->shader, ctx->state.vg.fill_paint);
       shader_set_paint_matrix(ctx->shader, &paint_matrix);
       shader_bind(ctx->shader);
-      path_fill(p, mat);
+      path_fill(p);
    }
 
    if ((paintModes & VG_STROKE_PATH) &&
@@ -1580,18 +1584,23 @@ void path_render(struct path *p, VGbitfield paintModes,
        *  taking place."*/
       if (ctx->state.vg.stroke.line_width.f <= 0)
          return;
+      shader_set_surface_matrix(ctx->shader, mat);
       shader_set_paint(ctx->shader, ctx->state.vg.stroke_paint);
       shader_set_paint_matrix(ctx->shader, &paint_matrix);
       shader_bind(ctx->shader);
-      path_stroke(p, mat);
+      path_stroke(p);
    }
 }
 
-void path_fill(struct path *p, struct matrix *mat)
+void path_fill(struct path *p)
 {
    struct vg_context *ctx = vg_current_context();
+   struct matrix identity;
+
+   matrix_load_identity(&identity);
+
    {
-      struct polygon_array *polygon_array = path_get_fill_polygons(p, mat);
+      struct polygon_array *polygon_array = path_get_fill_polygons(p, &identity);
       struct array *polys = polygon_array->array;
 
       if (!polygon_array || !polys || !polys->num_elements) {
@@ -1601,7 +1610,7 @@ void path_fill(struct path *p, struct matrix *mat)
    }
 }
 
-void path_stroke(struct path *p, struct matrix *mat)
+void path_stroke(struct path *p)
 {
    struct vg_context *ctx = vg_current_context();
    VGFillRule old_fill = ctx->state.vg.fill_rule;
@@ -1613,7 +1622,7 @@ void path_stroke(struct path *p, struct matrix *mat)
    if (stroke && !path_is_empty(stroke)) {
       ctx->state.vg.fill_rule = VG_NON_ZERO;
 
-      path_fill(stroke, mat);
+      path_fill(stroke);
 
       ctx->state.vg.fill_rule = old_fill;
    }