gfx/cairo/quartz-const-globals.patch

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial