X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fshader-effects%2Fimage-region-effect.h;h=30d5f4e668358554e1a0a7b768d3a10afc1a8cc6;hb=5359a575636e678baf178dab5209b587be1a7551;hp=af2c1e9caed2b20220bb3795cffe480204aa6587;hpb=11ed6421771d05113ae1a6510167d8c2557ac20e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/shader-effects/image-region-effect.h b/dali-toolkit/devel-api/shader-effects/image-region-effect.h index af2c1e9..30d5f4e 100644 --- a/dali-toolkit/devel-api/shader-effects/image-region-effect.h +++ b/dali-toolkit/devel-api/shader-effects/image-region-effect.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__ -#define __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__ +#ifndef DALI_TOOLKIT_IMAGE_REGION_EFFECT_H +#define DALI_TOOLKIT_IMAGE_REGION_EFFECT_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -26,10 +26,8 @@ namespace Dali { - namespace Toolkit { - /** * @brief Creates a new ImageRegionEffect * @@ -41,44 +39,43 @@ namespace Toolkit * "uBottomRight" - The bottom-right corner of the image region. The coordinates are in percentage, * (0,0) being the top-left and (1,1) the bottom right of the original image * - * @return A handle to a newly allocated ShaderEffect + * @return A property map of the required shader */ inline Property::Map CreateImageRegionEffect() { std::string vertexShader( - "attribute mediump vec2 aPosition;\n" - "\n" - "uniform mediump mat4 uMvpMatrix;\n" - "uniform vec3 uSize;\n" - "uniform vec4 uTextureRect;" - "\n" - "varying vec2 vTexCoord;\n" + "attribute mediump vec2 aPosition;\n" + "\n" + "uniform mediump mat4 uMvpMatrix;\n" + "uniform vec3 uSize;\n" + "uniform vec4 uTextureRect;" + "\n" + "varying vec2 vTexCoord;\n" - "uniform mediump vec2 uTopLeft;\n" - "uniform mediump vec2 uBottomRight;\n" - "void main()\n" - "{\n" - " mediump vec4 position = vec4(aPosition, 0.0, 1.0);\n" - " position.xyz *= uSize;\n" - " gl_Position = uMvpMatrix * position;\n" - // The line below is doing the same as the following commented lines: - //" vec2 imageSize = uTextureRect.zw - uTextureRect.xy;\n" - //" vec2 topLeft = uTextureRect.xy + uTopLeft * imageSize;\n" - //" vec2 bottomRight = uTextureRect.xy + uBottomRight * imageSize;\n" - //" vec2 texCoord = (aTexCoord - uTextureRect.xy) / imageSize;\n" - //" vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n" + "uniform mediump vec2 uTopLeft;\n" + "uniform mediump vec2 uBottomRight;\n" + "void main()\n" + "{\n" + " mediump vec4 position = vec4(aPosition, 0.0, 1.0);\n" + " position.xyz *= uSize;\n" + " gl_Position = uMvpMatrix * position;\n" + // The line below is doing the same as the following commented lines: + //" vec2 imageSize = uTextureRect.zw - uTextureRect.xy;\n" + //" vec2 topLeft = uTextureRect.xy + uTopLeft * imageSize;\n" + //" vec2 bottomRight = uTextureRect.xy + uBottomRight * imageSize;\n" + //" vec2 texCoord = (aTexCoord - uTextureRect.xy) / imageSize;\n" + //" vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n" - " vec2 texCoord = aPosition + vec2(0.5);\n" - " vTexCoord = uTextureRect.xy + uTopLeft * ( uTextureRect.zw - uTextureRect.xy ) + ( texCoord - uTextureRect.xy ) * ( uBottomRight - uTopLeft );\n" - "}\n" - ); + " vec2 texCoord = aPosition + vec2(0.5);\n" + " vTexCoord = uTextureRect.xy + uTopLeft * ( uTextureRect.zw - uTextureRect.xy ) + ( texCoord - uTextureRect.xy ) * ( uBottomRight - uTopLeft );\n" + "}\n"); Property::Map map; Property::Map customShader; - customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexShader; + customShader[Visual::Shader::Property::VERTEX_SHADER] = vertexShader; - map[ Visual::Property::SHADER ] = customShader; + map[Toolkit::Visual::Property::SHADER] = customShader; return map; } @@ -86,4 +83,4 @@ inline Property::Map CreateImageRegionEffect() } // namespace Dali -#endif // __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__ +#endif // DALI_TOOLKIT_IMAGE_REGION_EFFECT_H