1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/quartz-first-stop.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c 1.5 +--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c 1.6 ++++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c 1.7 +@@ -690,31 +690,51 @@ ComputeGradientValue (void *info, const 1.8 + } 1.9 + 1.10 + static const float gradient_output_value_ranges[8] = { 1.11 + 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f 1.12 + }; 1.13 + static const CGFunctionCallbacks gradient_callbacks = { 1.14 + 0, ComputeGradientValue, (CGFunctionReleaseInfoCallback) cairo_pattern_destroy 1.15 + }; 1.16 ++/* Quartz will clamp input values to the input range. 1.17 ++ 1.18 ++ Our stops are all in the range 0.0 to 1.0. However, the color before the 1.19 ++ beginning of the gradient line is obtained by Quartz computing a negative 1.20 ++ position on the gradient line, clamping it to the input range we specified 1.21 ++ for our color function, and then calling our color function (actually it 1.22 ++ pre-samples the color function into an array, but that doesn't matter just 1.23 ++ here). Therefore if we set the lower bound to 0.0, a negative position 1.24 ++ on the gradient line will pass 0.0 to ComputeGradientValue, which will 1.25 ++ select the last color stop with position 0, although it should select 1.26 ++ the first color stop (this matters when there are multiple color stops with 1.27 ++ position 0). 1.28 ++ 1.29 ++ Therefore we pass a small negative number as the lower bound of the input 1.30 ++ range, so this value gets passed into ComputeGradientValue, which will 1.31 ++ return the color of the first stop. The number should be small because 1.32 ++ as far as I can tell, Quartz pre-samples the entire input range of the color 1.33 ++ function into an array of fixed size, so if the input range is larger 1.34 ++ than needed, the resolution of the gradient will be unnecessarily low. 1.35 ++*/ 1.36 ++static const float nonrepeating_gradient_input_value_range[2] = { -0.001f, 1.f }; 1.37 + 1.38 + static CGFunctionRef 1.39 + CreateGradientFunction (const cairo_gradient_pattern_t *gpat) 1.40 + { 1.41 + cairo_pattern_t *pat; 1.42 +- float input_value_range[2] = { 0.f, 1.f }; 1.43 + 1.44 + if (_cairo_pattern_create_copy (&pat, &gpat->base)) 1.45 + /* quartz doesn't deal very well with malloc failing, so there's 1.46 + * not much point in us trying either */ 1.47 + return NULL; 1.48 + 1.49 + return CGFunctionCreate (pat, 1.50 + 1, 1.51 +- input_value_range, 1.52 ++ nonrepeating_gradient_input_value_range, 1.53 + 4, 1.54 + gradient_output_value_ranges, 1.55 + &gradient_callbacks); 1.56 + } 1.57 + 1.58 + static void 1.59 + UpdateLinearParametersToIncludePoint(double *min_t, double *max_t, CGPoint *start, 1.60 + double dx, double dy,