From a3906e65aaca3a9aaee0f42e49a53585f684ef3e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 15 Jun 2005 12:44:52 +0000 Subject: [PATCH] Use a clip region when rendering a non-solid pattern through a rectangular path ... trapezoid rasterization is just too slow to use that path when we aren't forced to do so. --- ChangeLog | 7 +++++++ src/cairo-gstate.c | 25 ++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2137fbd58..bd90b6b29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-15 Owen Taylor + + * src/cairo-gstate.c (_cairo_gstate_clip_and_composite_trapezoids): + Use a clip region when rendering a non-solid pattern through + a rectangular path ... trapezoid rasterization is just too slow + to use that path when we aren't forced to do so. + 2005-06-15 Carl Worth * test/cairo-test.c: Track removal of cairo_status_string. diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 7cbe192ea..94770f329 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -1417,16 +1417,23 @@ _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, /* Solid rectangles are handled specially */ status = _composite_trap_region_solid (gstate, (cairo_solid_pattern_t *)src, operator, dst, trap_region); - } else if (trap_region && pixman_region_num_rects (trap_region) <= 1) { - /* For a simple rectangle, we can just use composite(), for more - * rectangles, we'd have to set a clip region. That might still - * be a win, but it's less obvious. (Depends on the backend) - */ - status = _composite_trap_region (gstate, src, operator, dst, - trap_region, &extents); } else { - status = _composite_traps (gstate, src, operator, - dst, traps, &extents); + if (trap_region) { + /* For a simple rectangle, we can just use composite(), for more + * rectangles, we have to set a clip region. The cost of rasterizing + * trapezoids is pretty high for most backends currently, so it's + * worthwhile even if a region is needed. + */ + status = _composite_trap_region (gstate, src, operator, dst, + trap_region, &extents); + if (status != CAIRO_INT_STATUS_UNSUPPORTED) + goto out; + + /* If a clip regions aren't supported, fall through */ + } + + status = _composite_traps (gstate, src, operator, + dst, traps, &extents); } }