X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fgaussian-blur-view%2Fgaussian-blur-view-impl.cpp;h=304c7995e291e78f6a654ef29382d39b7b6aa87c;hp=1b47c688a3daef14377a3a4d69d00b184869c43d;hb=35309f882c990c309b41aff6d11664c0c8637bb2;hpb=cea1f03937b84ab2ac2551d13e28e91c2ddfa728 diff --git a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp index 1b47c68..304c799 100644 --- a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp @@ -23,11 +23,10 @@ #include #include #include -#include +#include #include #include #include -#include #include #include #include @@ -37,6 +36,8 @@ // INTERNAL INCLUDES #include #include +#include +#include // TODO: // pixel format / size - set from JSON @@ -102,24 +103,6 @@ const float GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_HEIGHT_SCALE = 0.5f; const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f; -const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE = DALI_COMPOSE_SHADER( - varying mediump vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - uniform lowp vec4 uColor;\n - uniform mediump vec2 uSampleOffsets[NUM_SAMPLES];\n - uniform mediump float uSampleWeights[NUM_SAMPLES];\n - - void main()\n - {\n - mediump vec4 col = texture2D(sTexture, vTexCoord + uSampleOffsets[0]) * uSampleWeights[0];\n - for (int i=1; i( + new Control::Impl::AccessibleImpl( actor, Dali::Accessibility::Role::FILLER ) ); + } ); } @@ -341,19 +317,19 @@ void GaussianBlurView::OnSizeSet(const Vector3& targetSize) { mTargetSize = Vector2(targetSize); - mChildrenRoot.SetSize(targetSize); + mChildrenRoot.SetProperty( Actor::Property::SIZE, targetSize); if( !mBlurUserImage ) { - mCompositingActor.SetSize(targetSize); - mTargetActor.SetSize(targetSize); + mCompositingActor.SetProperty( Actor::Property::SIZE, targetSize); + mTargetActor.SetProperty( Actor::Property::SIZE, targetSize); // Children render camera must move when GaussianBlurView object is resized. This is since we cannot change render target size - so we need to remap the child actors' rendering // accordingly so they still exactly fill the render target. Note that this means the effective resolution of the child render changes as the GaussianBlurView object changes // size, this is the trade off for not being able to modify render target size // Change camera z position based on GaussianBlurView actor height float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f); - mRenderFullSizeCamera.SetZ(mTargetSize.height * cameraPosConstraintScale); + mRenderFullSizeCamera.SetProperty( Actor::Property::POSITION_Z, mTargetSize.height * cameraPosConstraintScale); } @@ -399,7 +375,7 @@ void GaussianBlurView::AllocateResources() mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight); mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f))); + mRenderDownsampledCamera.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)))); // setup for normal operation if(!mBlurUserImage) @@ -412,7 +388,7 @@ void GaussianBlurView::AllocateResources() mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f); - mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale); + mRenderFullSizeCamera.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale)); // create offscreen buffer of new size to render our child actors to mRenderTargetForRenderingChildren = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE ); @@ -440,10 +416,10 @@ void GaussianBlurView::AllocateResources() mRenderTarget2.AttachColorTexture( texture ); // size needs to match render target - mHorizBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight); + mHorizBlurActor.SetProperty( Actor::Property::SIZE, Vector2(mDownsampledWidth, mDownsampledHeight) ); // size needs to match render target - mVertBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight); + mVertBlurActor.SetProperty( Actor::Property::SIZE, Vector2(mDownsampledWidth, mDownsampledHeight) ); SetRendererTexture( mVertBlurActor.GetRendererAt(0), mRenderTarget2 ); // set gaussian blur up for new sized render targets @@ -466,6 +442,11 @@ void GaussianBlurView::CreateRenderTasks() mRenderChildrenTask.SetCameraActor(mRenderFullSizeCamera); mRenderChildrenTask.SetFrameBuffer( mRenderTargetForRenderingChildren ); + + if( mRenderOnce ) + { + mRenderChildrenTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + } } // perform a horizontal blur targeting the second buffer @@ -477,7 +458,7 @@ void GaussianBlurView::CreateRenderTasks() mHorizBlurTask.SetClearColor( mBackgroundColor ); mHorizBlurTask.SetCameraActor(mRenderDownsampledCamera); mHorizBlurTask.SetFrameBuffer( mRenderTarget2 ); - if( mRenderOnce && mBlurUserImage ) + if( mRenderOnce || ( mRenderOnce && mBlurUserImage ) ) { mHorizBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE); } @@ -498,7 +479,7 @@ void GaussianBlurView::CreateRenderTasks() { mVertBlurTask.SetFrameBuffer( mRenderTarget1 ); } - if( mRenderOnce && mBlurUserImage ) + if( mRenderOnce || ( mRenderOnce && mBlurUserImage ) ) { mVertBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE); mVertBlurTask.FinishedSignal().Connect( this, &GaussianBlurView::OnRenderTaskFinished ); @@ -514,6 +495,11 @@ void GaussianBlurView::CreateRenderTasks() mCompositeTask.SetCameraActor(mRenderFullSizeCamera); mCompositeTask.SetFrameBuffer( mRenderTargetForRenderingChildren ); + + if( mRenderOnce ) + { + mCompositeTask.SetRefreshRate(RenderTask::REFRESH_ONCE); + } } } @@ -541,7 +527,7 @@ void GaussianBlurView::Activate() void GaussianBlurView::ActivateOnce() { - DALI_ASSERT_ALWAYS(mBlurUserImage); // Only works with blurring image mode. + Deactivate(); mRenderOnce = true; Activate(); }