X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fshadow-view%2Fshadow-view-impl.cpp;h=c19f3c718a0e7849206681357ca2206617fc4273;hp=950c819a198d2fcf9e68780d41746fec3c51527f;hb=11ed6421771d05113ae1a6510167d8c2557ac20e;hpb=0dd2826b16facb7e8f21ffb86853bd1b0afb97b4 diff --git a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp index 950c819..c19f3c7 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 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. @@ -24,11 +24,13 @@ #include #include #include -#include +#include #include +#include #include // INTERNAL INCLUDES +#include #include #include @@ -36,7 +38,6 @@ // pixel format / size - set from JSON // aspect ratio property needs to be able to be constrained also for cameras. (now do-able) // default near clip value -// mChildrenRoot Add()/Remove() overloads - better solution ///////////////////////////////////////////////////////// @@ -148,30 +149,16 @@ Toolkit::ShadowView ShadowView::New(float downsampleWidthScale, float downsample return handle; } -///////////////////////////////////////////////////////////// -// for creating a subtree for all user added child actors. -// TODO: overloading Actor::Add()/Remove() not nice since breaks polymorphism. Need another method to pass ownership of added child actors to our internal actor root. -void ShadowView::Add(Actor child) -{ - mChildrenRoot.Add(child); -} - -void ShadowView::Remove(Actor child) -{ - mChildrenRoot.Remove(child); -} - void ShadowView::SetShadowPlaneBackground(Actor shadowPlaneBackground) { mShadowPlaneBg = shadowPlaneBackground; - mShadowPlane = Toolkit::ImageView::New(); + mShadowPlane = Toolkit::ImageView::New( mOutputImage ); mShadowPlane.SetName( "SHADOW_PLANE" ); mShadowPlane.SetParentOrigin(ParentOrigin::CENTER); mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER); - mShadowPlane.SetImage(mOutputImage); - mShadowPlane.SetProperty( Toolkit::ImageView::Property::IMAGE, mShadowRenderShader ); + mShadowPlane.SetProperty( Toolkit::ImageView::Property::IMAGE, mShadowVisualMap ); SetShaderConstants(); // Rather than parent the shadow plane drawable and have constraints to move it to the same @@ -257,15 +244,15 @@ void ShadowView::OnInitialize() Property::Map customShader; - customShader[ "vertexShader" ] = RENDER_SHADOW_VERTEX_SOURCE; - customShader[ "fragmentShader" ] = RENDER_SHADOW_FRAGMENT_SOURCE; + customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = RENDER_SHADOW_VERTEX_SOURCE; + customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = RENDER_SHADOW_FRAGMENT_SOURCE; - customShader[ "subdivideGridX" ] = 20; - customShader[ "subdivideGridY" ] = 20; + customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20; + customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20; - customShader[ "hints" ] = "outputIsTransparent"; + customShader[ Toolkit::Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT; - mShadowRenderShader[ "shader" ] = customShader; + mShadowVisualMap[ Toolkit::Visual::Property::SHADER ] = customShader; // Create render targets needed for rendering from light's point of view mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ); @@ -289,6 +276,7 @@ void ShadowView::OnInitialize() // Turn off inheritance to ensure filter renders properly mBlurRootActor.SetParentOrigin( ParentOrigin::CENTER ); + mBlurRootActor.SetInheritPosition(false); mBlurRootActor.SetInheritOrientation(false); mBlurRootActor.SetInheritScale(false); mBlurRootActor.SetColorMode(USE_OWN_COLOR); @@ -307,8 +295,21 @@ void ShadowView::OnInitialize() blurStrengthConstraint.Apply(); } -void ShadowView::OnSizeSet(const Vector3& targetSize) +void ShadowView::OnChildAdd( Actor& child ) { + Control::OnChildAdd( child ); + + if( child != mChildrenRoot && child != mBlurRootActor) + { + mChildrenRoot.Add( child ); + } +} + +void ShadowView::OnChildRemove( Actor& child ) +{ + mChildrenRoot.Remove( child ); + + Control::OnChildRemove( child ); } void ShadowView::ConstrainCamera()