[cairo] [PATCH] tessellator: Fix boxes tessellator to handle num_boxes <= 1 correctly

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 8 02:00:04 PDT 2011


On Wed, 8 Jun 2011 14:16:52 +0900, Taekyun Kim <podain77 at gmail.com> wrote:
> Hi all,
> 
> It looks like that _cairo_bentley_ottmann_tessellate_boxes() does not handle
> zero or single box input correctly.

You were right. In my defense, it was correct for the period of time when
we tessellated in place.
 
> I think clearing 'out' when 'in->num_boxes == 0' would be more correct
> rather than just returning CAIRO_STATUS_SUCCESS because we cannot assume
> that 'out' is already empty and 'in' and 'out' might be equal.

True, but we could just test for out == in and leave it untouched.
 
> For a single box input, we should copy 'in' to 'out'. I assumed that
> cairo_boxes_t have no empty chunk if it has at least a box (therefore the
> first box is at boxes->chunks.base[0]). May I have this assumption though?

Indeed, the boxes are allocated with an initial chunk so there is always
at least one box available.

> Please review my patch and leave some comments.
Applied, thanks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list