END_TEST;
}
+
+int UtcDaliRenderEffectBlurOnce(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliRenderEffectBlurOnce with background blur effect");
+
+ Integration::Scene scene = application.GetScene();
+
+ Control control = Control::New();
+ control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ control.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+
+ scene.Add(control);
+
+ // Add render effect during scene on.
+ control.SetRenderEffect(RenderEffect::CreateBackgroundBlurEffect(0.5f, 20u, true));
+
+ application.SendNotification();
+
+ RenderTaskList taskList = scene.GetRenderTaskList();
+
+ // Render effect activated.
+ DALI_TEST_EQUALS(4u, taskList.GetTaskCount(), TEST_LOCATION);
+ tet_printf("order : %d\n", taskList.GetTask(taskList.GetTaskCount() - 1).GetOrderIndex());
+ DALI_TEST_EQUALS(INT32_MIN + 2, taskList.GetTask(taskList.GetTaskCount() - 1).GetOrderIndex(), TEST_LOCATION);
+
+ END_TEST;
+}
mDownscaledPixelRadius(static_cast<uint32_t>(BLUR_EFFECT_PIXEL_RADIUS * BLUR_EFFECT_DOWNSCALE_FACTOR)),
mBellCurveWidth(Math::MACHINE_EPSILON_1),
mSkipBlur(false),
+ mBlurOnce(false),
mIsBackground(isBackground)
{
}
-BlurEffectImpl::BlurEffectImpl(float downscaleFactor, uint32_t blurRadius, bool isBackground)
+BlurEffectImpl::BlurEffectImpl(float downscaleFactor, uint32_t blurRadius, bool blurOnce, bool isBackground)
: RenderEffectImpl(),
mInternalRoot(Actor::New()),
mDownscaleFactor(downscaleFactor),
mDownscaledPixelRadius(BLUR_EFFECT_PIXEL_RADIUS),
mBellCurveWidth(Math::MACHINE_EPSILON_1),
mSkipBlur(false),
+ mBlurOnce(blurOnce),
mIsBackground(isBackground)
{
if(DALI_UNLIKELY(mDownscaleFactor < MINIMUM_DOWNSCALE_FACTOR || mDownscaleFactor > MAXIMUM_DOWNSCALE_FACTOR))
return handle;
}
-BlurEffectImplPtr BlurEffectImpl::New(float downscaleFactor, uint32_t blurRadius, bool isBackground)
+BlurEffectImplPtr BlurEffectImpl::New(float downscaleFactor, uint32_t blurRadius, bool blurOnce, bool isBackground)
{
- BlurEffectImplPtr handle = new BlurEffectImpl(downscaleFactor, blurRadius, isBackground);
+ BlurEffectImplPtr handle = new BlurEffectImpl(downscaleFactor, blurRadius, blurOnce, isBackground);
handle->Initialize();
return handle;
}
RenderEffectImplPtr BlurEffectImpl::Clone() const
{
- BlurEffectImplPtr blurEffectImpl = new BlurEffectImpl(mDownscaleFactor, mPixelRadius, mIsBackground);
+ BlurEffectImplPtr blurEffectImpl = new BlurEffectImpl(mDownscaleFactor, mPixelRadius, mBlurOnce, mIsBackground);
blurEffectImpl->Initialize();
return RenderEffectImplPtr(blurEffectImpl);
}
// Clear sourceTexture as Transparent.
mVerticalBlurTask.SetClearEnabled(true);
mVerticalBlurTask.SetClearColor(Color::TRANSPARENT);
+
+ // Adjust refresh rate
+ if(mBlurOnce)
+ {
+ mSourceRenderTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ mHorizontalBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ mVerticalBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ }
+ else
+ {
+ mSourceRenderTask.SetRefreshRate(RenderTask::REFRESH_ALWAYS);
+ mHorizontalBlurTask.SetRefreshRate(RenderTask::REFRESH_ALWAYS);
+ mVerticalBlurTask.SetRefreshRate(RenderTask::REFRESH_ALWAYS);
+ }
}
void BlurEffectImpl::DestroyRenderTasks()
*
* @param[in] downscaleFactor This value should reside in the range [0.0, 1.0].
* @param[in] blurRadius The radius of Gaussian kernel.
+ * @param[in] blurOnce Whether to blur once or always. Default is false(always).
* @param[in] isBackground True when blurring background, False otherwise
* @return A handle to a newly allocated Dali resource
*/
- static BlurEffectImplPtr New(float downscaleFactor, uint32_t blurRadius, bool isBackground);
+ static BlurEffectImplPtr New(float downscaleFactor, uint32_t blurRadius, bool blurOnce, bool isBackground);
/**
* @copydoc Toolkit::Intenral::RenderEffectImpl::Clone
* @brief Creates an uninitialized blur effect implementation
* @param[in] downscaleFactor This value should reside in the range [0.0, 1.0].
* @param[in] blurRadius The radius of Gaussian kernel.
+ * @param[in] blurOnce Whether to blur once or always. Default is false(always).
* @param[in] isBackground True when blurring background, False otherwise
*/
- BlurEffectImpl(float downscaleFactor, uint32_t blurRadius, bool isBackground);
+ BlurEffectImpl(float downscaleFactor, uint32_t blurRadius, bool blurOnce, bool isBackground);
/**
* @brief Destructor
float mBellCurveWidth;
bool mSkipBlur : 1;
+ bool mBlurOnce : 1;
bool mIsBackground : 1;
};
} // namespace Internal
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
return RenderEffect(internal.Get());
}
-RenderEffect RenderEffect::CreateBackgroundBlurEffect(float downscaleFactor, uint32_t blurRadius)
+RenderEffect RenderEffect::CreateBackgroundBlurEffect(float downscaleFactor, uint32_t blurRadius, bool blurOnce)
{
- Internal::BlurEffectImplPtr internal = Internal::BlurEffectImpl::New(downscaleFactor, blurRadius, true);
+ Internal::BlurEffectImplPtr internal = Internal::BlurEffectImpl::New(downscaleFactor, blurRadius, blurOnce, true);
return RenderEffect(internal.Get());
}
} // namespace Toolkit
* @brief Creates background blur effect.
* @param[in] downscaleFactor Input texture downscaler for better performance.
* @param[in] blurRadius Gaussian kernel size.
+ * @param[in] blurOnce Whether to perform blur once or always. Default is false(always).
* @SINCE_2_4.1
*/
- static RenderEffect CreateBackgroundBlurEffect(float downscaleFactor, uint32_t blurRadius);
+ static RenderEffect CreateBackgroundBlurEffect(float downscaleFactor, uint32_t blurRadius, bool blurOnce = false);
public: // Not intended for Application developers
///@cond internal