diff options
-rw-r--r-- | src/cairo-quartz-surface.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index 5a5a791b..8fbb6709 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -794,15 +794,18 @@ ComputeGradientValue (void *info, } } +static const cairo_quartz_float_t gradient_output_value_ranges[8] = { + 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f +}; +static const CGFunctionCallbacks gradient_callbacks = { + 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy +}; + static CGFunctionRef CreateGradientFunction (const cairo_gradient_pattern_t *gpat) { cairo_pattern_t *pat; cairo_quartz_float_t input_value_range[2] = { 0.f, 1.f }; - cairo_quartz_float_t output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f }; - CGFunctionCallbacks callbacks = { - 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy - }; if (_cairo_pattern_create_copy (&pat, &gpat->base)) /* quartz doesn't deal very well with malloc failing, so there's @@ -813,8 +816,8 @@ CreateGradientFunction (const cairo_gradient_pattern_t *gpat) 1, input_value_range, 4, - output_value_ranges, - &callbacks); + gradient_output_value_ranges, + &gradient_callbacks); } static CGFunctionRef @@ -825,10 +828,6 @@ CreateRepeatingLinearGradientFunction (cairo_quartz_surface_t *surface, { cairo_pattern_t *pat; cairo_quartz_float_t input_value_range[2]; - cairo_quartz_float_t output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f }; - CGFunctionCallbacks callbacks = { - 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy - }; CGPoint mstart, mend; @@ -897,8 +896,8 @@ CreateRepeatingLinearGradientFunction (cairo_quartz_surface_t *surface, 1, input_value_range, 4, - output_value_ranges, - &callbacks); + gradient_output_value_ranges, + &gradient_callbacks); } static void @@ -957,10 +956,6 @@ CreateRepeatingRadialGradientFunction (cairo_quartz_surface_t *surface, CGAffineTransform transform; cairo_pattern_t *pat; float input_value_range[2]; - float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f }; - CGFunctionCallbacks callbacks = { - 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy - }; CGPoint *inner; double *inner_radius; CGPoint *outer; @@ -1037,8 +1032,8 @@ CreateRepeatingRadialGradientFunction (cairo_quartz_surface_t *surface, 1, input_value_range, 4, - output_value_ranges, - &callbacks); + gradient_output_value_ranges, + &gradient_callbacks); } /* Obtain a CGImageRef from a #cairo_surface_t * */ |