From 7c744c0ecb31b40289251e91fec97f7c0f45846f Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 8 Sep 2021 18:02:41 +0900 Subject: [PATCH] Fix gradient shader + Remove comment about BorderlineColor gradient visual enable preMultipliedAlpha option in default. Previous version of shader doesn't apply this information so we fix it. + Remove some comments about relationship between MixColor.alpha and BorderlineColor ready for ACR Change-Id: I175e70f670df0aefae0de7906bc0c6c0ad7a2c32 Signed-off-by: Eunki, Hong --- dali-toolkit/devel-api/visuals/visual-properties-devel.h | 1 - dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/devel-api/visuals/visual-properties-devel.h b/dali-toolkit/devel-api/visuals/visual-properties-devel.h index 0042451..679a31f 100644 --- a/dali-toolkit/devel-api/visuals/visual-properties-devel.h +++ b/dali-toolkit/devel-api/visuals/visual-properties-devel.h @@ -108,7 +108,6 @@ enum Type * @brief The color for the borderline of the visual. * @details Name "borderlineColor", type Property::VECTOR4, animatable * @note Default value is Color::BLACK. - * @note This color is affected by opacity. */ BORDERLINE_COLOR = OPACITY + 5, diff --git a/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag index f859a24..cb72c67 100644 --- a/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag @@ -128,18 +128,19 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor) mediump float tCornerRadius = -gCenterPosition; mediump float MaxTexturelinePotential = tCornerRadius + gPotentialRange; mediump float MinTexturelinePotential = tCornerRadius - gPotentialRange; + lowp vec3 BorderlineColorRGB = borderlineColor.xyz * borderlineColor.a; if(potential > MaxTexturelinePotential) { // potential is out of texture range. use borderline color instead of texture - textureColor = vec4(borderlineColor.xyz, 0.0); + textureColor = vec4(BorderlineColorRGB, 0.0); } else if(potential > MinTexturelinePotential) { // potential is in texture range - textureColor = mix(textureColor, vec4(borderlineColor.xyz, 0.0), smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential)); + textureColor = mix(textureColor, vec4(BorderlineColorRGB, 0.0), smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential)); } borderlineOpacity *= borderlineColor.a; - return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity); + return mix(textureColor, vec4(BorderlineColorRGB, 1.0), borderlineOpacity); } return mix(textureColor, borderlineColor, borderlineOpacity); } -- 2.7.4