X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fnpatch%2Fnpatch-visual.cpp;h=bca8d0376eabf49ad11a01fbd6464578f20fae50;hp=4325dea15f2f73464f500eada3aac36f0a4e5e8e;hb=1d71a8f7d7abd7729aa645ad062e530958097214;hpb=34a12208b79153fd97e8d1572baf6c25dda1f4f0 diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp index 4325dea..bca8d03 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -20,16 +20,16 @@ // EXTERNAL INCLUDES #include +#include #include #include -#include // INTERNAL INCLUDES +#include #include #include #include #include -#include #include #include #include @@ -44,6 +44,10 @@ namespace Toolkit { namespace Internal { +namespace +{ +const int CUSTOM_PROPERTY_COUNT(10); // 5 transform properties + fixed(3),stretch,aux +} /////////////////NPatchVisual//////////////// @@ -294,10 +298,10 @@ void NPatchVisual::OnInitialize() Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); Shader shader = mImageVisualShaderFactory.GetShader( mFactoryCache, - ImageVisualShaderFeature::FeatureBuilder() - ); + ImageVisualShaderFeature::FeatureBuilder()); mImpl->mRenderer = Renderer::New(geometry, shader); + mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT); //Register transform properties mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT); @@ -337,12 +341,12 @@ Geometry NPatchVisual::CreateGeometry() Uint16Pair gridSize(2 * data->GetStretchPixelsX().Size() + 1, 2 * data->GetStretchPixelsY().Size() + 1); if(!data->GetRenderingMap()) { - geometry = !mBorderOnly ? NPatchHelper::CreateGridGeometry(gridSize) : NPatchHelper::CreateBorderGeometry(gridSize); + geometry = !mBorderOnly ? NPatchHelper::CreateGridGeometry(gridSize) : NPatchHelper::CreateBorderGeometry(gridSize); } else { uint32_t elementCount[2]; - geometry = !mBorderOnly ? RenderingAddOn::Get().CreateGeometryGrid(data->GetRenderingMap(), gridSize, elementCount) : NPatchHelper::CreateBorderGeometry(gridSize); + geometry = !mBorderOnly ? RenderingAddOn::Get().CreateGeometryGrid(data->GetRenderingMap(), gridSize, elementCount) : NPatchHelper::CreateBorderGeometry(gridSize); if(mImpl->mRenderer) { RenderingAddOn::Get().SubmitRenderTask(mImpl->mRenderer, data->GetRenderingMap()); @@ -369,8 +373,8 @@ Shader NPatchVisual::CreateShader() auto fragmentShader = mAuxiliaryPixelBuffer ? SHADER_NPATCH_VISUAL_MASK_SHADER_FRAG : SHADER_NPATCH_VISUAL_SHADER_FRAG; - auto shaderType = mAuxiliaryPixelBuffer ? VisualFactoryCache::NINE_PATCH_MASK_SHADER - : VisualFactoryCache::NINE_PATCH_SHADER; + auto shaderType = mAuxiliaryPixelBuffer ? VisualFactoryCache::NINE_PATCH_MASK_SHADER + : VisualFactoryCache::NINE_PATCH_SHADER; // ask loader for the regions if(mLoader.GetNPatchData(mId, data)) @@ -453,19 +457,13 @@ void NPatchVisual::ApplyTextureAndUniforms() DALI_LOG_ERROR("The N patch image '%s' is not a valid N patch image\n", mImageUrl.GetUrl().c_str()); textureSet = TextureSet::New(); - Actor actor = mPlacementActor.GetHandle(); + Actor actor = mPlacementActor.GetHandle(); Vector2 imageSize = Vector2::ZERO; if(actor) { imageSize = actor.GetProperty(Actor::Property::SIZE).Get(); } mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize); - Texture croppedImage = mImpl->mRenderer.GetTextures().GetTexture(0); - textureSet.SetTexture(0u, croppedImage); - mImpl->mRenderer.RegisterProperty("uFixed[0]", Vector2::ZERO); - mImpl->mRenderer.RegisterProperty("uFixed[1]", Vector2::ZERO); - mImpl->mRenderer.RegisterProperty("uFixed[2]", Vector2::ZERO); - mImpl->mRenderer.RegisterProperty("uStretchTotal", Vector2(croppedImage.GetWidth(), croppedImage.GetHeight())); } if(mAuxiliaryPixelBuffer) @@ -556,7 +554,7 @@ void NPatchVisual::LoadComplete(bool loadSuccess, TextureInformation textureInfo SetResource(); } } - else // for the ReturnType::PIXEL_BUFFER + else // for the ReturnType::PIXEL_BUFFER { if(loadSuccess && textureInformation.url == mAuxiliaryUrl.GetUrl()) {