summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert O'Callahan <robert@ocallahan.org>2010-05-11 13:59:43 -0400
committerJeff Muizelaar <jmuizelaar@mozilla.com>2010-05-11 13:59:43 -0400
commit7b4e63d5b8bda8e9ea1f6455d779070f64f07f6f (patch)
treeca17ac980e9805c2eb863f5b27228e767a0113bd
parent8302952dcff20a1d2de194152ace810c7056f994 (diff)
Clean up Quartz gradient code by moving some local variables to static const globals.
From https://bugzilla.mozilla.org/show_bug.cgi?id=508730
-rw-r--r--src/cairo-quartz-surface.c31
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 * */