diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-05-21 15:49:14 -0400 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2010-12-13 17:22:35 +0100 |
commit | 969fec9d469f9d30bc6f36db2640da9a98f48175 (patch) | |
tree | 1e87d43285e300cd07462853a0738bc3664ac48a | |
parent | 67a34ccc4827997a63fd3585ce3b7afffdac80f3 (diff) |
Fix comment formatting. Use x >= a in clip_color, not x >= 1.0
-rw-r--r-- | pixman/pixman-combine-float.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/pixman/pixman-combine-float.c b/pixman/pixman-combine-float.c index 2945de6..c6dd8f2 100644 --- a/pixman/pixman-combine-float.c +++ b/pixman/pixman-combine-float.c @@ -434,9 +434,9 @@ MAKE_SEPARABLE_PDF_COMBINERS (exclusion) /* * PDF nonseperable blend modes. * - * These are implemented using the following functions to operate in Hsl space, - * with Cmax, Cmid, Cmin referring to the max, mid and min value of the red, green - * and blue components. + * These are implemented using the following functions to operate in Hsl + * space, with Cmax, Cmid, Cmin referring to the max, mid and min value + * of the red, green and blue components. * * LUM (C) = 0.3 × Cred + 0.59 × Cgreen + 0.11 × Cblue * @@ -445,9 +445,9 @@ MAKE_SEPARABLE_PDF_COMBINERS (exclusion) * min = Cmin * max = Cmax * if n < 0.0 - * C = l + ( ( ( C – l ) × l ) ⁄ ( l – min ) ) + * C = l + (((C – l) × l) ⁄ (l – min)) * if x > 1.0 - * C = l + ( ( ( C – l ) × ( 1 – l ) ) ⁄ ( max – l ) ) + * C = l + (((C – l) × (1 – l)) (max – l)) * return C * * set_lum (C, l): @@ -470,7 +470,7 @@ MAKE_SEPARABLE_PDF_COMBINERS (exclusion) /* For premultiplied colors, we need to know what happens when C is * multiplied by a real number. LUM and SAT are linear: * - * LUM (r × C) = r × LUM (C) SAT (r * C) = r * SAT (C) + * LUM (r × C) = r × LUM (C) SAT (r × C) = r × SAT (C) * * If we extend clip_color with an extra argument a and change * @@ -482,33 +482,34 @@ MAKE_SEPARABLE_PDF_COMBINERS (exclusion) * * then clip_color is also linear: * - * r * clip_color (C, a) = clip_color (r_c, ra); + * r * clip_color (C, a) = clip_color (r_c, ra); * * for positive r. * * Similarly, we can extend set_lum with an extra argument that is just passed * on to clip_color: * - * r * set_lum ( C, l, a) + * r × set_lum ( C, l, a) * * = r × clip_color ( C + l - LUM (C), a) * - * = clip_color ( r * C + r × l - r * LUM (C), r * a) + * = clip_color ( r * C + r × l - LUM (r × C), r * a) * * = set_lum ( r * C, r * l, r * a) * * Finally, set_sat: * - * r * set_sat (C, s) = set_sat (x * C, r * s) + * r * set_sat (C, s) = set_sat (x * C, r * s) * - * The above holds for all non-zero x, because they x'es in the fraction for + * The above holds for all non-zero x because they x'es in the fraction for * C_mid cancel out. Specifically, it holds for x = r: * - * r * set_sat (C, s) = set_sat (r_c, rs) + * r * set_sat (C, s) = set_sat (r_c, rs) * - */ - -/* So, for the non-separable PDF blend modes, we have (using s, d for + * + * + * + * So, for the non-separable PDF blend modes, we have (using s, d for * non-premultiplied colors, and S, D for premultiplied: * * Color: @@ -537,8 +538,7 @@ MAKE_SEPARABLE_PDF_COMBINERS (exclusion) * * a_s * a_d * B(s, d) * = a_s * a_d * set_lum (set_sat (S/a_s, SAT (D/a_d)), LUM (D/a_d), 1) - * = a_s * a_d * set_lum (set_sat (a_d * S, a_s * SAT (D)), - * a_s * LUM (D), a_s * a_d) + * = set_lum (set_sat (a_d * S, a_s * SAT (D)), a_s * LUM (D), a_s * a_d) * */ @@ -598,7 +598,7 @@ clip_color (rgb_t *color, float a) color->g = l + (((color->g - l) * l) / (l - n)); color->b = l + (((color->b - l) * l) / (l - n)); } - if (x > 1.0) + if (x > a) { color->r = l + (((color->r - l) * (1 - l) / (x - l))); color->g = l + (((color->g - l) * (1 - l) / (x - l))); |