/*
- * 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.
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/property.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
#include <dali-toolkit/internal/filters/emboss-filter.h>
#include <dali-toolkit/internal/filters/spread-filter.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
namespace Dali
{
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(
}
}
- 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;
// 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;
}
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
}
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()
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 )
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, float( DepthIndex::CONTENT + 1 ) );
mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
TextureSet textureSet = TextureSet::New();