1 2out vec4 sk_FragColor; 3uniform vec4 color; 4vec3 _blend_set_color_luminance_h3h3hh3(vec3 hueSatColor, float alpha, vec3 lumColor) { 5 float lum = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); 6 vec3 result = (lum - dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor)) + hueSatColor; 7 float minComp = min(min(result.x, result.y), result.z); 8 float maxComp = max(max(result.x, result.y), result.z); 9 if (minComp < 0.0 && lum != minComp) { 10 result = lum + (result - lum) * (lum / (lum - minComp)); 11 } 12 if (maxComp > alpha && maxComp != lum) { 13 return lum + ((result - lum) * (alpha - lum)) / (maxComp - lum); 14 } else { 15 return result; 16 } 17} 18vec3 _blend_set_color_saturation_helper_h3h3h(vec3 minMidMax, float sat) { 19 if (minMidMax.x < minMidMax.z) { 20 return vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat); 21 } else { 22 return vec3(0.0); 23 } 24} 25vec3 _blend_set_color_saturation_h3h3h3(vec3 hueLumColor, vec3 satColor) { 26 float sat = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); 27 if (hueLumColor.x <= hueLumColor.y) { 28 if (hueLumColor.y <= hueLumColor.z) { 29 return _blend_set_color_saturation_helper_h3h3h(hueLumColor, sat); 30 } else if (hueLumColor.x <= hueLumColor.z) { 31 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.xzy, sat).xzy; 32 } else { 33 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.zxy, sat).yzx; 34 } 35 } else if (hueLumColor.x <= hueLumColor.z) { 36 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.yxz, sat).yxz; 37 } else if (hueLumColor.y <= hueLumColor.z) { 38 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.yzx, sat).zxy; 39 } else { 40 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.zyx, sat).zyx; 41 } 42} 43vec4 blend_hue_h4h4h4(vec4 src, vec4 dst) { 44 float alpha = dst.w * src.w; 45 vec3 sda = src.xyz * dst.w; 46 vec3 dsa = dst.xyz * src.w; 47 return vec4((((_blend_set_color_luminance_h3h3hh3(_blend_set_color_saturation_h3h3h3(sda, dsa), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); 48} 49void main() { 50 float _1_c = color.x * color.y + color.z; 51 sk_FragColor = vec4(_1_c); 52 sk_FragColor *= 1.25; 53 sk_FragColor *= color.xxyy * color.w; 54 sk_FragColor *= color.zzww * color.y; 55 sk_FragColor *= blend_hue_h4h4h4(color, color.wwww); 56 sk_FragColor *= blend_hue_h4h4h4(color, color.wzyx); 57} 58