/*
- * 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.
// INTERNAL INCLUDES
#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 <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
namespace Dali
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 )
{
}
void BloomView::OnSizeSet(const Vector3& targetSize)
{
- Control::OnSizeSet( targetSize );
-
mTargetSize = Vector2(targetSize);
mChildrenRoot.SetSize(targetSize);
mCompositeImageView.SetSize(targetSize);
Deactivate();
Activate();
}
+
+ Control::OnSizeSet( targetSize );
}
void BloomView::OnChildAdd( Actor& child )
{
- Control::OnChildAdd( child );
-
if( child != mChildrenRoot && child != mInternalRoot)
{
mChildrenRoot.Add( child );
}
+
+ Control::OnChildAdd( child );
}
void BloomView::OnChildRemove( Actor& child )
mGaussianBlurView.SetSize(mTargetSize);
GetImpl(mGaussianBlurView).AllocateResources();
+ mGaussianBlurView.SetVisible( true );
//////////////////////////////////////////////////////
// Create render targets
// stop render tasks processing
// Note: render target resources are automatically freed since we set the Image::Unused flag
RemoveRenderTasks();
+
mRenderTargetForRenderingChildren.Reset();
mBloomExtractTarget.Reset();
mOutputRenderTarget.Reset();
+
+ // Reset children
+ mBloomExtractImageView.SetImage( "" );
+ mTargetImageView.SetImage( "" );
+ mCompositeImageView.SetImage( "" );
+
+ mGaussianBlurView.SetVisible( false );
+
mActivated = false;
}