X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Feffects-view%2Feffects-view-impl.cpp;h=28b64fa2c1887f3776fe808f4dad28557d79e928;hp=f928e1c7533563f2e1c706234908944f4e2f991b;hb=e9d852fcdacc5788785bfe0b617bd757794e8208;hpb=57869973578f6a0b0f836d396c7232ddb8302c6b diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index f928e1c..28b64fa 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -19,9 +19,11 @@ #include "effects-view-impl.h" // EXTERNAL INCLUDES +#include #include #include #include +#include #include // INTERNAL INCLUDES @@ -46,21 +48,24 @@ Dali::BaseHandle Create() return Toolkit::EffectsView::New(); } -Dali::TypeRegistration mType( typeid(Dali::Toolkit::EffectsView), typeid(Dali::Toolkit::Control), Create ); +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::EffectsView, Toolkit::Control, Create ) +DALI_TYPE_REGISTRATION_END() const Pixel::Format EFFECTS_VIEW_DEFAULT_PIXEL_FORMAT = Pixel::RGBA8888; const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f; const Vector4 EFFECTS_VIEW_DEFAULT_BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 0.0 ); const bool EFFECTS_VIEW_REFRESH_ON_DEMAND(false); -// custom properties + +// Custom properties +const char* const EFFECT_SIZE_PROPERTY_NAME = "EffectSize"; +const char* const EFFECT_STRENGTH_PROPERTY_NAME = "EffectStrength"; +const char* const EFFECT_OFFSET_PROPERTY_NAME = "EffectOffset"; +const char* const EFFECT_COLOR_PROPERTY_NAME = "EffectColor"; + const float EFFECT_SIZE_DEFAULT( 1.0f ); -const std::string EFFECT_SIZE_PROPERTY_NAME( "EffectSize" ); const float EFFECT_STRENGTH_DEFAULT( 0.5f ); -const std::string EFFECT_STRENGTH_PROPERTY_NAME( "EffectStrength" ); const Vector3 EFFECT_OFFSET_DEFAULT( 0.0f, 0.0f, 0.0f ); -const std::string EFFECT_OFFSET_PROPERTY_NAME( "EffectOffset" ); const Vector4 EFFECT_COLOR_DEFAULT( Color::WHITE ); -const std::string EFFECT_COLOR_PROPERTY_NAME( "EffectColor" ); const char* const EFFECTS_VIEW_FRAGMENT_SOURCE = "void main()\n" @@ -107,7 +112,7 @@ Toolkit::EffectsView EffectsView::New() } EffectsView::EffectsView() -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ), mEffectType( Toolkit::EffectsView::INVALID_TYPE ), mPixelFormat( EFFECTS_VIEW_DEFAULT_PIXEL_FORMAT ), mSpread(0.0f), @@ -265,8 +270,14 @@ void EffectsView::SetupProperties() mEffectStrengthPropertyIndex = self.RegisterProperty(EFFECT_STRENGTH_PROPERTY_NAME, EFFECT_STRENGTH_DEFAULT, Property::READ_WRITE); mEffectOffsetPropertyIndex = self.RegisterProperty(EFFECT_OFFSET_PROPERTY_NAME, EFFECT_OFFSET_DEFAULT); mEffectColorPropertyIndex = self.RegisterProperty(EFFECT_COLOR_PROPERTY_NAME, EFFECT_COLOR_DEFAULT); - mActorPostFilter.ApplyConstraint( Constraint::New( Actor::POSITION, Source( self, mEffectOffsetPropertyIndex ), EqualToConstraint() ) ); - mActorPostFilter.ApplyConstraint( Constraint::New( Actor::COLOR, Source( self, mEffectColorPropertyIndex ), EqualToConstraint() ) ); + + Constraint positionConstraint = Constraint::New( mActorPostFilter, Actor::Property::POSITION, EqualToConstraint() ); + positionConstraint.AddSource( Source( self, mEffectOffsetPropertyIndex ) ); + positionConstraint.Apply(); + + Constraint colorConstraint = Constraint::New( mActorPostFilter, Actor::Property::COLOR, EqualToConstraint() ); + colorConstraint.AddSource( Source( self, mEffectColorPropertyIndex ) ); + colorConstraint.Apply(); } void EffectsView::SetBackgroundColor( const Vector4& color ) @@ -288,7 +299,7 @@ void EffectsView::OnInitialize() mCameraForChildren.SetParentOrigin(ParentOrigin::CENTER); mActorForChildren = ImageActor::New(); - mActorForChildren.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); + mActorForChildren.SetParentOrigin( ParentOrigin::CENTER ); mActorForChildren.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); mActorPostFilter = ImageActor::New(); @@ -304,8 +315,10 @@ void EffectsView::OnInitialize() SetupProperties(); } -void EffectsView::OnControlSizeSet(const Vector3& targetSize) +void EffectsView::OnSizeSet(const Vector3& targetSize) { + Control::OnSizeSet( targetSize ); + mTargetSize = Vector2(targetSize); // if we are already on stage, need to update render target sizes now to reflect the new size of this actor @@ -354,6 +367,8 @@ void EffectsView::OnStageDisconnection() { mFilters[i]->Disable(); } + + Control::OnStageDisconnection(); } void EffectsView::SetupFilters() @@ -438,10 +453,10 @@ void EffectsView::AllocateResources() SetupCameras(); - mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused ); + mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED ); mActorForChildren.SetImage(mImageForChildren); - mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::Unused ); + mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED ); mActorPostFilter.SetImage(mImagePostFilter); SetupFilters(); @@ -459,7 +474,6 @@ void EffectsView::SetupCameras() mCameraForChildren.SetAspectRatio(mTargetSize.width / mTargetSize.height); mCameraForChildren.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor mCameraForChildren.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosScale); - mCameraForChildren.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); mCameraForChildren.SetZ( mTargetSize.height * cameraPosScale ); }