diff options
author | Chia-I Wu <[email protected]> | 2010-11-24 16:29:10 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-11-25 13:32:03 +0800 |
commit | 9ea4936a36f5011695a3996c63cfad6b480b3e49 (patch) | |
tree | 4c3a4ceaf8b7ad539494b9ea0b590aade5513949 | |
parent | 3965051dff4554cf2b521b34c8c82c4c7744aac6 (diff) |
st/vega: Fix a crash with empty paths.
-rw-r--r-- | src/gallium/state_trackers/vega/path.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c index 05f8b0d9979..31c718e1c99 100644 --- a/src/gallium/state_trackers/vega/path.c +++ b/src/gallium/state_trackers/vega/path.c @@ -312,7 +312,15 @@ static void polygon_array_calculate_bounds( struct polygon_array *polyarray ) unsigned i; assert(polys); - assert(polys->num_elements); + + if (!polys->num_elements) { + polyarray->min_x = 0.0f; + polyarray->min_y = 0.0f; + polyarray->max_x = 0.0f; + polyarray->max_y = 0.0f; + return; + } + polygon_bounding_rect((((struct polygon**)polys->data)[0]), bounds); min_x = bounds[0]; min_y = bounds[1]; @@ -362,7 +370,8 @@ static struct polygon_array * path_get_fill_polygons(struct path *p, struct matr sx = sy = px = py = ox = oy = 0.f; - current = polygon_create(32); + if (p->num_segments) + current = polygon_create(32); for (i = 0; i < p->num_segments; ++i) { VGubyte segment = ((VGubyte*)(p->segments->data))[i]; |