gfx/cairo/quartz-const-globals.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/quartz-const-globals.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,134 @@
     1.4 +# HG changeset patch
     1.5 +# User Robert O'Callahan <robert@ocallahan.org>
     1.6 +# Date 1249558626 -43200
     1.7 +# Node ID 963b9451ad305924738d05d997a640698cd3af91
     1.8 +# Parent  e564f3ab4ea6e3b5dd9c4e9e6042d3a84c229dde
     1.9 +Bug 508730. Clean up Quartz gradient code by moving some local variables to static const globals. r=jmuizelaar
    1.10 +
    1.11 +diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    1.12 +--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
    1.13 ++++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    1.14 +@@ -684,51 +684,50 @@ ComputeGradientValue (void *info, const 
    1.15 + 	    grad->stops[i-1].color.blue * ap +
    1.16 + 	    grad->stops[i].color.blue * bp;
    1.17 + 	out[3] =
    1.18 + 	    grad->stops[i-1].color.alpha * ap +
    1.19 + 	    grad->stops[i].color.alpha * bp;
    1.20 +     }
    1.21 + }
    1.22 + 
    1.23 ++static const float gradient_output_value_ranges[8] = {
    1.24 ++    0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f
    1.25 ++};
    1.26 ++static const CGFunctionCallbacks gradient_callbacks = {
    1.27 ++    0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
    1.28 ++};
    1.29 ++
    1.30 + static CGFunctionRef
    1.31 + CreateGradientFunction (const cairo_gradient_pattern_t *gpat)
    1.32 + {
    1.33 +     cairo_pattern_t *pat;
    1.34 +     float input_value_range[2] = { 0.f, 1.f };
    1.35 +-    float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f };
    1.36 +-    CGFunctionCallbacks callbacks = {
    1.37 +-	0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
    1.38 +-    };
    1.39 + 
    1.40 +     if (_cairo_pattern_create_copy (&pat, &gpat->base))
    1.41 + 	/* quartz doesn't deal very well with malloc failing, so there's
    1.42 + 	 * not much point in us trying either */
    1.43 + 	return NULL;
    1.44 + 
    1.45 +     return CGFunctionCreate (pat,
    1.46 + 			     1,
    1.47 + 			     input_value_range,
    1.48 + 			     4,
    1.49 +-			     output_value_ranges,
    1.50 +-			     &callbacks);
    1.51 ++			     gradient_output_value_ranges,
    1.52 ++			     &gradient_callbacks);
    1.53 + }
    1.54 + 
    1.55 + static CGFunctionRef
    1.56 + CreateRepeatingLinearGradientFunction (cairo_quartz_surface_t *surface,
    1.57 + 				       const cairo_gradient_pattern_t *gpat,
    1.58 + 				       CGPoint *start, CGPoint *end,
    1.59 + 				       CGAffineTransform matrix)
    1.60 + {
    1.61 +     cairo_pattern_t *pat;
    1.62 +     float input_value_range[2];
    1.63 +-    float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f };
    1.64 +-    CGFunctionCallbacks callbacks = {
    1.65 +-	0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
    1.66 +-    };
    1.67 + 
    1.68 +     CGPoint mstart, mend;
    1.69 + 
    1.70 +     double dx, dy;
    1.71 +     int x_rep_start = 0, x_rep_end = 0;
    1.72 +     int y_rep_start = 0, y_rep_end = 0;
    1.73 + 
    1.74 +     int rep_start, rep_end;
    1.75 +@@ -787,18 +786,18 @@ CreateRepeatingLinearGradientFunction (c
    1.76 + 	/* quartz doesn't deal very well with malloc failing, so there's
    1.77 + 	 * not much point in us trying either */
    1.78 + 	return NULL;
    1.79 + 
    1.80 +     return CGFunctionCreate (pat,
    1.81 + 			     1,
    1.82 + 			     input_value_range,
    1.83 + 			     4,
    1.84 +-			     output_value_ranges,
    1.85 +-			     &callbacks);
    1.86 ++			     gradient_output_value_ranges,
    1.87 ++			     &gradient_callbacks);
    1.88 + }
    1.89 + 
    1.90 + static void
    1.91 + UpdateRadialParameterToIncludePoint(double *max_t, CGPoint *center,
    1.92 +                                     double dr, double dx, double dy,
    1.93 +                                     double x, double y)
    1.94 + {
    1.95 +     /* Compute a parameter t such that a circle centered at
    1.96 +@@ -847,20 +846,16 @@ CreateRepeatingRadialGradientFunction (c
    1.97 +                                        const cairo_gradient_pattern_t *gpat,
    1.98 +                                        CGPoint *start, double *start_radius,
    1.99 +                                        CGPoint *end, double *end_radius)
   1.100 + {
   1.101 +     CGRect clip = CGContextGetClipBoundingBox (surface->cgContext);
   1.102 +     CGAffineTransform transform;
   1.103 +     cairo_pattern_t *pat;
   1.104 +     float input_value_range[2];
   1.105 +-    float output_value_ranges[8] = { 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f };
   1.106 +-    CGFunctionCallbacks callbacks = {
   1.107 +-        0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy
   1.108 +-    };
   1.109 +     CGPoint *inner;
   1.110 +     double *inner_radius;
   1.111 +     CGPoint *outer;
   1.112 +     double *outer_radius;
   1.113 +     /* minimum and maximum t-parameter values that will make our gradient
   1.114 +        cover the clipBox */
   1.115 +     double t_min, t_max, t_temp;
   1.116 +     /* outer minus inner */
   1.117 +@@ -927,18 +922,18 @@ CreateRepeatingRadialGradientFunction (c
   1.118 +   /* quartz doesn't deal very well with malloc failing, so there's
   1.119 +    * not much point in us trying either */
   1.120 +   return NULL;
   1.121 + 
   1.122 +     return CGFunctionCreate (pat,
   1.123 +            1,
   1.124 +            input_value_range,
   1.125 +            4,
   1.126 +-           output_value_ranges,
   1.127 +-           &callbacks);
   1.128 ++           gradient_output_value_ranges,
   1.129 ++           &gradient_callbacks);
   1.130 + }
   1.131 + 
   1.132 + /* Obtain a CGImageRef from a #cairo_surface_t * */
   1.133 + 
   1.134 + static void
   1.135 + DataProviderReleaseCallback (void *info, const void *data, size_t size)
   1.136 + {
   1.137 +     cairo_surface_t *surface = (cairo_surface_t *) info;

mercurial