[Pixman] [PATCH 3/3] gradient-walker: Use appropriate size for left and right offset
Andrea Canciani
ranma42 at gmail.com
Thu Jan 5 02:42:18 PST 2012
Otherwise if pos cannot be represented as an int32_t, the gradient is
reset at every step.
---
pixman/pixman-gradient-walker.c | 13 +++----------
pixman/pixman-private.h | 4 ++--
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/pixman/pixman-gradient-walker.c b/pixman/pixman-gradient-walker.c
index e0aa3a4..3c34d1b 100644
--- a/pixman/pixman-gradient-walker.c
+++ b/pixman/pixman-gradient-walker.c
@@ -87,12 +87,7 @@ gradient_walker_reset (pixman_gradient_walker_t *walker,
right_x = stops[n].x;
right_c = &stops[n].color;
- if (walker->repeat == PIXMAN_REPEAT_NORMAL)
- {
- left_x += (pos - x);
- right_x += (pos - x);
- }
- else if (walker->repeat == PIXMAN_REPEAT_REFLECT)
+ if (walker->repeat == PIXMAN_REPEAT_REFLECT)
{
if ((int32_t)pos & 0x10000)
{
@@ -109,8 +104,6 @@ gradient_walker_reset (pixman_gradient_walker_t *walker,
x = 0x10000 - x;
}
- left_x += (pos - x);
- right_x += (pos - x);
}
else if (walker->repeat == PIXMAN_REPEAT_NONE)
{
@@ -120,8 +113,8 @@ gradient_walker_reset (pixman_gradient_walker_t *walker,
left_c = right_c;
}
- walker->left_x = left_x;
- walker->right_x = right_x;
+ walker->left_x = left_x + (pos - x);
+ walker->right_x = right_x + (pos - x);
walker->left_ag = ((left_c->alpha >> 8) << 16) | (left_c->green >> 8);
walker->left_rb = ((left_c->red & 0xff00) << 8) | (left_c->blue >> 8);
walker->right_ag = ((right_c->alpha >> 8) << 16) | (right_c->green >> 8);
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index a41d46c..2a78ab9 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -299,8 +299,8 @@ typedef struct
uint32_t left_rb;
uint32_t right_ag;
uint32_t right_rb;
- pixman_fixed_t left_x;
- pixman_fixed_t right_x;
+ pixman_fixed_48_16_t left_x;
+ pixman_fixed_48_16_t right_x;
pixman_fixed_t stepper;
pixman_gradient_stop_t *stops;
--
1.7.5.4
More information about the Pixman
mailing list