From: Heeyong Song Date: Mon, 24 Mar 2014 06:48:12 +0000 (+0900) Subject: Support 9-patch image X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=075d92dd2cabe9cb1d6e226eecf1355e11bb6d1c;p=framework%2Fosp%2Fuifw.git Support 9-patch image Change-Id: Ie9f348608416a74009c242461ea5d4ee70318568 --- diff --git a/src/ui/animations/FUiAnim_GlNode.cpp b/src/ui/animations/FUiAnim_GlNode.cpp index c877dd3..2e3fec7 100644 --- a/src/ui/animations/FUiAnim_GlNode.cpp +++ b/src/ui/animations/FUiAnim_GlNode.cpp @@ -82,6 +82,10 @@ _GlNode::_GlNode(void) , __childrenCount(0) , __backgroundColor(0.0f, 0.0f, 0.0f, 0.0f) // fully transparent rectangle object by default , __objectColor(0.0f, 0.0f, 0.0f, 0.0f) + , __pVertices(null) + , __pIndices(null) + , __vertexCount(0) + , __indexCount(0) , __pLayer(null) , __activeLight() , __pMesh(null) @@ -100,6 +104,8 @@ _GlNode::_GlNode(void) memset(__extraSurfaceUpdated, true, sizeof(bool) * EXTRA_SURFACE_MAX); __activeLight.Construct(); + + AllocateVertexBuffer(4, 6); } _GlNode::~_GlNode(void) @@ -125,6 +131,18 @@ _GlNode::~_GlNode(void) } } + if (__pVertices) + { + delete [] __pVertices; + __pVertices = null; + } + + if (__pIndices) + { + delete [] __pIndices; + __pIndices = null; + } + if (__pMesh) { delete __pMesh; @@ -369,163 +387,6 @@ _GlNode::SyncStatus(VisualElementSurface* pSurface, _VisualElementImpl& element) // Set texture info // __pTextureInfo = reinterpret_cast(pSurfaceImpl->GetNativeHandle()); - - // test for atlas -// bool useAtlas = false; -// float atlasWidth, atlasHeight; - - // Calc texture coordinates -#ifdef __USE_TEXTURE_ATLAS__ - if (!pTextureInfo->atlas) - { -#endif - if (__useStencil) - { - if (element.__useContentBounds) - { - __pVertices[3] = element.__contentBounds.x; - __pVertices[4] = element.__contentBounds.y; - - __pVertices[8] = element.__contentBounds.x + element.__contentBounds.width; - __pVertices[9] = element.__contentBounds.y; - - __pVertices[13] = element.__contentBounds.x; - __pVertices[14] = element.__contentBounds.y + element.__contentBounds.height; - - __pVertices[18] = element.__contentBounds.x + element.__contentBounds.width; - __pVertices[19] = element.__contentBounds.y + element.__contentBounds.height; - } - else - { - __pVertices[3] = 0.0f; - __pVertices[4] = 0.0f; - - __pVertices[8] = 1.0f; - __pVertices[9] = 0.0f; - - __pVertices[13] = 0.0f; - __pVertices[14] = 1.0f; - - __pVertices[18] = 1.0f; - __pVertices[19] = 1.0f; - } - } - else - { - if (element.__useContentBounds) - { - __pVertices[3] = element.__contentBounds.x + __visibleRect.Left() / __bounds.Width() * element.__contentBounds.width; - __pVertices[4] = element.__contentBounds.y + __visibleRect.Top() / __bounds.Height() * element.__contentBounds.height; - - __pVertices[8] = element.__contentBounds.x + (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * element.__contentBounds.width; - __pVertices[9] = element.__contentBounds.y + __visibleRect.Top() / __bounds.Height() * element.__contentBounds.height; - - __pVertices[13] = element.__contentBounds.x + __visibleRect.Left() / __bounds.Width() * element.__contentBounds.width; - __pVertices[14] = element.__contentBounds.y + (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * element.__contentBounds.height; - - __pVertices[18] = element.__contentBounds.x + (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * element.__contentBounds.width; - __pVertices[19] = element.__contentBounds.y + (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * element.__contentBounds.height; - } - else - { - __pVertices[3] = __visibleRect.Left() / __bounds.Width(); - __pVertices[4] = __visibleRect.Top() / __bounds.Height(); - - __pVertices[8] = (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width(); - __pVertices[9] = __visibleRect.Top() / __bounds.Height(); - - __pVertices[13] = __visibleRect.Left() / __bounds.Width(); - __pVertices[14] = (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height(); - - __pVertices[18] = (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width(); - __pVertices[19] = (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height(); - } - } -#ifdef __USE_TEXTURE_ATLAS__ - } - else - { - - _TextureAtlas* pAtlas = reinterpret_cast<_TextureAtlas*>(pTextureInfo->atlas); - - float atlasWidth = pAtlas->GetTextureInfo().width; - float atlasHeight = pAtlas->GetTextureInfo().height; - // use texture atlas - if (__useStencil) - { - if (element.__useContentBounds) - { - __pVertices[3] = (pTextureInfo->x + element.__contentBounds.x * pTextureInfo->width) / atlasWidth; - __pVertices[4] = (pTextureInfo->y + element.__contentBounds.y * pTextureInfo->height) / atlasHeight; - - __pVertices[8] = (pTextureInfo->x + (element.__contentBounds.x + element.__contentBounds.width) * pTextureInfo->width) / atlasWidth; - __pVertices[9] = (pTextureInfo->y + element.__contentBounds.y * pTextureInfo->height) / atlasHeight; - - __pVertices[13] = (pTextureInfo->x + element.__contentBounds.x * pTextureInfo->width) / atlasWidth; - __pVertices[14] = (pTextureInfo->y + (element.__contentBounds.y + element.__contentBounds.height) * pTextureInfo->height) / atlasHeight; - - __pVertices[18] = (pTextureInfo->x + (element.__contentBounds.x + element.__contentBounds.width) * pTextureInfo->width) / atlasWidth; - __pVertices[19] = (pTextureInfo->y + (element.__contentBounds.y + element.__contentBounds.height) * pTextureInfo->height) / atlasHeight; - } - else - { - __pVertices[3] = pTextureInfo->x / atlasWidth; - __pVertices[4] = pTextureInfo->y / atlasHeight; - - __pVertices[8] = (pTextureInfo->x + pTextureInfo->width) / atlasWidth; - __pVertices[9] = pTextureInfo->y / atlasHeight; - - __pVertices[13] = pTextureInfo->x / atlasWidth; - __pVertices[14] = (pTextureInfo->y + pTextureInfo->height) / atlasHeight; - - __pVertices[18] = (pTextureInfo->x + pTextureInfo->width) / atlasWidth; - __pVertices[19] = (pTextureInfo->y + pTextureInfo->height) / atlasHeight; - } - } - else - { - - - if (element.__useContentBounds) - { - __pVertices[3] = ((element.__contentBounds.x + __visibleRect.Left() / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[4] = ((element.__contentBounds.y + __visibleRect.Top() / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - - __pVertices[8] = ((element.__contentBounds.x + (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[9] = ((element.__contentBounds.y + __visibleRect.Top() / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - - __pVertices[13] = ((element.__contentBounds.x + __visibleRect.Left() / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[14] = ((element.__contentBounds.y + (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - - __pVertices[18] = ((element.__contentBounds.x + (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[19] = ((element.__contentBounds.y + (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - } - else - { - __pVertices[3] = (__visibleRect.Left() / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[4] = (__visibleRect.Top() / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - - __pVertices[8] = ((__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[9] = (__visibleRect.Top() / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - - __pVertices[13] = (__visibleRect.Left() / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[14] = ((__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - - __pVertices[18] = ((__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; - __pVertices[19] = ((__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; - } - } - } -#endif - - if (__pVertices[3] < 0.0f || __pVertices[4] < 0.0f || __pVertices[18] > 1.0f || __pVertices[19] > 1.0f) - { - __textureRepeated = true; - } - else - { - __textureRepeated = false; - } } } else @@ -642,144 +503,464 @@ _GlNode::SyncStatus(VisualElementSurface* pSurface, _VisualElementImpl& element) __pFilter = null; } - if (element.__decomposedMatrixToTop.GetMatrixType() >= MATRIX4_Scale || __pMesh) + ShaderProgram* pShaderProgram = element.GetSharedData().geometry.GetShaderProgram(); + + if (unlikely(pShaderProgram)) { - __useTransform = true; + if (!__pShaderProgram || !pShaderProgram->Equals(*__pShaderProgram)) + { + if (__pShaderProgram) + { + delete __pShaderProgram; + __pShaderProgram = null; + } + + __pShaderProgram = new (std::nothrow) ShaderProgram(*pShaderProgram); + SysAssertf(__pShaderProgram, "failed to create shader program"); + } } else { - __useTransform = false; + if (__pShaderProgram) + { + delete __pShaderProgram; + __pShaderProgram = null; + } } - // Set vertices - if (__useStencil) + CalcVertexCoordinates(element); + + if (__pMesh || __useTransform || __useStencil || __pFilter) { - if (__useTransform) + __findItemInQueue = false; + } + else + { + __findItemInQueue = true; + } + + __syncNeeded = false; + + return E_SUCCESS; +} + +VisualElementSurface* +_GlNode::GetSurface(void) const +{ + return __pSurface; +} + +void +_GlNode::CalcVertexCoordinates(_VisualElementImpl& element) +{ + float texX[4] = {0, }; + float texY[4] = {0, }; + float vertexX[4] = {0, }; + float vertexY[4] = {0, }; + int i = 0, index = 0, countX = 0, countY = 0; + int vertexCount, indexCount; + + if (__pSurface) + { + _VisualElementSurfaceImpl* pSurfaceImpl = _VisualElementSurfaceImpl::GetInstance(*__pSurface); + TextureInfo* pTextureInfo = reinterpret_cast(pSurfaceImpl->GetNativeHandle()); + +#ifdef __USE_TEXTURE_ATLAS__ + if (!pTextureInfo->atlas) { - __pVertices[0] = 0.0f; - __pVertices[1] = 0.0f; - __pVertices[2] = 0.0f; +#endif + if (__useStencil) + { + if (pTextureInfo->useBorder) + { + // TODO: consider the case: __bounds.width < left border + right border + texX[0] = 0.0f; + texX[1] = (float)pTextureInfo->leftBorder / (float)pTextureInfo->width; + texX[2] = (float)(pTextureInfo->width - pTextureInfo->rightBorder) / (float)pTextureInfo->width; + texX[3] = 1.0f; + + texY[0] = 0.0f; + texY[1] = (float)pTextureInfo->topBorder / (float)pTextureInfo->height; + texY[2] = (float)(pTextureInfo->height - pTextureInfo->bottomBorder) / (float)pTextureInfo->height; + texY[3] = 1.0f; + + vertexX[0] = 0.0f; + vertexX[1] = pTextureInfo->leftBorder; + vertexX[2] = __bounds.Width() - pTextureInfo->rightBorder; + vertexX[3] = __bounds.Width(); + + vertexY[0] = 0.0f; + vertexY[1] = pTextureInfo->topBorder; + vertexY[2] = __bounds.Height() - pTextureInfo->bottomBorder; + vertexY[3] = __bounds.Height(); + + countX = countY = 4; + + __textureRepeated = false; + } + else + { + if (element.__useContentBounds) + { + texX[0] = element.__contentBounds.x; + texX[1] = element.__contentBounds.x + element.__contentBounds.width; + + texY[0] = element.__contentBounds.y; + texY[1] = element.__contentBounds.y + element.__contentBounds.height; + + if (texX[0] < 0.0f || texY[0] < 0.0f || texX[1] > 1.0f || texY[1] > 1.0f) + { + __textureRepeated = true; + } + else + { + __textureRepeated = false; + } + } + else + { + texX[0] = 0.0f; + texX[1] = 1.0f; - __pVertices[5] = __bounds.Width(); - __pVertices[6] = 0.0f; - __pVertices[7] = 0.0f; + texY[0] = 0.0f; + texY[1] = 1.0f; + + __textureRepeated = false; + } - __pVertices[10] = 0.0f; - __pVertices[11] = __bounds.Height(); - __pVertices[12] = 0.0f; + vertexX[0] = 0.0f; + vertexX[1] = __bounds.Width(); - __pVertices[15] = __bounds.Width(); - __pVertices[16] = __bounds.Height(); - __pVertices[17] = 0.0f; + vertexY[0] = 0.0f; + vertexY[1] = __bounds.Height(); + + countX = countY = 2; + } + } + else + { + float x1 = __visibleRect.Left() / __bounds.Width(); + float y1 = __visibleRect.Top() / __bounds.Height(); + float x2 = __visibleRect.Right() / __bounds.Width(); + float y2 = __visibleRect.Bottom() / __bounds.Height(); + + if (pTextureInfo->useBorder) + { + // TODO: consider the case: __bounds.width < left border + right border + float borderX1 = (float)pTextureInfo->leftBorder / (float)pTextureInfo->width; + float borderY1 = (float)pTextureInfo->topBorder / (float)pTextureInfo->height; + float borderX2 = (float)(pTextureInfo->width - pTextureInfo->rightBorder) / (float)pTextureInfo->width; + float borderY2 = (float)(pTextureInfo->height - pTextureInfo->bottomBorder) / (float)pTextureInfo->height; + + if (x1 < borderX1) + { + texX[countX] = x1; + vertexX[countX++] = __visibleRect.Left(); + + texX[countX] = borderX1; + vertexX[countX++] = __visibleRect.Left() + (borderX1 - x1) * pTextureInfo->width; + } + else + { + texX[countX] = x1; + vertexX[countX++] = __visibleRect.Left(); + } + + if (x2 > borderX2) + { + texX[countX] = borderX2; + vertexX[countX++] = __visibleRect.Right() - (x2 - borderX2) * pTextureInfo->width; + + texX[countX] = x2; + vertexX[countX++] = __visibleRect.Right(); + } + else + { + texX[countX] = x2; + vertexX[countX++] = __visibleRect.Right(); + } + + if (y1 < borderY1) + { + texY[countY] = y1; + vertexY[countY++] = __visibleRect.Top(); + + texY[countY] = borderY1; + vertexY[countY++] = __visibleRect.Top() + (borderY1 - y1) * pTextureInfo->height; + } + else + { + texY[countY] = y1; + vertexY[countY++] = __visibleRect.Top(); + } + + if (y2 > borderY2) + { + texY[countY] = borderY2; + vertexY[countY++] = __visibleRect.Bottom() - (y2 - borderY2) * pTextureInfo->height; + + texY[countY] = y2; + vertexY[countY++] = __visibleRect.Bottom(); + } + else + { + texY[countY] = y2; + vertexY[countY++] = __visibleRect.Bottom(); + } + + __textureRepeated = false; + } + else + { + if (element.__useContentBounds) + { + texX[0] = element.__contentBounds.x + x1 * element.__contentBounds.width; + texX[1] = element.__contentBounds.x + x2 * element.__contentBounds.width; + + texY[0] = element.__contentBounds.y + y1 * element.__contentBounds.height; + texY[1] = element.__contentBounds.y + y2 * element.__contentBounds.height; + + if (texX[0] < 0.0f || texY[0] < 0.0f || texX[1] > 1.0f || texY[1] > 1.0f) + { + __textureRepeated = true; + } + else + { + __textureRepeated = false; + } + } + else + { + texX[0] = x1; + texX[1] = x2; + + texY[0] = y1; + texY[1] = y2; + + __textureRepeated = false; + } + + vertexX[0] = __visibleRect.Left(); + vertexX[1] = __visibleRect.Right(); + + vertexY[0] = __visibleRect.Top(); + vertexY[1] = __visibleRect.Bottom(); + + countX = countY = 2; + } + } +#ifdef __USE_TEXTURE_ATLAS__ } else { - __pVertices[0] = __transform.matrix[3][0]; - __pVertices[1] = __transform.matrix[3][1]; - __pVertices[2] = 0.0f; + _TextureAtlas* pAtlas = reinterpret_cast<_TextureAtlas*>(pTextureInfo->atlas); + + float atlasWidth = pAtlas->GetTextureInfo().width; + float atlasHeight = pAtlas->GetTextureInfo().height; + + // TODO: implement texture border code - __pVertices[5] = __transform.matrix[3][0] + __bounds.Width(); - __pVertices[6] = __transform.matrix[3][1]; - __pVertices[7] = 0.0f; + // use texture atlas + if (__useStencil) + { + if (element.__useContentBounds) + { + __pVertices[3] = (pTextureInfo->x + element.__contentBounds.x * pTextureInfo->width) / atlasWidth; + __pVertices[4] = (pTextureInfo->y + element.__contentBounds.y * pTextureInfo->height) / atlasHeight; - __pVertices[10] = __transform.matrix[3][0]; - __pVertices[11] = __transform.matrix[3][1] + __bounds.Height(); - __pVertices[12] = 0.0f; + __pVertices[8] = (pTextureInfo->x + (element.__contentBounds.x + element.__contentBounds.width) * pTextureInfo->width) / atlasWidth; + __pVertices[9] = (pTextureInfo->y + element.__contentBounds.y * pTextureInfo->height) / atlasHeight; - __pVertices[15] = __transform.matrix[3][0] + __bounds.Width(); - __pVertices[16] = __transform.matrix[3][1] + __bounds.Height(); - __pVertices[17] = 0.0f; + __pVertices[13] = (pTextureInfo->x + element.__contentBounds.x * pTextureInfo->width) / atlasWidth; + __pVertices[14] = (pTextureInfo->y + (element.__contentBounds.y + element.__contentBounds.height) * pTextureInfo->height) / atlasHeight; - __transform.matrix[3][0] = 0.0f; - __transform.matrix[3][1] = 0.0f; + __pVertices[18] = (pTextureInfo->x + (element.__contentBounds.x + element.__contentBounds.width) * pTextureInfo->width) / atlasWidth; + __pVertices[19] = (pTextureInfo->y + (element.__contentBounds.y + element.__contentBounds.height) * pTextureInfo->height) / atlasHeight; + + if (__pVertices[3] < 0.0f || __pVertices[4] < 0.0f || __pVertices[18] > 1.0f || __pVertices[19] > 1.0f) + { + __textureRepeated = true; + } + else + { + __textureRepeated = false; + } + } + else + { + __pVertices[3] = pTextureInfo->x / atlasWidth; + __pVertices[4] = pTextureInfo->y / atlasHeight; + + __pVertices[8] = (pTextureInfo->x + pTextureInfo->width) / atlasWidth; + __pVertices[9] = pTextureInfo->y / atlasHeight; + + __pVertices[13] = pTextureInfo->x / atlasWidth; + __pVertices[14] = (pTextureInfo->y + pTextureInfo->height) / atlasHeight; + + __pVertices[18] = (pTextureInfo->x + pTextureInfo->width) / atlasWidth; + __pVertices[19] = (pTextureInfo->y + pTextureInfo->height) / atlasHeight; + } + } + else + { + if (element.__useContentBounds) + { + __pVertices[3] = ((element.__contentBounds.x + __visibleRect.Left() / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[4] = ((element.__contentBounds.y + __visibleRect.Top() / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + __pVertices[8] = ((element.__contentBounds.x + (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[9] = ((element.__contentBounds.y + __visibleRect.Top() / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + __pVertices[13] = ((element.__contentBounds.x + __visibleRect.Left() / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[14] = ((element.__contentBounds.y + (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + __pVertices[18] = ((element.__contentBounds.x + (__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * element.__contentBounds.width) * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[19] = ((element.__contentBounds.y + (__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * element.__contentBounds.height) * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + if (__pVertices[3] < 0.0f || __pVertices[4] < 0.0f || __pVertices[18] > 1.0f || __pVertices[19] > 1.0f) + { + __textureRepeated = true; + } + else + { + __textureRepeated = false; + } + } + else + { + __pVertices[3] = (__visibleRect.Left() / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[4] = (__visibleRect.Top() / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + __pVertices[8] = ((__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[9] = (__visibleRect.Top() / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + __pVertices[13] = (__visibleRect.Left() / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[14] = ((__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + + __pVertices[18] = ((__visibleRect.Left() + __visibleRect.Width()) / __bounds.Width() * pTextureInfo->width + pTextureInfo->x) / atlasWidth; + __pVertices[19] = ((__visibleRect.Top() + __visibleRect.Height()) / __bounds.Height() * pTextureInfo->height + pTextureInfo->y) / atlasHeight; + } + } } +#endif } else { - if (__useTransform) + if (__useStencil) { - __pVertices[0] = __visibleRect.Left(); - __pVertices[1] = __visibleRect.Top(); - __pVertices[2] = 0.0f; - - __pVertices[5] = __visibleRect.Left() + __visibleRect.Width(); - __pVertices[6] = __visibleRect.Top(); - __pVertices[7] = 0.0f; - - __pVertices[10] = __visibleRect.Left(); - __pVertices[11] = __visibleRect.Top() + __visibleRect.Height(); - __pVertices[12] = 0.0f; + vertexX[0] = 0.0f; + vertexX[1] = __bounds.Width(); - __pVertices[15] = __visibleRect.Left() + __visibleRect.Width(); - __pVertices[16] = __visibleRect.Top() + __visibleRect.Height(); - __pVertices[17] = 0.0f; + vertexY[0] = 0.0f; + vertexY[1] = __bounds.Height(); } else { - __pVertices[0] = __transform.matrix[3][0] + __visibleRect.Left(); - __pVertices[1] = __transform.matrix[3][1] + __visibleRect.Top(); - __pVertices[2] = 0.0f; + vertexX[0] = __visibleRect.Left(); + vertexX[1] = __visibleRect.Right(); - __pVertices[5] = __transform.matrix[3][0] + __visibleRect.Left() + __visibleRect.Width(); - __pVertices[6] = __transform.matrix[3][1] + __visibleRect.Top(); - __pVertices[7] = 0.0f; + vertexY[0] = __visibleRect.Top(); + vertexY[1] = __visibleRect.Bottom(); + } - __pVertices[10] = __transform.matrix[3][0] + __visibleRect.Left(); - __pVertices[11] = __transform.matrix[3][1] + __visibleRect.Top() + __visibleRect.Height(); - __pVertices[12] = 0.0f; + countX = countY = 2; + } - __pVertices[15] = __transform.matrix[3][0] + __visibleRect.Left() + __visibleRect.Width(); - __pVertices[16] = __transform.matrix[3][1] + __visibleRect.Top() + __visibleRect.Height(); - __pVertices[17] = 0.0f; + if (element.__decomposedMatrixToTop.GetMatrixType() >= MATRIX4_Scale || __pMesh) + { + __useTransform = true; + } + else + { + __useTransform = false; - __transform.matrix[3][0] = 0.0f; - __transform.matrix[3][1] = 0.0f; + for (i = 0; i < countX; i++) + { + vertexX[i] += __transform.matrix[3][0]; + } + + for (i = 0; i < countY; i++) + { + vertexY[i] += __transform.matrix[3][1]; } + + __visibleRect.OffsetRect(__transform.matrix[3][0], __transform.matrix[3][1]); + + __transform.matrix[3][0] = 0.0f; + __transform.matrix[3][1] = 0.0f; } - ShaderProgram* pShaderProgram = element.GetSharedData().geometry.GetShaderProgram(); + vertexCount = countX * countY; + indexCount = (countX - 1) * (countY - 1) * 6; - if (unlikely(pShaderProgram)) + AllocateVertexBuffer(vertexCount, indexCount); + + // set vertex buffer + for (int y = 0; y < countY; y++) { - if (!__pShaderProgram || !pShaderProgram->Equals(*__pShaderProgram)) + for (int x = 0; x < countX; x++) { - if (__pShaderProgram) - { - delete __pShaderProgram; - __pShaderProgram = null; - } - - __pShaderProgram = new (std::nothrow) ShaderProgram(*pShaderProgram); - SysAssertf(__pShaderProgram, "failed to create shader program"); + // x, y, z + __pVertices[index++] = vertexX[x]; + __pVertices[index++] = vertexY[y]; + __pVertices[index++] = 0.0f; + + // s, t + __pVertices[index++] = texX[x]; + __pVertices[index++] = texY[y]; } } - else + + index = 0; + + // set index buffer + for (int y = 0; y < countY - 1; y++) { - if (__pShaderProgram) + i = y * countX; + + for (int x = 0; x < countX - 1; x++) { - delete __pShaderProgram; - __pShaderProgram = null; + __pIndices[index++] = i; + __pIndices[index++] = i + 1; + __pIndices[index++] = i + countX; + + __pIndices[index++] = i + 1; + __pIndices[index++] = i + countX; + __pIndices[index++] = i + countX + 1; + + i++; } } +} - if (__pMesh || __useTransform || __useStencil || __pFilter) - { - __findItemInQueue = false; - } - else +bool +_GlNode::AllocateVertexBuffer(int vertexCount, int indexCount) +{ + if (__vertexCount != vertexCount) { - __findItemInQueue = true; - } + if (__pVertices) + { + delete [] __pVertices; + __pVertices = null; + } - __syncNeeded = false; + __pVertices = new (std::nothrow) float[vertexCount * 5]; + SysTryReturnResult(NID_UI_ANIM, __pVertices, false, "[E_OUT_OF_MEMORY] Memory allocation failed."); - return E_SUCCESS; -} + if (__pIndices) + { + delete [] __pIndices; + __pIndices = null; + } -VisualElementSurface* -_GlNode::GetSurface(void) const -{ - return __pSurface; + __pIndices = new (std::nothrow) unsigned short int[indexCount]; + SysTryReturnResult(NID_UI_ANIM, __pIndices, false, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + __vertexCount = vertexCount; + __indexCount = indexCount; + } + + return true; } }}} // Tizen::Ui::Animations diff --git a/src/ui/animations/FUiAnim_GlNode.h b/src/ui/animations/FUiAnim_GlNode.h index e5d097f..44ed010 100644 --- a/src/ui/animations/FUiAnim_GlNode.h +++ b/src/ui/animations/FUiAnim_GlNode.h @@ -77,6 +77,10 @@ public: result SyncStatus(VisualElementSurface* pSurface, _VisualElementImpl& element); private: + void CalcVertexCoordinates(_VisualElementImpl& element); + bool AllocateVertexBuffer(int vertexCount, int indexCount); + +private: _GlNode(const _GlNode& rhs); // no impl. _GlNode& operator =(const _GlNode& rhs); // no impl. @@ -107,7 +111,10 @@ private: _Colorf __backgroundColor; _Colorf __objectColor; // These color values are premultiplied by alpha. - float __pVertices[20]; // (vertex (x, y, z), texture (s, t)) * 4 + float* __pVertices; // (vertex (x, y, z), texture (s, t)) + unsigned short int* __pIndices; + int __vertexCount; + int __indexCount; _NativeLayer* __pLayer; Tizen::Base::Collection::ArrayList __activeLight; diff --git a/src/ui/animations/FUiAnim_GlRenderManager.cpp b/src/ui/animations/FUiAnim_GlRenderManager.cpp index e3d4864..1edb604 100644 --- a/src/ui/animations/FUiAnim_GlRenderManager.cpp +++ b/src/ui/animations/FUiAnim_GlRenderManager.cpp @@ -61,7 +61,6 @@ #include "FUiAnimVisualElementFilter.h" #include "FUiAnim_VisualElementFilterImpl.h" - #include "FUiAnim_GlLoader.h" #include "FUiAnim_Debug.h" @@ -104,11 +103,10 @@ using namespace Tizen::Ui::Animations; #define CHECK_GL_CONTEXT() ASSERT(__pGlContext, "Invalid render manager status(no context)"); #endif -#define VERTEX_BUFFER_STRIDE 3 -#define TEX_COORD_BUFFER_STRIDE 2 - -#define VE_RENDER_OBJECT_VERTEX_COUNT_MAX 120 +#define VE_RENDER_OBJECT_VERTEX_COUNT_MAX 100 +#define VE_RENDER_OBJECT_INDEX_COUNT_MAX 150 #define VE_RENDER_QUEUE_COUNT_MAX 100 + #define OFFSET (UNIFORM_VEC3_LIGHT_ATTENUATION - UNIFORM_INT_LIGHT_TYPE + 1) #define SURF_IMPL(__SURF) static_cast<_GlVisualElementSurfaceImpl*>(_VisualElementSurfaceImpl::GetInstance(__SURF)) @@ -141,7 +139,7 @@ _GlRenderQueue::_RenderObject::_RenderObject(void) , __pMaterial(null) , __pFilter(null) , __pVertexBuffer(null) - , __pTexCoordBuffer(null) + , __pIndexBuffer(null) , __geoType(0) , __pVertices(null) , __pTexCoords(null) @@ -149,6 +147,9 @@ _GlRenderQueue::_RenderObject::_RenderObject(void) , __pNormals(null) , __pIndices(null) , __vertexCount(0) + , __indexCount(0) + , __vertexStride(0) + , __texCoordStride(0) , __pProgram(null) , __aPosition(-1) , __aTexCoord(-1) @@ -183,17 +184,17 @@ _GlRenderQueue::_RenderObject::Construct(void) { result r = E_SUCCESS; - __pVertexBuffer = new (std::nothrow) float[VE_RENDER_OBJECT_VERTEX_COUNT_MAX * VERTEX_BUFFER_STRIDE]; + __pVertexBuffer = new (std::nothrow) float[VE_RENDER_OBJECT_VERTEX_COUNT_MAX * 5]; SysTryCatch(NID_UI_ANIM, __pVertexBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - __pTexCoordBuffer = new (std::nothrow) float[VE_RENDER_OBJECT_VERTEX_COUNT_MAX * TEX_COORD_BUFFER_STRIDE]; - SysTryCatch(NID_UI_ANIM, __pTexCoordBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + __pIndexBuffer = new (std::nothrow) unsigned short int[VE_RENDER_OBJECT_INDEX_COUNT_MAX]; + SysTryCatch(NID_UI_ANIM, __pIndexBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); return E_SUCCESS; CATCH: delete [] __pVertexBuffer; - delete [] __pTexCoordBuffer; + delete [] __pIndexBuffer; return r; } @@ -204,8 +205,8 @@ _GlRenderQueue::_RenderObject::Release(void) delete [] __pVertexBuffer; __pVertexBuffer = null; - delete [] __pTexCoordBuffer; - __pTexCoordBuffer = null; + delete [] __pIndexBuffer; + __pIndexBuffer = null; return E_SUCCESS; } @@ -382,7 +383,6 @@ _GlRenderQueue::_RenderObject::GetShaderProgram(int type) void _GlRenderQueue::_RenderObject::SetObject(_GlNode* pNode, bool useStencil, unsigned int stencilIndex, bool colorMask) { - int vertexIndex = 0, textureIndex = 0; int shaderType = 0; static _GlCompositor* pCompositor = null; @@ -449,38 +449,19 @@ _GlRenderQueue::_RenderObject::SetObject(_GlNode* pNode, bool useStencil, unsign __useDepthTest = false; __pMesh = null; - __bounds.SetRect(pNode->__pVertices[0], pNode->__pVertices[1], - pNode->__pVertices[15] - pNode->__pVertices[0], pNode->__pVertices[16] - pNode->__pVertices[1]); - - __vertexCount = 6; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[0]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[1]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[2]; + __bounds = pNode->__visibleRect; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[5]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[6]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[7]; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[10]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[11]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[12]; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[5]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[6]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[7]; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[10]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[11]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[12]; + __geoType = GL_TRIANGLES; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[15]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[16]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[17]; + memcpy(__pVertexBuffer, pNode->__pVertices, pNode->__vertexCount * 5 * sizeof(float)); + memcpy(__pIndexBuffer, pNode->__pIndices, pNode->__indexCount * sizeof(unsigned short int)); - __geoType = GL_TRIANGLES; + __vertexStride = 5 * sizeof(float); + __vertexCount = pNode->__vertexCount; + __indexCount = pNode->__indexCount; __pVertices = __pVertexBuffer; + __pIndices = __pIndexBuffer; if (pNode->__pSurface) { @@ -505,25 +486,8 @@ _GlRenderQueue::_RenderObject::SetObject(_GlNode* pNode, bool useStencil, unsign __isTexUpdated = false; } - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[3]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[4]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[8]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[9]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[13]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[14]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[8]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[9]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[13]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[14]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[18]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[19]; - - __pTexCoords = __pTexCoordBuffer; + __pTexCoords = &(__pVertexBuffer[3]); + __texCoordStride = 5 * sizeof(float); if (_FloatCompare(pNode->__opacity, 1.0f)) { @@ -597,10 +561,11 @@ _GlRenderQueue::_RenderObject::SetObject(_GlNode* pNode, bool useStencil, unsign return; } - __pVertices = pMeshImpl->__pVertices; - __vertexCount = pMeshImpl->__countOfVertex; + __pVertices = pMeshImpl->__pVertices; + __vertexStride = 3 * sizeof(float); + if (pNode->__pSurface && pMeshImpl->IsTextureCoordinateEnabled()) { __pSurfaceInfo = SURF_IMPL(*pNode->__pSurface); @@ -625,6 +590,7 @@ _GlRenderQueue::_RenderObject::SetObject(_GlNode* pNode, bool useStencil, unsign } __pTexCoords = pMeshImpl->__pTexCoordinates; + __texCoordStride = 2 * sizeof(float); if (_FloatCompare(pNode->__opacity, 1.0f)) { @@ -737,7 +703,8 @@ _GlRenderQueue::_RenderObject::SetObject(_GlNode* pNode, bool useStencil, unsign { __pProgram = GetShaderProgram(shaderType); } - if(__pProgram) + + if (__pProgram) { __pProgram = new ShaderProgram(*__pProgram); @@ -835,62 +802,19 @@ _GlRenderQueue::_RenderObject::ResetObject(void) void _GlRenderQueue::_RenderObject::AddVertices(_GlNode* pNode) { - int vertexIndex, textureIndex; - - vertexIndex = __vertexCount * VERTEX_BUFFER_STRIDE; - textureIndex = __vertexCount * TEX_COORD_BUFFER_STRIDE; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[0]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[1]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[2]; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[5]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[6]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[7]; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[10]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[11]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[12]; - - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[5]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[6]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[7]; + float* pVertexBuffer = __pVertexBuffer + __vertexCount * 5; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[10]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[11]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[12]; + memcpy(pVertexBuffer, pNode->__pVertices, pNode->__vertexCount * 5 * sizeof(float)); - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[15]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[16]; - __pVertexBuffer[vertexIndex++] = pNode->__pVertices[17]; - - if (pNode->__pSurface) + for (int i = 0; i < pNode->__indexCount; i++) { - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[3]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[4]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[8]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[9]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[13]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[14]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[8]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[9]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[13]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[14]; - - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[18]; - __pTexCoordBuffer[textureIndex++] = pNode->__pVertices[19]; + __pIndexBuffer[__indexCount + i] = pNode->__pIndices[i] + __vertexCount; } - __vertexCount += 6; - - _Rectanglef bounds = _Rectanglef(pNode->__pVertices[0], pNode->__pVertices[1], - pNode->__pVertices[15] - pNode->__pVertices[0], pNode->__pVertices[16] - pNode->__pVertices[1]); + __vertexCount += pNode->__vertexCount; + __indexCount += pNode->__indexCount; - __bounds.Union(bounds); + __bounds.Union(pNode->__visibleRect); return; } @@ -971,7 +895,8 @@ _GlRenderQueue::FindRenderObject(_GlNode* pNode) // && __pRenderQueue[index].__pMaterial == pNode->__pMaterial // TODO: check light ) { - if (unlikely(__pRenderQueue[index].__vertexCount >= VE_RENDER_OBJECT_VERTEX_COUNT_MAX - 6)) + if (unlikely(__pRenderQueue[index].__vertexCount >= VE_RENDER_OBJECT_VERTEX_COUNT_MAX - pNode->__vertexCount + || __pRenderQueue[index].__indexCount >= VE_RENDER_OBJECT_INDEX_COUNT_MAX - pNode->__indexCount)) { PRINT("_GlRenderManager::FindRenderObject: Vertex buffer is full. Use next slot.\n"); return -1; @@ -981,7 +906,7 @@ _GlRenderQueue::FindRenderObject(_GlNode* pNode) return index; } - if (__pRenderQueue[index].__bounds.IsIntersected(bounds)) + if (__pRenderQueue[index].__bounds.IsIntersected(pNode->__visibleRect)) { return -1; } @@ -1118,6 +1043,14 @@ _GlRenderManager::_GlRenderManager(void) // __pTempNode->__pVertices[18] = 1.0f; // __pTempNode->__pVertices[19] = 1.0f; + // index buffer +// __pTempNode->__pIndices[0] = 0; +// __pTempNode->__pIndices[1] = 1; +// __pTempNode->__pIndices[2] = 2; +// __pTempNode->__pIndices[3] = 1; +// __pTempNode->__pIndices[4] = 2; +// __pTempNode->__pIndices[5] = 3; + // __pTempNode->__transform.SetAsIdentity(); // __pTempNode->__useTransform = false; // __pTempNode->__textureRepeated = false; @@ -1518,8 +1451,8 @@ _GlRenderManager::CommandHandlerFlush(void)//(_GlLayer* pLayer) pGlContext->UseShaderProgram(pProgramImpl); // Set attribute - glVertexAttribPointer(pRenderObjects[i].__aPosition, 3, GL_FLOAT, GL_FALSE, VERTEX_BUFFER_STRIDE * sizeof(float), pRenderObjects[i].__pVertices); - glVertexAttribPointer(pRenderObjects[i].__aTexCoord, 2, GL_FLOAT, GL_FALSE, TEX_COORD_BUFFER_STRIDE * sizeof(float), pRenderObjects[i].__pTexCoords); + glVertexAttribPointer(pRenderObjects[i].__aPosition, 3, GL_FLOAT, GL_FALSE, pRenderObjects[i].__vertexStride, pRenderObjects[i].__pVertices); + glVertexAttribPointer(pRenderObjects[i].__aTexCoord, 2, GL_FLOAT, GL_FALSE, pRenderObjects[i].__texCoordStride, pRenderObjects[i].__pTexCoords); glVertexAttribPointer(pRenderObjects[i].__aColor, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), pRenderObjects[i].__pColors); glVertexAttribPointer(pRenderObjects[i].__aNormal, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), pRenderObjects[i].__pNormals); diff --git a/src/ui/animations/FUiAnim_GlRenderManager.h b/src/ui/animations/FUiAnim_GlRenderManager.h index 8401a68..8cff117 100644 --- a/src/ui/animations/FUiAnim_GlRenderManager.h +++ b/src/ui/animations/FUiAnim_GlRenderManager.h @@ -39,7 +39,6 @@ #include "FUiAnim_ShaderProgramGenerator.h" #include "FUiAnim_InternalTypes.h" - #define MAX_LIGHT_COUNT 8 namespace Tizen { namespace Ui { namespace Animations @@ -272,7 +271,7 @@ public: float* __pVertexBuffer; - float* __pTexCoordBuffer; + unsigned short int* __pIndexBuffer; unsigned int __geoType; @@ -284,6 +283,8 @@ public: int __vertexCount; int __indexCount; + int __vertexStride; + int __texCoordStride; ShaderProgram* __pProgram; diff --git a/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp b/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp index c75dfd6..308dc9e 100644 --- a/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp +++ b/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp @@ -46,6 +46,7 @@ //#define PRINT(...) fprintf(stderr, __VA_ARGS__) #define PRINT(...) + #define TEXTURE_MIN_SIZE 120 #define DEFAULT_BPP_32 32 @@ -62,6 +63,7 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con : _VisualElementSurfaceImpl(size) , __textureInfo() , __pLayer(null) + , __imageName() { ClearLastResult(); @@ -90,6 +92,7 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con __textureInfo.fboId = 0; __textureInfo.depthBufferId = 0; __textureInfo.stencilBufferId = 0; + __textureInfo.useBorder = false; #ifdef VE_USE_GL_MULTI_CONTEXT __textureInfo.pGlContext = (_GlContext*)__pLayer->GetContext(); @@ -139,6 +142,7 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con : _VisualElementSurfaceImpl(size) , __textureInfo() , __pLayer(null) + , __imageName() { ClearLastResult(); @@ -167,7 +171,7 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con __textureInfo.fboId = 0; __textureInfo.depthBufferId = 0; __textureInfo.stencilBufferId = 0; - + __textureInfo.useBorder = false; #ifdef VE_USE_GL_MULTI_CONTEXT __textureInfo.pGlContext = (_GlContext*)__pLayer->GetContext(); @@ -183,7 +187,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con { SysAssertf(false, "Cannot initialize GL texture for surface"); } - } #ifndef BUILD_UI_CORE @@ -191,6 +194,7 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con : _VisualElementSurfaceImpl(FloatDimension(bitmap.GetWidthF(),bitmap.GetHeightF())) , __textureInfo() , __pLayer(null) + , __imageName() { ClearLastResult(); @@ -203,6 +207,7 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con __textureInfo.fboId = 0; __textureInfo.depthBufferId = 0; __textureInfo.stencilBufferId = 0; + __textureInfo.useBorder = false; #ifdef VE_USE_GL_MULTI_CONTEXT __textureInfo.pGlContext = (_GlContext*)__pLayer->GetContext(); @@ -214,7 +219,6 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const Handle layer, con __textureInfo.type = TEXTURE_NORMAL; //#endif - // WARNING: By default, we assume 32bit-packed stride (for Osp 2.0 compatibility and etc.) Tizen::Graphics::Bitmap* pBitmap = _BitmapImpl::CloneN(bitmap); diff --git a/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.h b/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.h index 4024657..c5b6ac1 100644 --- a/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.h +++ b/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.h @@ -69,6 +69,12 @@ struct TextureInfo void* atlas; int atlasId; int atlasIndex; + + bool useBorder; + int leftBorder; + int rightBorder; + int topBorder; + int bottomBorder; }; class _GlVisualElementSurfaceImpl