gl-renderer: move undo-premult to color_pipeline()
Now that we have the if-else ladder to call color_pipeline() only when necessary, and since only color_pipeline() needs undo-premult, move undo-premult into color_pipeline(). This is a small step towards improving code readability. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
924b94bc94
commit
932c374779
@ -249,6 +249,14 @@ color_mapping(vec3 color)
|
|||||||
vec4
|
vec4
|
||||||
color_pipeline(vec4 color)
|
color_pipeline(vec4 color)
|
||||||
{
|
{
|
||||||
|
/* Ensure straight alpha */
|
||||||
|
if (c_input_is_premult) {
|
||||||
|
if (color.a == 0.0)
|
||||||
|
color.rgb = vec3(0, 0, 0);
|
||||||
|
else
|
||||||
|
color.rgb *= 1.0 / color.a;
|
||||||
|
}
|
||||||
|
|
||||||
color.rgb = color_pre_curve(color.rgb);
|
color.rgb = color_pre_curve(color.rgb);
|
||||||
color.rgb = color_mapping(color.rgb);
|
color.rgb = color_mapping(color.rgb);
|
||||||
|
|
||||||
@ -264,15 +272,7 @@ main()
|
|||||||
color = sample_input_texture();
|
color = sample_input_texture();
|
||||||
|
|
||||||
if (c_need_color_pipeline) {
|
if (c_need_color_pipeline) {
|
||||||
/* Ensure straight alpha */
|
color = color_pipeline(color); /* Produces straight alpha */
|
||||||
if (c_input_is_premult) {
|
|
||||||
if (color.a == 0.0)
|
|
||||||
color.rgb = vec3(0, 0, 0);
|
|
||||||
else
|
|
||||||
color.rgb *= 1.0 / color.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
color = color_pipeline(color);
|
|
||||||
|
|
||||||
color.a *= view_alpha;
|
color.a *= view_alpha;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user