X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fgradient%2Fgradient-visual.cpp;h=aaf4f0341e12fdb66341b84e8a73015ba94bc236;hb=83dd0b674417c4b93d920a9c56c8839d6bef6cc6;hp=80c899fc67317ec7b4afbe68906510cda38a336d;hpb=caf7677175a0e8b9c690d4f2ab73adc295f22c0e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp index 80c899f..aaf4f03 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -29,7 +29,7 @@ // INTERNAL INCLUDES #include -#include +#include #include #include #include @@ -172,11 +172,12 @@ const char* FRAGMENT_SHADER[] = DALI_COMPOSE_SHADER( uniform sampler2D sTexture;\n // sampler1D? uniform lowp vec4 uColor;\n + uniform lowp vec3 mixColor;\n varying mediump vec2 vTexCoord;\n \n void main()\n {\n - gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * uColor;\n + gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n }\n ), @@ -184,11 +185,12 @@ DALI_COMPOSE_SHADER( DALI_COMPOSE_SHADER( uniform sampler2D sTexture;\n // sampler1D? uniform lowp vec4 uColor;\n + uniform lowp vec3 mixColor;\n varying mediump vec2 vTexCoord;\n \n void main()\n {\n - gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * uColor;\n + gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n }\n ) }; @@ -223,7 +225,7 @@ GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache, const P } GradientVisual::GradientVisual( VisualFactoryCache& factoryCache ) -: Visual::Base( factoryCache ), +: Visual::Base( factoryCache, Visual::FittingMode::FILL ), mGradientType( LINEAR ), mIsOpaque( true ) { @@ -274,12 +276,15 @@ void GradientVisual::DoSetOnStage( Actor& actor ) InitializeRenderer(); actor.AddRenderer( mImpl->mRenderer ); + + // Gradient Visual generated and ready to display + ResourceReady( Toolkit::Visual::ResourceStatus::READY ); } void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const { map.Clear(); - map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::GRADIENT ); + map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::GRADIENT ); map.Insert( Toolkit::GradientVisual::Property::UNITS, mGradient->GetGradientUnits() ); map.Insert( Toolkit::GradientVisual::Property::SPREAD_METHOD, mGradient->GetSpreadMethod() ); @@ -319,14 +324,14 @@ void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const } } +void GradientVisual::DoCreateInstancePropertyMap( Property::Map& map ) const +{ + // Do nothing +} + void GradientVisual::InitializeRenderer() { Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); - if( !geometry ) - { - geometry = VisualFactoryCache::CreateQuadGeometry(); - mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry ); - } Toolkit::GradientVisual::Units::Type gradientUnits = mGradient->GetGradientUnits(); VisualFactoryCache::ShaderType shaderType = GetShaderType( mGradientType, gradientUnits );