Split radial gradient images into pixman-radial-gradient.c
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Sun, 3 May 2009 01:06:23 +0000 (21:06 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sat, 16 May 2009 19:12:35 +0000 (15:12 -0400)
pixman/Makefile.am
pixman/pixman-image.c
pixman/pixman-radial-gradient.c [new file with mode: 0644]

index c4d27cb..cad1f39 100644 (file)
@@ -19,6 +19,7 @@ libpixman_1_la_SOURCES =              \
        pixman-source.c                 \
        pixman-solid-fill.c             \
        pixman-linear-gradient.c        \
+       pixman-radial-gradient.c        \
        pixman-transformed.c            \
        pixman-transformed-accessors.c  \
        pixman-utils.c                  \
index 99388ed..ce087f3 100644 (file)
@@ -300,50 +300,6 @@ pixman_image_unref (pixman_image_t *image)
 /* Constructors */
 
 PIXMAN_EXPORT pixman_image_t *
-pixman_image_create_radial_gradient (pixman_point_fixed_t         *inner,
-                                    pixman_point_fixed_t         *outer,
-                                    pixman_fixed_t                inner_radius,
-                                    pixman_fixed_t                outer_radius,
-                                    const pixman_gradient_stop_t *stops,
-                                    int                           n_stops)
-{
-    pixman_image_t *image;
-    radial_gradient_t *radial;
-
-    return_val_if_fail (n_stops >= 2, NULL);
-
-    image = _pixman_image_allocate();
-
-    if (!image)
-       return NULL;
-
-    radial = &image->radial;
-
-    if (!_pixman_init_gradient (&radial->common, stops, n_stops))
-    {
-       free (image);
-       return NULL;
-    }
-
-    image->type = RADIAL;
-
-    radial->c1.x = inner->x;
-    radial->c1.y = inner->y;
-    radial->c1.radius = inner_radius;
-    radial->c2.x = outer->x;
-    radial->c2.y = outer->y;
-    radial->c2.radius = outer_radius;
-    radial->cdx = pixman_fixed_to_double (radial->c2.x - radial->c1.x);
-    radial->cdy = pixman_fixed_to_double (radial->c2.y - radial->c1.y);
-    radial->dr = pixman_fixed_to_double (radial->c2.radius - radial->c1.radius);
-    radial->A = (radial->cdx * radial->cdx
-                + radial->cdy * radial->cdy
-                - radial->dr  * radial->dr);
-
-    return image;
-}
-
-PIXMAN_EXPORT pixman_image_t *
 pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
                                      pixman_fixed_t angle,
                                      const pixman_gradient_stop_t *stops,
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
new file mode 100644 (file)
index 0000000..b1e617d
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2000 SuSE, Inc.
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  SuSE makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include "pixman-private.h"
+
+PIXMAN_EXPORT pixman_image_t *
+pixman_image_create_radial_gradient (pixman_point_fixed_t         *inner,
+                                    pixman_point_fixed_t         *outer,
+                                    pixman_fixed_t                inner_radius,
+                                    pixman_fixed_t                outer_radius,
+                                    const pixman_gradient_stop_t *stops,
+                                    int                           n_stops)
+{
+    pixman_image_t *image;
+    radial_gradient_t *radial;
+
+    return_val_if_fail (n_stops >= 2, NULL);
+
+    image = _pixman_image_allocate();
+
+    if (!image)
+       return NULL;
+
+    radial = &image->radial;
+
+    if (!_pixman_init_gradient (&radial->common, stops, n_stops))
+    {
+       free (image);
+       return NULL;
+    }
+
+    image->type = RADIAL;
+
+    radial->c1.x = inner->x;
+    radial->c1.y = inner->y;
+    radial->c1.radius = inner_radius;
+    radial->c2.x = outer->x;
+    radial->c2.y = outer->y;
+    radial->c2.radius = outer_radius;
+    radial->cdx = pixman_fixed_to_double (radial->c2.x - radial->c1.x);
+    radial->cdy = pixman_fixed_to_double (radial->c2.y - radial->c1.y);
+    radial->dr = pixman_fixed_to_double (radial->c2.radius - radial->c1.radius);
+    radial->A = (radial->cdx * radial->cdx
+                + radial->cdy * radial->cdy
+                - radial->dr  * radial->dr);
+
+    return image;
+}
+