[PATCH 12/72] core: helper funtion for initializing rects with zero
"Enrico Weigelt, metux IT consult" <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
In some places we zero-out rects field-by-field. On one hand we should encapsulate that in a helper, to make the source a bit easier to read, and to have it all in one place, in case of possible later changes. OTOH, use static zero initializer instead of explicit field-by-field, to allow the compiler to use vector ops and so save a few cycles on certain cpu archs. Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]> --- src/cairo-path-bounds.c | 3 +-- src/cairoint.h | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c index 624b3cb..6dcf90c 100644 --- a/src/cairo-path-bounds.c +++ b/src/cairo-path-bounds.c @@ -144,8 +144,7 @@ _cairo_path_fixed_fill_extents (const cairo_path_fixed_t *path, path->extents.p1.y < path->extents.p2.y) { _cairo_box_round_to_rectangle (&path->extents, extents); } else { - extents->x = extents->y = 0; - extents->width = extents->height = 0; + _cairo_zero_rectangle_init (extents); } } diff --git a/src/cairoint.h b/src/cairoint.h index f781748..b8d66bd 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -327,6 +327,12 @@ _cairo_unbounded_rectangle_init (cairo_rectangle_int_t *rect) *rect = _cairo_unbounded_rectangle; } +static inline void +_cairo_zero_rectangle_init (cairo_rectangle_int_t *rect) +{ + *rect = (cairo_rectangle_int_t){ 0 }; +} + cairo_private_no_warn cairo_bool_t _cairo_rectangle_intersect (cairo_rectangle_int_t *dst, const cairo_rectangle_int_t *src); -- 2.6.4.442.g545299f -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo