Changed control defaults to listen to style change
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / bloom-view / bloom-view-impl.cpp
index 4f8e79e..d98cfd9 100644 (file)
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
 #include <dali/devel-api/images/texture-set-image.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
-#include "../gaussian-blur-view/gaussian-blur-view-impl.h"
+#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
 
 namespace Dali
 {
@@ -137,49 +138,49 @@ const char* const COMPOSITE_FRAGMENT_SOURCE =
 
 
 BloomView::BloomView()
-  : Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) )
-  , mBlurNumSamples(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES)
-  , mBlurBellCurveWidth(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_BELL_CURVE_WIDTH)
-  , mPixelFormat(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT)
-  , mDownsampleWidthScale(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_WIDTH_SCALE)
-  , mDownsampleHeightScale(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_HEIGHT_SCALE)
-  , mDownsampledWidth( 0.0f )
-  , mDownsampledHeight( 0.0f )
-  , mTargetSize(Vector2::ZERO)
-  , mLastSize(Vector2::ZERO)
-  , mChildrenRoot(Actor::New())
-  , mInternalRoot(Actor::New() )
-  , mBloomThresholdPropertyIndex(Property::INVALID_INDEX)
-  , mBlurStrengthPropertyIndex(Property::INVALID_INDEX)
-  , mBloomIntensityPropertyIndex(Property::INVALID_INDEX)
-  , mBloomSaturationPropertyIndex(Property::INVALID_INDEX)
-  , mImageIntensityPropertyIndex(Property::INVALID_INDEX)
-  , mImageSaturationPropertyIndex(Property::INVALID_INDEX)
-  mActivated( false )
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
+  mBlurNumSamples(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES),
+  mBlurBellCurveWidth(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_BELL_CURVE_WIDTH),
+  mPixelFormat(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT),
+  mDownsampleWidthScale(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_WIDTH_SCALE),
+  mDownsampleHeightScale(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_HEIGHT_SCALE),
+  mDownsampledWidth( 0.0f ),
+  mDownsampledHeight( 0.0f ),
+  mTargetSize(Vector2::ZERO),
+  mLastSize(Vector2::ZERO),
+  mChildrenRoot(Actor::New()),
+  mInternalRoot(Actor::New() ),
+  mBloomThresholdPropertyIndex(Property::INVALID_INDEX),
+  mBlurStrengthPropertyIndex(Property::INVALID_INDEX),
+  mBloomIntensityPropertyIndex(Property::INVALID_INDEX),
+  mBloomSaturationPropertyIndex(Property::INVALID_INDEX),
+  mImageIntensityPropertyIndex(Property::INVALID_INDEX),
+  mImageSaturationPropertyIndex(Property::INVALID_INDEX),
+  mActivated( false )
 {
 }
 
 BloomView::BloomView( const unsigned int blurNumSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
                                     const float downsampleWidthScale, const float downsampleHeightScale)
-  : Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) )
-  , mBlurNumSamples(blurNumSamples)
-  , mBlurBellCurveWidth(blurBellCurveWidth)
-  , mPixelFormat(renderTargetPixelFormat)
-  , mDownsampleWidthScale(downsampleWidthScale)
-  , mDownsampleHeightScale(downsampleHeightScale)
-  , mDownsampledWidth( 0.0f )
-  , mDownsampledHeight( 0.0f )
-  , mTargetSize(Vector2::ZERO)
-  , mLastSize(Vector2::ZERO)
-  , mChildrenRoot(Actor::New())
-  , mInternalRoot(Actor::New())
-  , mBloomThresholdPropertyIndex(Property::INVALID_INDEX)
-  , mBlurStrengthPropertyIndex(Property::INVALID_INDEX)
-  , mBloomIntensityPropertyIndex(Property::INVALID_INDEX)
-  , mBloomSaturationPropertyIndex(Property::INVALID_INDEX)
-  , mImageIntensityPropertyIndex(Property::INVALID_INDEX)
-  , mImageSaturationPropertyIndex(Property::INVALID_INDEX)
-  mActivated( false )
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
+  mBlurNumSamples(blurNumSamples),
+  mBlurBellCurveWidth(blurBellCurveWidth),
+  mPixelFormat(renderTargetPixelFormat),
+  mDownsampleWidthScale(downsampleWidthScale),
+  mDownsampleHeightScale(downsampleHeightScale),
+  mDownsampledWidth( 0.0f ),
+  mDownsampledHeight( 0.0f ),
+  mTargetSize(Vector2::ZERO),
+  mLastSize(Vector2::ZERO),
+  mChildrenRoot(Actor::New()),
+  mInternalRoot(Actor::New()),
+  mBloomThresholdPropertyIndex(Property::INVALID_INDEX),
+  mBlurStrengthPropertyIndex(Property::INVALID_INDEX),
+  mBloomIntensityPropertyIndex(Property::INVALID_INDEX),
+  mBloomSaturationPropertyIndex(Property::INVALID_INDEX),
+  mImageIntensityPropertyIndex(Property::INVALID_INDEX),
+  mImageSaturationPropertyIndex(Property::INVALID_INDEX),
+  mActivated( false )
 {
 }
 
@@ -362,10 +363,10 @@ void BloomView::AllocateResources()
     // Create render targets
 
     // create off screen buffer of new size to render our child actors to
-    mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
-    mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
-    FrameBufferImage mBlurExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
-    mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED);
+    mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+    mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat );
+    FrameBufferImage mBlurExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat );
+    mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
 
 
     //////////////////////////////////////////////////////
@@ -375,10 +376,10 @@ void BloomView::AllocateResources()
     mBloomExtractImageView.SetSize(mDownsampledWidth, mDownsampledHeight); // size needs to match render target
     // Create shader used for extracting the bright parts of an image
     Property::Map customShader;
-    customShader[ "fragmentShader" ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
-    Property::Map rendererMap;
-    rendererMap.Insert( "shader", customShader );
-    mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+    customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
+    Property::Map visualMap;
+    visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+    mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
 
     // set GaussianBlurView to blur our extracted bloom
     mGaussianBlurView.SetUserImageAndOutputRenderTarget(mBloomExtractTarget, mBlurExtractTarget);
@@ -386,9 +387,9 @@ void BloomView::AllocateResources()
     // use the completed blur in the first buffer and composite with the original child actors render
     mCompositeImageView.SetImage( mRenderTargetForRenderingChildren );
     // Create shader used to composite bloom and original image to output render target
-    customShader[ "fragmentShader" ] = COMPOSITE_FRAGMENT_SOURCE;
-    rendererMap[ "shader" ] = customShader;
-    mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+    customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
+    visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+    mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
     TextureSet textureSet = mCompositeImageView.GetRendererAt(0).GetTextures();
     TextureSetImage( textureSet, 1u, mBlurExtractTarget );