summaryrefslogtreecommitdiff
path: root/src/cairo-mono-scan-converter.c
diff options
context:
space:
mode:
authorSeongwon Cho <seongwon1.cho@samsung.com>2012-02-29 18:59:34 +0900
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-29 12:18:11 +0000
commit300e32a4a9d79c26077f33e9b67bad2106071849 (patch)
treecdf46a7a2bb666baba1d6da75704302dfd09ec0c /src/cairo-mono-scan-converter.c
parent2587b9dfd391fc1dc6e20eaa4c2d64fafe2e809b (diff)
downloadcairo-300e32a4a9d79c26077f33e9b67bad2106071849.tar.gz
mono-scan-convertor: Include space for the closing span
When estimating the maximum number of spans required for a particular width, we need to include a closing span. Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-mono-scan-converter.c')
-rw-r--r--src/cairo-mono-scan-converter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cairo-mono-scan-converter.c b/src/cairo-mono-scan-converter.c
index a617f484d..106f801dd 100644
--- a/src/cairo-mono-scan-converter.c
+++ b/src/cairo-mono-scan-converter.c
@@ -390,13 +390,15 @@ _mono_scan_converter_init(struct mono_scan_converter *c,
int xmax, int ymax)
{
cairo_status_t status;
+ int max_num_spans;
status = polygon_init (c->polygon, ymin, ymax);
if (unlikely (status))
return status;
- if (xmax - xmin > ARRAY_LENGTH(c->spans_embedded)) {
- c->spans = _cairo_malloc_ab (xmax - xmin,
+ max_num_spans = xmax - xmin + 1;
+ if (max_num_spans > ARRAY_LENGTH(c->spans_embedded)) {
+ c->spans = _cairo_malloc_ab (max_num_spans,
sizeof (cairo_half_open_span_t));
if (unlikely (c->spans == NULL)) {
polygon_fini (c->polygon);