X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=7bcaad4ab4c67cb113e255dd3af8d30672d59f49;hb=5823a096131e0d581ca2a070f5da23bd7fc47337;hp=07d7f026e9424a9ec58b0555fb116b905cd8a6eb;hpb=8fe34a7363271b35b631b07989c11845de7f190c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 07d7f02..7bcaad4 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -23,16 +23,13 @@ #include #include #include -#include #include #include -#include #include +#include #include +#include #include -#include -#include -#include #include // INTERNAL INCLUDES @@ -302,8 +299,7 @@ Actor CreateBackground( Actor parent, const Vector4& color, Image image = Image( mesh.SetIndexBuffer( indexBuffer ); //Add uniforms to the shader - Property::Index backgroundColorIndex = shader.RegisterProperty( "uBackgroundColor", color ); - shader.AddUniformMapping( backgroundColorIndex, "uBackgroundColor" ); + shader.RegisterProperty( "uBackgroundColor", color ); //Create the renderer Renderer renderer = Renderer::New( mesh, material ); @@ -1074,15 +1070,23 @@ void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dime Vector3 Control::GetNaturalSize() { + //Control's natural size is the size of its background image if it has been set, or ZERO otherwise + Vector3 naturalSize = Vector3::ZERO; if( mImpl->mBackground ) { - Actor actor = mImpl->mBackground->actor; - if( actor ) + Material backgroundMaterial = mImpl->mBackground->actor.GetRendererAt(0).GetMaterial(); + if( backgroundMaterial.GetNumberOfSamplers() > 0 ) { - return actor.GetNaturalSize(); + Image backgroundImage = backgroundMaterial.GetSamplerAt(0).GetImage(); + if( backgroundImage ) + { + naturalSize.x = backgroundImage.GetWidth(); + naturalSize.y = backgroundImage.GetHeight(); + } } } - return Vector3(); + + return naturalSize; } float Control::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )