From ebc4a4df9c92934891d202ae2603216a046ec939 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Tue, 23 Jun 2009 14:55:36 -0400 Subject: [PATCH] Remove support for component alpha with HSL blend modes. It isn't clear that component alpha makes sense with HSL blend modes. --- pixman/make-combine.pl | 2 +- pixman/pixman-combine.c.template | 123 ++++++++++++--------------------------- 2 files changed, 38 insertions(+), 87 deletions(-) diff --git a/pixman/make-combine.pl b/pixman/make-combine.pl index 3b75362..3eb3d35 100644 --- a/pixman/make-combine.pl +++ b/pixman/make-combine.pl @@ -27,7 +27,7 @@ print "/* WARNING: This file is generated by combine.pl from combine.inc.\n"; print " Please edit one of those files rather than this one. */\n"; print "\n"; -print "#line 1 \"combine.inc\"\n"; +print "#line 1 \"pixman-combine.c.template\"\n"; $mask_ = mask($mask); $one_half_ = mask($one_half); diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template index ee724d9..53edba0 100644 --- a/pixman/pixman-combine.c.template +++ b/pixman/pixman-combine.c.template @@ -779,89 +779,39 @@ PdfSeparableBlendMode (Exclusion) #define Lum(c) ((c[0] * 30 + c[1] * 59 + c[2] * 11) / 100) #define Sat(c) (Max (c) - Min (c)) -#define PdfNonSeparableBlendMode(name) \ -static void \ -fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \ +#define PdfNonSeparableBlendMode(name) \ +static void \ +fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \ -{ \ - int i; \ - for (i = 0; i < width; ++i) { \ - comp4_t s = combineMask (src, mask, i); \ - comp4_t d = *(dest + i); \ - comp1_t sa = Alpha(s); \ - comp1_t isa = ~sa; \ - comp1_t da = Alpha(d); \ - comp1_t ida = ~da; \ - comp4_t result; \ - comp4_t sc[3], dc[3], c[3]; \ - \ - result = d; \ - FbByteAddMul(result, isa, s, ida); \ - dc[0] = Red (d); \ - sc[0] = Red (s); \ - dc[1] = Green (d); \ - sc[1] = Green (s); \ - dc[2] = Blue (d); \ - sc[2] = Blue (s); \ - Blend ## name (c, dc, da, sc, sa); \ - \ - *(dest + i) = result + \ - (DivOne (sa * da) << A_SHIFT) + \ - (DivOne (c[0]) << R_SHIFT) + \ - (DivOne (c[1]) << G_SHIFT) + \ - (DivOne (c[2])); \ - } \ -} \ - \ -static void \ -fbCombine ## name ## C (pixman_implementation_t *imp, pixman_op_t op, \ - comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \ -{ \ - int i; \ - for (i = 0; i < width; ++i) { \ - comp4_t m = *(mask + i); \ - comp4_t s = *(src + i); \ - comp4_t d = *(dest + i); \ - comp1_t sa = Alpha(s); \ - comp1_t da = Alpha(d); \ - comp1_t ida = ~da; \ - comp4_t result; \ - \ - if (m == 0) \ - continue; \ - \ - if (m == ~0) \ - { \ - comp4_t sc[3], dc[3], c[3]; \ - \ - result = d; \ - dc[0] = Red (d); \ - sc[0] = Red (s); \ - dc[1] = Green (d); \ - sc[1] = Green (s); \ - dc[2] = Blue (d); \ - sc[2] = Blue (s); \ - Blend ## name (c, dc, da, sc, sa); \ - result = \ - (DivOne (sa * da) << A_SHIFT) + \ - (DivOne (c[0]) << R_SHIFT) + \ - (DivOne (c[1]) << G_SHIFT) + \ - (DivOne (c[2])); \ - fbCombineMaskValueC (&result, &m); \ - fbCombineMaskC (&s, &m); \ - FbByteMul (s, ida); \ - m = ~m; \ - FbByteMulAddC(d, m, s); \ - result += d; \ - } else { \ - result = s; \ - fbCombineMaskValueC (&result, &m); \ - } \ - \ - *(dest + i) = result; \ - } \ -} - +{ \ + int i; \ + for (i = 0; i < width; ++i) { \ + comp4_t s = combineMask (src, mask, i); \ + comp4_t d = *(dest + i); \ + comp1_t sa = Alpha(s); \ + comp1_t isa = ~sa; \ + comp1_t da = Alpha(d); \ + comp1_t ida = ~da; \ + comp4_t result; \ + comp4_t sc[3], dc[3], c[3]; \ + \ + result = d; \ + FbByteAddMul(result, isa, s, ida); \ + dc[0] = Red (d); \ + sc[0] = Red (s); \ + dc[1] = Green (d); \ + sc[1] = Green (s); \ + dc[2] = Blue (d); \ + sc[2] = Blue (s); \ + Blend ## name (c, dc, da, sc, sa); \ + \ + *(dest + i) = result + \ + (DivOne (sa * da) << A_SHIFT) + \ + (DivOne (c[0]) << R_SHIFT) + \ + (DivOne (c[1]) << G_SHIFT) + \ + (DivOne (c[2])); \ + } \ +} static void SetLum (comp4_t dest[3], comp4_t src[3], comp4_t sa, comp4_t lum) @@ -2056,10 +2006,11 @@ _pixman_setup_combiner_functions_width (pixman_implementation_t *imp) imp->combine_width_ca[PIXMAN_OP_SOFT_LIGHT] = fbCombineSoftLightC; imp->combine_width_ca[PIXMAN_OP_DIFFERENCE] = fbCombineDifferenceC; imp->combine_width_ca[PIXMAN_OP_EXCLUSION] = fbCombineExclusionC; - imp->combine_width_ca[PIXMAN_OP_HSL_HUE] = fbCombineHSLHueC; - imp->combine_width_ca[PIXMAN_OP_HSL_SATURATION] = fbCombineHSLSaturationC; - imp->combine_width_ca[PIXMAN_OP_HSL_COLOR] = fbCombineHSLColorC; - imp->combine_width_ca[PIXMAN_OP_HSL_LUMINOSITY] = fbCombineHSLLuminosityC; + /* It is not clear that these make sense, so leave them out for now */ + imp->combine_width_ca[PIXMAN_OP_HSL_HUE] = NULL; + imp->combine_width_ca[PIXMAN_OP_HSL_SATURATION] = NULL; + imp->combine_width_ca[PIXMAN_OP_HSL_COLOR] = NULL; + imp->combine_width_ca[PIXMAN_OP_HSL_LUMINOSITY] = NULL; } -- 2.7.4