diff options
author | Owen Taylor <otaylor@redhat.com> | 2005-08-30 10:42:17 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@redhat.com> | 2005-08-30 10:42:17 +0000 |
commit | a4418a63d7b837f0f7c20f5ce6a0e8b31edd97d7 (patch) | |
tree | 190e0efbae756d34ee2294993a0ad62a683b62b1 | |
parent | 2120864edfb1bc51251dca3aeefbfadffb442ad0 (diff) |
Use a 8xN rather than a 1xN strip for a vertical gradient. This is much more tolerant of slow compositing code, and is worth some extra expense computing the gradient. (#4263, found in test case from Richard Stellingwerff)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/cairo-pattern.c | 11 |
2 files changed, 17 insertions, 2 deletions
@@ -1,5 +1,13 @@ 2005-08-27 Owen Taylor <otaylor@redhat.com> + * src/cairo-pattern.c (_cairo_pattern_acquire_surface_for_gradient): + Use a 8xN rather than a 1xN strip for a vertical gradient. This + is much more tolerant of slow compositing code, and is worth some + extra expense computing the gradient. (#4263, found in test case + from Richard Stellingwerff) + +2005-08-27 Owen Taylor <otaylor@redhat.com> + reviewed by: cworth * src/cairo-traps.c (_cairo_traps_extract_region): Make the diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 7b0130f6a..162d6bf49 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1230,8 +1230,15 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern, height = 1; repeat = TRUE; } - if (is_vertical) { - width = 1; + /* width-1 repeating patterns are quite slow with scan-line based + * compositing code, so we use a wider strip and spend some extra + * expense in computing the gradient. It's possible that for narrow + * gradients we'd be better off using a 2 or 4 pixel strip; the + * wider the gradient, the more it's worth spending extra time + * computing a sample. + */ + if (is_vertical && width > 8) { + width = 8; repeat = TRUE; } } |