Bug 545892 - Always pass WM_NCPAINT events to the default event procedure. r=bent...
[mozilla-central.git] / gfx / cairo / quartz-const-globals.patch
blob8db32270ad90ffdbe5ee78d6be48ff353f9a22f5
1 # HG changeset patch
2 # User Robert O'Callahan <robert@ocallahan.org>
3 # Date 1249558626 -43200
4 # Node ID 963b9451ad305924738d05d997a640698cd3af91
5 # Parent e564f3ab4ea6e3b5dd9c4e9e6042d3a84c229dde
6 Bug 508730. Clean up Quartz gradient code by moving some local variables to static const globals. r=jmuizelaar
8 diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
9 --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
10 +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
11 @@ -684,51 +684,50 @@ ComputeGradientValue (void *info, const
12 grad->stops[i-1].color.blue * ap +
13 grad->stops[i].color.blue * bp;
14 out[3] =
15 grad->stops[i-1].color.alpha * ap +
16 grad->stops[i].color.alpha * bp;
20 +static const float gradient_output_value_ranges[8] = {
21 + 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f
22 +};
23 +static const CGFunctionCallbacks gradient_callbacks = {
24 + 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
25 +};
27 static CGFunctionRef
28 CreateGradientFunction (const cairo_gradient_pattern_t *gpat)
30 cairo_pattern_t *pat;
31 float input_value_range[2] = { 0.f, 1.f };
32 - float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f };
33 - CGFunctionCallbacks callbacks = {
34 - 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
35 - };
37 if (_cairo_pattern_create_copy (&pat, &gpat->base))
38 /* quartz doesn't deal very well with malloc failing, so there's
39 * not much point in us trying either */
40 return NULL;
42 return CGFunctionCreate (pat,
44 input_value_range,
46 - output_value_ranges,
47 - &callbacks);
48 + gradient_output_value_ranges,
49 + &gradient_callbacks);
52 static CGFunctionRef
53 CreateRepeatingLinearGradientFunction (cairo_quartz_surface_t *surface,
54 const cairo_gradient_pattern_t *gpat,
55 CGPoint *start, CGPoint *end,
56 CGAffineTransform matrix)
58 cairo_pattern_t *pat;
59 float input_value_range[2];
60 - float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f };
61 - CGFunctionCallbacks callbacks = {
62 - 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
63 - };
65 CGPoint mstart, mend;
67 double dx, dy;
68 int x_rep_start = 0, x_rep_end = 0;
69 int y_rep_start = 0, y_rep_end = 0;
71 int rep_start, rep_end;
72 @@ -787,18 +786,18 @@ CreateRepeatingLinearGradientFunction (c
73 /* quartz doesn't deal very well with malloc failing, so there's
74 * not much point in us trying either */
75 return NULL;
77 return CGFunctionCreate (pat,
79 input_value_range,
81 - output_value_ranges,
82 - &callbacks);
83 + gradient_output_value_ranges,
84 + &gradient_callbacks);
87 static void
88 UpdateRadialParameterToIncludePoint(double *max_t, CGPoint *center,
89 double dr, double dx, double dy,
90 double x, double y)
92 /* Compute a parameter t such that a circle centered at
93 @@ -847,20 +846,16 @@ CreateRepeatingRadialGradientFunction (c
94 const cairo_gradient_pattern_t *gpat,
95 CGPoint *start, double *start_radius,
96 CGPoint *end, double *end_radius)
98 CGRect clip = CGContextGetClipBoundingBox (surface->cgContext);
99 CGAffineTransform transform;
100 cairo_pattern_t *pat;
101 float input_value_range[2];
102 - float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f };
103 - CGFunctionCallbacks callbacks = {
104 - 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
105 - };
106 CGPoint *inner;
107 double *inner_radius;
108 CGPoint *outer;
109 double *outer_radius;
110 /* minimum and maximum t-parameter values that will make our gradient
111 cover the clipBox */
112 double t_min, t_max, t_temp;
113 /* outer minus inner */
114 @@ -927,18 +922,18 @@ CreateRepeatingRadialGradientFunction (c
115 /* quartz doesn't deal very well with malloc failing, so there's
116 * not much point in us trying either */
117 return NULL;
119 return CGFunctionCreate (pat,
121 input_value_range,
123 - output_value_ranges,
124 - &callbacks);
125 + gradient_output_value_ranges,
126 + &gradient_callbacks);
129 /* Obtain a CGImageRef from a #cairo_surface_t * */
131 static void
132 DataProviderReleaseCallback (void *info, const void *data, size_t size)
134 cairo_surface_t *surface = (cairo_surface_t *) info;