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=0bba311d8012508804f457bc1a441a74a4e03310;hp=e83d4630e3385268051bd3d97873034405056d77;hb=f4b327350bf7873847f8f08bb27d11361f60f759;hpb=8cd8392e5982d60111b0a2a5d33457c06e8532f5 diff --git a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag index e83d463..0bba311 100644 --- a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag @@ -150,19 +150,22 @@ 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; + BorderlineColorRGB *= mix(1.0, borderlineColor.a, preMultipliedAlpha); 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(BorderlineColorRGB, 1.0), borderlineOpacity); } - return mix(textureColor, vec4(borderlineColor.xyz, 1.0), borderlineOpacity); + return mix(textureColor, borderlineColor, borderlineOpacity); } #endif @@ -177,8 +180,8 @@ mediump float calculateCornerOpacity() // calculate borderline opacity by potential if(potential > gMaxOutlinePotential) { - // potential is out of borderline range - opacity = 0.0; + // potential is out of borderline range. just discard here + discard; } else if(potential > gMinOutlinePotential) { @@ -199,13 +202,13 @@ void main() mediump vec2 texCoord = vTexCoord; #endif - lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 ); + lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 ); #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; + OUT_COLOR = textureColor * uColor; return; } PreprocessPotential(); @@ -214,7 +217,7 @@ void main() #if IS_REQUIRED_BORDERLINE textureColor = convertBorderlineColor(textureColor); #endif - OUT_COLOR = textureColor; + OUT_COLOR = textureColor * uColor; #if IS_REQUIRED_ROUNDED_CORNER mediump float opacity = calculateCornerOpacity();