diff options
author | Andrea Canciani <ranma42@gmail.com> | 2012-01-05 11:19:47 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2012-01-05 18:48:05 +0100 |
commit | 33c15b4757fc69837650f20461f42e1a051870d0 (patch) | |
tree | b83150366552d2b440afd634ecd1c841f6dc9ae2 | |
parent | 0fbcfb3d3b9f89283fcaa6808a533da75c2e4218 (diff) |
wip
-rw-r--r-- | pixman/pixman-image.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 913853c..4cb70a2 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -39,40 +39,29 @@ gradient_property_changed (pixman_image_t *image) gradient_t *gradient = &image->gradient; int n = gradient->n_stops; pixman_gradient_stop_t *stops = gradient->stops; - pixman_gradient_stop_t *begin = &(gradient->stops[-1]); - pixman_gradient_stop_t *end = &(gradient->stops[n]); + pixman_gradient_stop_t *first = &(gradient->stops[0]); + pixman_gradient_stop_t *last = &(gradient->stops[n-1]); - switch (gradient->common.repeat) - { - default: - case PIXMAN_REPEAT_NONE: - begin->x = INT32_MIN; - begin->color = transparent_black; - end->x = INT32_MAX; - end->color = transparent_black; - break; + if (first[0].x > 0) + first_bg = transparent_black; + else + first_bg = first[0].color; - case PIXMAN_REPEAT_NORMAL: - begin->x = stops[n - 1].x - pixman_fixed_1; - begin->color = stops[n - 1].color; - end->x = stops[0].x + pixman_fixed_1; - end->color = stops[0].color; - break; + if (last[0].x < pixman_fixed_1) + last_bg = transparent_black; + else + last_bg = last[0].color; - case PIXMAN_REPEAT_REFLECT: - begin->x = - stops[0].x; - begin->color = stops[0].color; - end->x = pixman_int_to_fixed (2) - stops[n - 1].x; - end->color = stops[n - 1].color; - break; + if (gradient->common.repeat == PIXMAN_REPEAT_NONE) + first_bg = last_bg = transparent_black; - case PIXMAN_REPEAT_PAD: - begin->x = INT32_MIN; - begin->color = stops[0].color; - end->x = INT32_MAX; - end->color = stops[n - 1].color; - break; - } + first[-2].x = INT32_MIN; + first[-1].x = first[0].x - pixman_fixed_e; + first[-2].color = first[-1].color = first_bg; + + last[1].x = last[0].x + pixman_fixed_e; + last[2].x = INT32_MAX; + last[1].color = last[2].color = last_bg; } pixman_bool_t |