[cairo] [PATCH v8 05/71] core: helper inline for rect->box conversion

Uli Schlachter psychon at znc.in
Fri Jul 1 19:06:30 UTC 2016


Am 30.06.2016 um 18:58 schrieb Bill Spitzak:
> Looks like a good idea to me.

Ok, how about we cherry pick random patches that look good to us? That sounds
better than hoping for all of this to be eventually merged at once, doesn't it?

Uli

> On Thu, Jun 30, 2016 at 8:45 AM, Enrico Weigelt, metux IT consult <
> enrico.weigelt at gr13.net> wrote:
> 
>> Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
>> ---
>>  src/cairo-box-inline.h | 10 ++++++++++
>>  src/cairo-clip-boxes.c | 11 ++---------
>>  2 files changed, 12 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/cairo-box-inline.h b/src/cairo-box-inline.h
>> index 406102a..c20c28f 100644
>> --- a/src/cairo-box-inline.h
>> +++ b/src/cairo-box-inline.h
>> @@ -57,6 +57,16 @@ _cairo_box_from_integers (cairo_box_t *box, int x, int
>> y, int w, int h)
>>      box->p2.y = _cairo_fixed_from_int (y + h);
>>  }
>>
>> +static inline void
>> +_cairo_box_from_rectangle_int(cairo_box_t *box,
>> +                             const cairo_rectangle_int_t *rect)
>> +{
>> +    box->p1.x = _cairo_fixed_from_int (rect->x);
>> +    box->p1.y = _cairo_fixed_from_int (rect->y);
>> +    box->p2.x = _cairo_fixed_from_int (rect->x + rect->width);
>> +    box->p2.y = _cairo_fixed_from_int (rect->y + rect->height);
>> +}
>> +
>>  /* assumes box->p1 is top-left, p2 bottom-right */
>>  static inline void
>>  _cairo_box_add_point (cairo_box_t *box,
>> diff --git a/src/cairo-clip-boxes.c b/src/cairo-clip-boxes.c
>> index 7bcbeb1..abf634e 100644
>> --- a/src/cairo-clip-boxes.c
>> +++ b/src/cairo-clip-boxes.c
>> @@ -119,11 +119,7 @@ _cairo_clip_contains_rectangle (const cairo_clip_t
>> *clip,
>>  {
>>      cairo_box_t box;
>>
>> -    box.p1.x = _cairo_fixed_from_int (rect->x);
>> -    box.p1.y = _cairo_fixed_from_int (rect->y);
>> -    box.p2.x = _cairo_fixed_from_int (rect->x + rect->width);
>> -    box.p2.y = _cairo_fixed_from_int (rect->y + rect->height);
>> -
>> +    _cairo_box_from_rectangle_int(&box, rect);
>>      return _cairo_clip_contains_rectangle_box (clip, rect, &box);
>>  }
>>
>> @@ -347,10 +343,7 @@ _cairo_clip_intersect_rectangle (cairo_clip_t
>>  *clip,
>>      if (r->width == 0 || r->height == 0)
>>         return _cairo_clip_set_all_clipped (clip);
>>
>> -    box.p1.x = _cairo_fixed_from_int (r->x);
>> -    box.p1.y = _cairo_fixed_from_int (r->y);
>> -    box.p2.x = _cairo_fixed_from_int (r->x + r->width);
>> -    box.p2.y = _cairo_fixed_from_int (r->y + r->height);
>> +    _cairo_box_from_rectangle_int(&box, r);
>>
>>      return _cairo_clip_intersect_rectangle_box (clip, r, &box);
>>  }
>> --
>> 2.6.4.442.g545299f
>>
>> --
>> cairo mailing list
>> cairo at cairographics.org
>> https://lists.cairographics.org/mailman/listinfo/cairo
> 
> 
> 


-- 
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.


More information about the cairo mailing list