[Pixman] [PATCH 10/15] Linear: Optimize for horizontal gradients.
Søren Sandmann
sandmann at cs.au.dk
Sat Jan 8 03:21:54 PST 2011
From: Søren Sandmann Pedersen <ssp at redhat.com>
If the gradient is horizontal, we can reuse the same scanline over and
over. Add support for this optimization to
_pixman_linear_gradient_iter_init().;
---
pixman/pixman-linear-gradient.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index 3a6e7e0..174079c 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -245,10 +245,23 @@ _pixman_linear_gradient_iter_init (pixman_image_t *image,
uint8_t *buffer,
iter_flags_t flags)
{
- if (flags & ITER_NARROW)
- iter->get_scanline = linear_gradient_get_scanline_narrow;
+ if (linear_gradient_classify (image, x, y, width, height) ==
+ SOURCE_IMAGE_CLASS_HORIZONTAL)
+ {
+ if (flags & ITER_NARROW)
+ linear_gradient_get_scanline_narrow (iter, NULL);
+ else
+ linear_gradient_get_scanline_wide (iter, NULL);
+
+ iter->get_scanline = _pixman_iter_get_scanline_noop;
+ }
else
- iter->get_scanline = linear_gradient_get_scanline_wide;
+ {
+ if (flags & ITER_NARROW)
+ iter->get_scanline = linear_gradient_get_scanline_narrow;
+ else
+ iter->get_scanline = linear_gradient_get_scanline_wide;
+ }
}
PIXMAN_EXPORT pixman_image_t *
--
1.6.0.6
More information about the Pixman
mailing list