mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-03-15 02:10:47 +01:00
Clean up Quartz gradient code by moving some local variables to static const globals.
From https://bugzilla.mozilla.org/show_bug.cgi?id=508730
This commit is contained in:
parent
8302952dcf
commit
7b4e63d5b8
1 changed files with 13 additions and 18 deletions
|
|
@ -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 * */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue