X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Feffects-view%2Feffects-view-impl.cpp;h=d2e188de39b30d7e011c39c0ea5f139d7f971c17;hb=aa4d3eae3c1c35c383e34c075d57dcc9835f8bcf;hp=ed94ff8d33099baaa7354065b057f1b799280dd2;hpb=2cf32ac170f397aacce527efd34909b3fd62efda;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 ed94ff8..d2e188d 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -32,11 +33,13 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include #include #include +#include namespace Dali { @@ -63,9 +66,13 @@ 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 Vector4 EFFECTS_VIEW_DEFAULT_BACKGROUND_COLOR( 0.0f, 0.0f, 0.0f, 0.0 ); const bool EFFECTS_VIEW_REFRESH_ON_DEMAND(false); +// Visuals are not stylable or public +const Property::Index CHILD_VISUAL( Toolkit::EffectsView::ANIMATABLE_PROPERTY_START_INDEX - 1); +const Property::Index POST_FILTER_VISUAL( CHILD_VISUAL-1 ); + #define DALI_COMPOSE_SHADER(STR) #STR const char* EFFECTS_VIEW_VERTEX_SOURCE = DALI_COMPOSE_SHADER( @@ -137,7 +144,7 @@ Toolkit::EffectsView EffectsView::New() } EffectsView::EffectsView() -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ), +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mChildrenRoot(Actor::New()), mBackgroundColor( EFFECTS_VIEW_DEFAULT_BACKGROUND_COLOR ), mTargetSize( Vector2::ZERO ), @@ -184,8 +191,11 @@ void EffectsView::SetType( Toolkit::EffectsView::EffectType type ) } } - Image dummyImage; // Dummy image, force creation of an image visual - InitializeVisual( self, mVisualPostFilter, dummyImage ); + FrameBufferImage dummyImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); + + Internal::InitializeVisual( self, mVisualPostFilter, dummyImage ); + DevelControl::RegisterVisual( *this, POST_FILTER_VISUAL, mVisualPostFilter ); + Property::Map customShader; customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE; customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EFFECTS_VIEW_FRAGMENT_SOURCE; @@ -213,6 +223,7 @@ void EffectsView::Disable() // stop render tasks processing // Note: render target resources are automatically freed since we set the Image::Unused flag RemoveRenderTasks(); + mLastSize = Vector2::ZERO; // Ensure resources are reallocated on subsequent enable mEnabled = false; } @@ -279,8 +290,6 @@ void EffectsView::OnInitialize() 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 @@ -294,23 +303,15 @@ void EffectsView::OnSizeSet(const Vector3& targetSize) } mChildrenRoot.SetSize( targetSize ); + + Control::OnSizeSet( targetSize ); } void EffectsView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - Enable(); - Actor self = Self(); - if( mVisualPostFilter ) - { - mVisualPostFilter.SetOnStage( self ); - } - if( mVisualForChildren ) - { - mVisualForChildren.SetOnStage( self ); - } + Control::OnStageConnection( depth ); } void EffectsView::OnStageDisconnection() @@ -323,27 +324,17 @@ void EffectsView::OnStageDisconnection() mFilters[i]->Disable(); } - Actor self = Self(); - if( mVisualPostFilter ) - { - mVisualPostFilter.SetOffStage( self ); - } - if( mVisualForChildren ) - { - mVisualForChildren.SetOffStage( self ); - } - Control::OnStageDisconnection(); } void EffectsView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mCameraForChildren ) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void EffectsView::OnChildRemove( Actor& child ) @@ -435,11 +426,11 @@ void EffectsView::AllocateResources() Actor self( Self() ); - mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED ); - InitializeVisual( self, mVisualForChildren, mImageForChildren ); - mVisualForChildren.SetDepthIndex( DepthIndex::CONTENT+1 ); + mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); + Internal::InitializeVisual( self, mVisualForChildren, mImageForChildren ); + DevelControl::RegisterVisual( *this, CHILD_VISUAL, mVisualForChildren, DepthIndex::CONTENT + 1 ); - mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED ); + mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); TextureSet textureSet = TextureSet::New(); TextureSetImage( textureSet, 0u, mImagePostFilter ); self.GetRendererAt( 0 ).SetTextures( textureSet );