X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fborder%2Fborder-visual.cpp;h=0203a13e6a60b89358d8a84f4baee379a600bfd3;hb=977955345d74e5ed53c8366822fbeae4afc66684;hp=3cb168850bd436b8412353afca9c295238782b03;hpb=1972f043026a3e1bdcaad71c17859a8f324d1e6d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/border/border-visual.cpp b/dali-toolkit/internal/visuals/border/border-visual.cpp index 3cb1688..0203a13 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.cpp +++ b/dali-toolkit/internal/visuals/border/border-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,11 +21,13 @@ // EXTERNAL INCLUDES #include -//INTERNAL INCLUDES +// INTERNAL INCLUDES +#include +#include #include #include #include -#include +#include namespace Dali { @@ -101,8 +103,13 @@ const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER( ); } +BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache ) +{ + return new BorderVisual( factoryCache ); +} + BorderVisual::BorderVisual( VisualFactoryCache& factoryCache ) -: Visual( factoryCache ), +: Visual::Base( factoryCache ), mBorderColor( Color::TRANSPARENT ), mBorderSize( 0.f ), mBorderColorIndex( Property::INVALID_INDEX ), @@ -115,52 +122,59 @@ BorderVisual::~BorderVisual() { } -void BorderVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap ) +void BorderVisual::DoSetProperties( const Property::Map& propertyMap ) { - Property::Value* color = propertyMap.Find( COLOR_NAME ); + Property::Value* color = propertyMap.Find( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME ); if( !( color && color->Get(mBorderColor) ) ) { - DALI_LOG_ERROR( "Fail to provide a border color to the BorderVisual object" ); + DALI_LOG_ERROR( "Fail to provide a border color to the BorderVisual object\n" ); } - Property::Value* size = propertyMap.Find( SIZE_NAME ); + Property::Value* size = propertyMap.Find( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME ); if( !( size && size->Get(mBorderSize) ) ) { - DALI_LOG_ERROR( "Fail to provide a border size to the BorderVisual object" ); + DALI_LOG_ERROR( "Fail to provide a border size to the BorderVisual object\n" ); } - Property::Value* antiAliasing = propertyMap.Find( ANTI_ALIASING ); + Property::Value* antiAliasing = propertyMap.Find( Toolkit::BorderVisual::Property::ANTI_ALIASING, ANTI_ALIASING ); if( antiAliasing ) { antiAliasing->Get( mAntiAliasing ); } } -void BorderVisual::SetClipRect( const Rect& clipRect ) -{ - Visual::SetClipRect( clipRect ); - - //ToDo: renderer responds to the clipRect change -} - void BorderVisual::DoSetOnStage( Actor& actor ) { InitializeRenderer(); - mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( 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 = (mImpl->mRenderer).RegisterProperty( SIZE_NAME, mBorderSize ); + mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize ); + + actor.AddRenderer( mImpl->mRenderer ); } void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const { map.Clear(); - map.Insert( RENDERER_TYPE, BORDER_RENDERER ); - map.Insert( COLOR_NAME, mBorderColor ); - map.Insert( SIZE_NAME, mBorderSize ); + map.Insert( VisualProperty::TYPE, Toolkit::Visual::BORDER ); + map.Insert( Toolkit::BorderVisual::Property::COLOR, mBorderColor ); + map.Insert( Toolkit::BorderVisual::Property::SIZE, mBorderSize ); + map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing ); +} + +void BorderVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value BorderVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); } void BorderVisual::InitializeRenderer() @@ -301,7 +315,7 @@ Geometry BorderVisual::CreateBorderGeometry() Geometry geometry = Geometry::New(); geometry.AddVertexBuffer( borderVertices ); geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) ); - geometry.SetGeometryType( Geometry::TRIANGLE_STRIP ); + geometry.SetType( Geometry::TRIANGLE_STRIP ); return geometry; }