void SetType(FilterType filterType);
FilterType GetType(void) const;
+ void SetEnabled(bool enabled);
+ bool IsEnabled(void) const;
+
+ result SetKernelSize(float kernelSize);
+ float GetKernelSize(void);
+
private:
VisualElementFilter& operator =(const VisualElementFilter&);
return __pVisualElementFilterImpl->GetType();
}
+void
+VisualElementFilter::SetEnabled(bool enabled)
+{
+ SysAssertf(__pVisualElementFilterImpl != null, "Not yet constructed.");
+
+ __pVisualElementFilterImpl->SetEnabled(enabled);
+}
+
+bool
+VisualElementFilter::IsEnabled(void) const
+{
+ SysAssertf(__pVisualElementFilterImpl != null, "Not yet constructed.");
+
+ return __pVisualElementFilterImpl->IsEnabled();
+}
+
+result
+VisualElementFilter::SetKernelSize(float kernelSize)
+{
+ SysAssertf(__pVisualElementFilterImpl != null, "Not yet constructed.");
+
+ return __pVisualElementFilterImpl->SetKernelSize(kernelSize);
+}
+
+float
+VisualElementFilter::GetKernelSize(void)
+{
+ SysAssertf(__pVisualElementFilterImpl != null, "Not yet constructed.");
+
+ return __pVisualElementFilterImpl->GetKernelSize();
+}
+
}}} //Tizen::Ui::Animations
, __pLight(null)
, __pMaterial(null)
, __pFilter(null)
- , __isFilterEnabled(false)
+ , __useFilter(false)
, __alphaUpdated(true)
, __textureRepeated(false)
, __pShaderProgram(null)
+ , __findItemInQueue(true)
{
memset(extraSurfaceOpacity, 1.0, sizeof(float)*EXTRA_SURFACE_MAX);
memset(__pExtraSurfaceList, null, sizeof(VisualElementSurface* )*EXTRA_SURFACE_MAX);
__pFilter = new (std::nothrow) VisualElementFilter(*pFilter);
}
- __isFilterEnabled = true;
+ __useFilter = true;
}
else
{
}
}
+ if (__pMesh || __useTransform || __useStencil || __pFilter)
+ {
+ __findItemInQueue = false;
+ }
+ else
+ {
+ __findItemInQueue = true;
+ }
+
__syncNeeded = false;
return E_SUCCESS;
Material* __pMaterial;
VisualElementFilter* __pFilter;
- bool __isFilterEnabled;
+ bool __useFilter;
bool __alphaUpdated;
bool __extraSurfaceUpdated[EXTRA_SURFACE_MAX];
ShaderProgram* __pShaderProgram;
+ bool __findItemInQueue;
+
friend class _INativeNode;
friend class _VeDebug;
friend class _VisualElementImpl;
}
#endif
- if (pNode->__pFilter && pNode->__isFilterEnabled)
+ if (pNode->__pFilter && pNode->__useFilter)
{
- shaderType |= SHADER_TYPE_BLUR;
+ _VisualElementFilterImpl* pFilterImpl = _VisualElementFilterImpl::GetInstance(*pNode->__pFilter);
- __pFilter = pNode->__pFilter;
+ if (pFilterImpl->IsEnabled())
+ {
+ shaderType |= SHADER_TYPE_BLUR;
+
+ __pFilter = pNode->__pFilter;
+ }
}
if (likely(!pNode->__pMesh))
return -1;
}
- if (unlikely(__pRenderQueue[__queueCount - 1].__isMesh || pNode->__pMesh || pNode->__useTransform || pNode->__useStencil || pNode->__pFilter))
+ if (unlikely(__pRenderQueue[__queueCount - 1].__isMesh || !pNode->__findItemInQueue))
{
return -1;
}
{
_VisualElementFilterImpl* pFilterImpl = _VisualElementFilterImpl::GetInstance(*__pRenderQueue[i].__pFilter);
- glUniform1i(glGetUniformLocation(pProgramImpl->__program, "u_blurSize"), pFilterImpl->__radius);
+ glUniform1i(glGetUniformLocation(pProgramImpl->__program, "u_blurSize"), pFilterImpl->__kernelSize);
glUniform1i(glGetUniformLocation(pProgramImpl->__program, "u_horizontalPass"), pFilterImpl->__isFirstPass ? 1 : 0);
glUniform1f(glGetUniformLocation(pProgramImpl->__program, "u_sigma"), pFilterImpl->__sigma);
glUniform2f(glGetUniformLocation(pProgramImpl->__program, "u_texcoordOffset"), 1.0f / __pRenderQueue[i].__pSurfaceInfo->width, 1.0f / __pRenderQueue[i].__pSurfaceInfo->height);
__pGlContext->BindFramebuffer(pRenderTextureInfo);
__needClear = true;
- pNode->__isFilterEnabled = false;
+ pNode->__useFilter = false;
EnqueueRenderObject(pNode, false, 0, true);
__pGlContext->BindFramebuffer(null); // TODO: restore previous framebuffer
- pNode->__isFilterEnabled = true;
+ pNode->__useFilter = true;
// for next rendering
useTempNode = true;
__pTempNode->__childrenCount = pNode->__childrenCount;
__pTempNode->__opacity = pNode->__opacity;
__pTempNode->__pFilter = pNode->__pFilter;
- __pTempNode->__isFilterEnabled = pNode->__isFilterEnabled;
+ __pTempNode->__useFilter = pNode->__useFilter;
__pTempNode->__textureId = textureId;
__pTempNode->__pSurface = pSurface;
__pTempNode->__childrenCount = pNode->__childrenCount;
__pTempNode->__opacity = pNode->__opacity;
__pTempNode->__pFilter = pNode->__pFilter;
- __pTempNode->__isFilterEnabled = pNode->__isFilterEnabled;
+ __pTempNode->__useFilter = pNode->__useFilter;
__pTempNode->__textureId = textureId;
__pTempNode->__pSurface = pSurface;
, __size()
, __pInternalSurface(null)
, __pRenderSurface(null)
- , __radius(9.0f) // test
- , __sigma(4.0f)
+ , __enabled(true)
+ , __kernelSize(0.0f)
+ , __sigma(0.0f)
{
}
return __type;
}
+void
+_VisualElementFilterImpl::SetEnabled(bool enabled)
+{
+ __enabled = enabled;
+}
+
+bool
+_VisualElementFilterImpl::IsEnabled(void) const
+{
+ return __enabled;
+}
+
+result
+_VisualElementFilterImpl::SetKernelSize(float kernelSize)
+{
+ if (kernelSize < 1.0f)
+ {
+ return E_INVALID_ARG;
+ }
+
+ __kernelSize = kernelSize;
+
+ __sigma = __kernelSize / 2;
+
+ return E_SUCCESS;
+}
+
+float
+_VisualElementFilterImpl::GetKernelSize(void)
+{
+ return __kernelSize;
+}
+
bool
_VisualElementFilterImpl::Prepare(const _NativeLayer& layer, const Tizen::Graphics::Dimension& size, bool needRenderSurface)
{
void SetType(VisualElementFilter::FilterType filterType);
VisualElementFilter::FilterType GetType(void) const;
+ void SetEnabled(bool enabled);
+ bool IsEnabled(void) const;
+
+ result SetKernelSize(float kernelSize);
+ float GetKernelSize(void);
+
bool Prepare(const _NativeLayer& layer, const Tizen::Graphics::Dimension& size, bool needRenderSurface);
public:
VisualElementSurface* __pInternalSurface;
VisualElementSurface* __pRenderSurface;
- float __radius;
+ bool __enabled;
+
+ float __kernelSize;
float __sigma;
friend class _GlRenderManager;
pFilterImpl->Prepare(*pRoot->GetNativeLayer(), Dimension(__bounds.width, __bounds.height), false);
}
}
+
+ return E_SUCCESS;
}
VisualElementFilter*