summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-12-20 13:55:41 +0100
committerAndrea Canciani <ranma42@gmail.com>2010-12-20 18:36:52 +0100
commit2ca9b3de0232a8f5fc41623d9954cf09bac8366d (patch)
tree631c17f2392caad4ba26175e6434eefbbe9a1f7c
parentc9915e3b98bd81fa461f3f8934b1d39da4a94352 (diff)
util2double
-rw-r--r--pixman/pixman-image.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 0e2593d..6fa530b 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -56,6 +56,28 @@ _pixman_init_gradient (gradient_t * gradient,
return TRUE;
}
+double *
+_pixman_gradient_stops_to_double (const pixman_gradient_stop_t *stops,
+ int n_stops)
+{
+ double *r;
+ int i;
+
+ r = pixman_malloc_ab (n_stops, sizeof (double) * 5);
+
+ if (r != NULL) {
+ for (i = 0; i < n_stops; i++) {
+ r[i] = pixman_fixed_to_double (stops[i].x);
+ r[n_stops + i * 4 + 0] = (1. / 65535.) * stops[i].color.alpha;
+ r[n_stops + i * 4 + 1] = (1. / 65535.) * stops[i].color.red;
+ r[n_stops + i * 4 + 2] = (1. / 65535.) * stops[i].color.green;
+ r[n_stops + i * 4 + 3] = (1. / 65535.) * stops[i].color.blue;
+ }
+ }
+
+ return r;
+}
+
pixman_image_t *
_pixman_image_allocate (void)
{