// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
-#include <dali/devel-api/object/handle-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
namespace
{
-const char * const COLOR_NAME("borderColor");
-const char * const SIZE_NAME("borderSize");
-const char * const ANTI_ALIASING("antiAliasing");
-
const char * const POSITION_ATTRIBUTE_NAME("aPosition");
const char * const DRIFT_ATTRIBUTE_NAME("aDrift");
const char * const INDEX_NAME("indices");
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
attribute mediump vec2 aDrift;\n
- uniform mediump mat4 uMvpMatrix;\n
+ uniform highp mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
uniform mediump float borderSize;\n
\n
uniform lowp vec4 uColor;\n
uniform lowp vec4 borderColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
\n
void main()\n
{\n
- gl_FragColor = vec4(mixColor, opacity)*borderColor*uColor;\n
+ gl_FragColor = vec4(mixColor, 1.0)*borderColor*uColor;\n
}\n
);
const char* VERTEX_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
attribute mediump vec2 aDrift;\n
- uniform mediump mat4 uMvpMatrix;\n
+ uniform highp mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
uniform mediump float borderSize;\n
varying mediump float vAlpha;\n
uniform lowp vec4 uColor;\n
uniform lowp vec4 borderColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform mediump float borderSize;\n
varying mediump float vAlpha;\n
\n
void main()\n
{\n
- gl_FragColor = vec4(mixColor, opacity)*borderColor*uColor;\n
+ gl_FragColor = vec4(mixColor, 1.0)*borderColor*uColor;\n
gl_FragColor.a *= smoothstep(0.0, 1.5, vAlpha)*smoothstep( borderSize+1.5, borderSize, vAlpha );\n
}\n
);
}
BorderVisual::BorderVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache, Visual::FittingMode::FILL ),
+: Visual::Base( factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::BORDER ),
mBorderColor( Color::TRANSPARENT ),
mBorderSize( 0.f ),
mBorderColorIndex( Property::INVALID_INDEX ),
}
}
-void BorderVisual::DoSetOnStage( Actor& actor )
+void BorderVisual::DoSetOnScene( Actor& actor )
{
InitializeRenderer();
- mBorderColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor );
+ mBorderColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor );
if( mBorderColor.a < 1.f || mAntiAliasing)
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
- mBorderSizeIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize );
+ mBorderSizeIndex = mImpl->mRenderer.RegisterProperty( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize );
actor.AddRenderer( mImpl->mRenderer );
mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
-void BorderVisual::SetBorderColor(const Vector4& color)
-{
- mBorderColor = color;
-
- if( mImpl->mRenderer )
- {
- (mImpl->mRenderer).SetProperty( mBorderColorIndex, color );
- if( color.a < 1.f )
- {
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
- }
- }
-}
-
-void BorderVisual::SetBorderSize( float size )
-{
- mBorderSize = size;
-
- if( mImpl->mRenderer )
- {
- (mImpl->mRenderer).SetProperty( mBorderSizeIndex, size );
- }
-}
-
-void BorderVisual::RequireAntiAliasing( bool antiAliasing )
-{
- if( mAntiAliasing != antiAliasing )
- {
- mAntiAliasing = antiAliasing;
- if( mImpl->mRenderer )
- {
- Shader borderShader( GetBorderShader() );
- mImpl->mRenderer.SetShader( borderShader );
- if( mAntiAliasing )
- {
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
- }
- }
- }
-}
-
Shader BorderVisual::GetBorderShader()
{
Shader shader;