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=8adc19d4f493b418ed092c1cb768b5ed7867c4f2;hp=4c532fd2c2fd0c2f23e993d10e2772886094aa5c;hb=eb3641c5f89d0ad118aff7862b1e7669ea9828d9;hpb=84e05cec3039abe8ecaaa950d4f93dd4f94282fe 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 4c532fd..8adc19d 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 { @@ -66,6 +69,10 @@ 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); +// 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( @@ -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 ) @@ -436,8 +427,8 @@ void EffectsView::AllocateResources() Actor self( Self() ); mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); - InitializeVisual( self, mVisualForChildren, mImageForChildren ); - mVisualForChildren.SetDepthIndex( DepthIndex::CONTENT+1 ); + Internal::InitializeVisual( self, mVisualForChildren, mImageForChildren ); + DevelControl::RegisterVisual( *this, CHILD_VISUAL, mVisualForChildren, DepthIndex::CONTENT + 1 ); mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); TextureSet textureSet = TextureSet::New();