Use cairo_extend_t directly

parent acce1f68
......@@ -136,11 +136,7 @@ _set_source_rsvg_linear_gradient (RsvgDrawingCtx * ctx,
}
cairo_matrix_invert (&matrix);
cairo_pattern_set_matrix (pattern, &matrix);
if (linear->spread == RSVG_GRADIENT_REFLECT)
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REFLECT);
else if (linear->spread == RSVG_GRADIENT_REPEAT)
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_pattern_set_extend (pattern, linear->spread);
_pattern_add_rsvg_color_stops (pattern, linear->super.children, current_color_rgb, opacity);
......@@ -187,11 +183,7 @@ _set_source_rsvg_radial_gradient (RsvgDrawingCtx * ctx,
cairo_matrix_invert (&matrix);
cairo_pattern_set_matrix (pattern, &matrix);
if (radial->spread == RSVG_GRADIENT_REFLECT)
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REFLECT);
else if (radial->spread == RSVG_GRADIENT_REPEAT)
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_pattern_set_extend (pattern, radial->spread);
_pattern_add_rsvg_color_stops (pattern, radial->super.children, current_color_rgb, opacity);
......
......@@ -258,11 +258,11 @@ rsvg_linear_gradient_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBa
}
if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
if (!strcmp (value, "pad")) {
grad->spread = RSVG_GRADIENT_PAD;
grad->spread = CAIRO_EXTEND_PAD;
} else if (!strcmp (value, "reflect")) {
grad->spread = RSVG_GRADIENT_REFLECT;
grad->spread = CAIRO_EXTEND_REFLECT;
} else if (!strcmp (value, "repeat")) {
grad->spread = RSVG_GRADIENT_REPEAT;
grad->spread = CAIRO_EXTEND_REPEAT;
}
grad->hasspread = TRUE;
}
......@@ -300,7 +300,7 @@ rsvg_new_linear_gradient (void)
grad->x2 = _rsvg_css_parse_length ("1");
grad->fallback = NULL;
grad->obj_bbox = TRUE;
grad->spread = RSVG_GRADIENT_PAD;
grad->spread = CAIRO_EXTEND_PAD;
grad->super.set_atts = rsvg_linear_gradient_set_atts;
grad->hasx1 = grad->hasy1 = grad->hasx2 = grad->hasy2 = grad->hasbbox = grad->hasspread =
grad->hastransform = FALSE;
......@@ -353,11 +353,11 @@ rsvg_radial_gradient_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBa
}
if ((value = rsvg_property_bag_lookup (atts, "spreadMethod"))) {
if (!strcmp (value, "pad"))
grad->spread = RSVG_GRADIENT_PAD;
grad->spread = CAIRO_EXTEND_PAD;
else if (!strcmp (value, "reflect"))
grad->spread = RSVG_GRADIENT_REFLECT;
grad->spread = CAIRO_EXTEND_REFLECT;
else if (!strcmp (value, "repeat"))
grad->spread = RSVG_GRADIENT_REPEAT;
grad->spread = CAIRO_EXTEND_REPEAT;
grad->hasspread = TRUE;
}
if ((value = rsvg_property_bag_lookup (atts, "gradientUnits"))) {
......@@ -380,7 +380,7 @@ rsvg_new_radial_gradient (void)
_rsvg_affine_identity (grad->affine);
grad->has_current_color = FALSE;
grad->obj_bbox = TRUE;
grad->spread = RSVG_GRADIENT_PAD;
grad->spread = CAIRO_EXTEND_PAD;
grad->fallback = NULL;
grad->cx = grad->cy = grad->r = grad->fx = grad->fy = _rsvg_css_parse_length ("0.5");
grad->super.set_atts = rsvg_radial_gradient_set_atts;
......
......@@ -28,6 +28,7 @@
#define RSVG_PAINT_SERVER_H
#include <glib.h>
#include <cairo.h>
#include "rsvg-defs.h"
G_BEGIN_DECLS
......@@ -43,12 +44,6 @@ typedef struct _RsvgPaintServer RsvgPaintServer;
typedef struct _RsvgPSCtx RsvgPSCtx;
typedef enum {
RSVG_GRADIENT_PAD,
RSVG_GRADIENT_REFLECT,
RSVG_GRADIENT_REPEAT
} RsvgGradientSpread;
struct _RsvgGradientStop {
RsvgNode super;
double offset;
......@@ -59,7 +54,7 @@ struct _RsvgLinearGradient {
RsvgNode super;
gboolean obj_bbox;
double affine[6]; /* user space to actual at time of gradient def */
RsvgGradientSpread spread;
cairo_extend_t spread;
RsvgLength x1, y1, x2, y2;
guint32 current_color;
gboolean has_current_color;
......@@ -77,7 +72,7 @@ struct _RsvgRadialGradient {
RsvgNode super;
gboolean obj_bbox;
double affine[6]; /* user space to actual at time of gradient def */
RsvgGradientSpread spread;
cairo_extend_t spread;
RsvgLength cx, cy, r, fx, fy;
guint32 current_color;
gboolean has_current_color;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment