Re: [PATCH 06/72] core: helper inline for rect->box conversion

Bryce Harrington <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On Tue, Dec 29, 2015 at 10:16:44AM +0100, Enrico Weigelt, metux IT consult wrote:
> Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>

LGTM,
Reviewed-by: Bryce Harrington <[email protected]>

> ---
>  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
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.