X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fgraphics%2Fshaders%2Fimage-visual-shader.frag;h=676c02bdefbb731f6bff31456bab9510d9a0d57c;hp=8553dddc6492a0695d219ed600fbaff80d36adcb;hb=48220839bdcedaca9d53cbd15aab66353187c14b;hpb=54ebf57f38895e071ebb15a0371cb3c723f7db9d diff --git a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag index 8553ddd..676c02b 100644 --- a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag @@ -36,6 +36,7 @@ uniform lowp float preMultipliedAlpha; uniform mediump float borderlineWidth; uniform mediump float borderlineOffset; uniform lowp vec4 borderlineColor; +uniform lowp vec4 uActorColor; #endif #if ATLAS_CUSTOM_WARP @@ -144,6 +145,10 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor) borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential); } + lowp vec3 BorderlineColorRGB = borderlineColor.rgb * uActorColor.rgb; + lowp float BorderlineColorAlpha = borderlineColor.a * uActorColor.a; + BorderlineColorRGB *= mix(1.0, BorderlineColorAlpha, preMultipliedAlpha); + //calculate inside of borderline when outilneColor.a < 1.0 if(borderlineColor.a < 1.0) { @@ -153,18 +158,18 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor) 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)); } - + // TODO : need to fix here when uColor.a = 0.0 and uActorColor.a != 0 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); + return mix(textureColor, vec4(BorderlineColorRGB, BorderlineColorAlpha), borderlineOpacity); } #endif @@ -201,13 +206,13 @@ void main() mediump vec2 texCoord = vTexCoord; #endif - lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 ); + lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 ) * uColor; #if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE // skip most potential calculate for performance if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y) { - OUT_COLOR = textureColor * uColor; + OUT_COLOR = textureColor; return; } PreprocessPotential(); @@ -216,7 +221,7 @@ void main() #if IS_REQUIRED_BORDERLINE textureColor = convertBorderlineColor(textureColor); #endif - OUT_COLOR = textureColor * uColor; + OUT_COLOR = textureColor; #if IS_REQUIRED_ROUNDED_CORNER mediump float opacity = calculateCornerOpacity();