[cairo-commit] src/cairo-mono-scan-converter.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Feb 29 04:18:36 PST 2012


 src/cairo-mono-scan-converter.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 300e32a4a9d79c26077f33e9b67bad2106071849
Author: Seongwon Cho <seongwon1.cho at samsung.com>
Date:   Wed Feb 29 18:59:34 2012 +0900

    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 at linux.intel.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-mono-scan-converter.c b/src/cairo-mono-scan-converter.c
index a617f48..106f801 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);


More information about the cairo-commit mailing list