diff options
author | David Reveman <davidr@novell.com> | 2004-04-06 09:36:12 +0000 |
---|---|---|
committer | David Reveman <davidr@novell.com> | 2004-04-06 09:36:12 +0000 |
commit | e309090d2a18a896c67e731151b973b530f76980 (patch) | |
tree | 05568843c26c44738d5413269bb2358776df515b /src/cairo-traps.c | |
parent | b17b04aa388541c0880698aed0f03796a3146d49 (diff) |
Added new pattern API
Diffstat (limited to 'src/cairo-traps.c')
-rw-r--r-- | src/cairo-traps.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/cairo-traps.c b/src/cairo-traps.c index e786ad42..9b44d38e 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -608,3 +608,40 @@ _cairo_traps_contain (cairo_traps_t *traps, double x, double y) return 0; } + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +static void +_cairo_trap_extents (cairo_trapezoid_t *t, cairo_box_t *extents) +{ + cairo_fixed_t x; + + if (t->top < extents->p1.y) + extents->p1.y = t->top; + + if (t->bottom > extents->p2.y) + extents->p2.y = t->bottom; + + x = MIN (_compute_x (&t->left, t->top), + _compute_x (&t->left, t->bottom)); + if (x < extents->p1.x) + extents->p1.x = x; + + x = MAX (_compute_x (&t->right, t->top), + _compute_x (&t->right, t->bottom)); + if (x > extents->p2.x) + extents->p2.x = x; +} + +void +_cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents) +{ + int i; + + extents->p1.x = extents->p1.y = SHRT_MAX << 16; + extents->p2.x = extents->p2.y = SHRT_MIN << 16; + + for (i = 0; i < traps->num_traps; i++) + _cairo_trap_extents (&traps->traps[i], extents); +} |