[cairo] [API] Export region data type

Behdad Esfahbod behdad at behdad.org
Wed Feb 25 12:57:09 PST 2009


Kristian Høgsberg wrote:
> On Sat, Feb 21, 2009 at 9:44 AM, Soeren Sandmann <sandmann at daimi.au.dk> wrote:
>> Hi,
>>
>> I'd like to propose exporting the region data type for 1.10. There is
>> an implementation available in the public-region branch of this
>> repository:
> ...
>>    typedef struct _cairo_rectangle_int {
>>        int x, y;
>>        unsigned int width, height;
>>    } cairo_rectangle_int_t;
> 
> If we end up exporting this, I'd suggest making width and height
> signed ints to avoid overflow pitfalls such as

With signed width/height you get overflows when doing:

  rect->width = x2 - x1;

behdad


>   if (rect1->x - rect2->x < rect3->width)
> 
> cheers,
> Kristian



More information about the cairo mailing list