Register pixelSnapFactor as default text-visual shaders 37/324437/1
authorEunki Hong <eunkiki.hong@samsung.com>
Sat, 17 May 2025 11:49:50 +0000 (20:49 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Sat, 17 May 2025 11:50:15 +0000 (20:50 +0900)
The property "pixelSnapFactor" only be used for TextLabel.
But if some control try to use TextVisual, that value not be registered.

To resolve this issue, we need to register the default values
to the TextVisual's shader class.

Change-Id: Ic178144a9a06a9addf28222f0d280d8df707e927
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/visuals/text/text-visual-shader-factory.cpp

index d4964d1aeff705087311d6ad3a865b182f7346be..ba01b612431f8a4a2e31be3d6602439fe8a68eed 100644 (file)
@@ -30,6 +30,9 @@ namespace Internal
 {
 namespace
 {
+constexpr std::string_view PIXEL_SNAP_FACTOR_UNIFORM_NAME = "pixelSnapFactor";
+constexpr float            PIXEL_SNAP_DISABLED_VALUE(0.0f);
+
 // enum of required list when we select shader
 enum class TextVisualRequireFlag : uint32_t
 {
@@ -180,6 +183,9 @@ Shader TextVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, cons
     std::string fragmentShader = std::string(Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_TEXT_VISUAL_SHADER_FRAG.data());
 
     shader = factoryCache.GenerateAndSaveShader(shaderType, vertexShader, fragmentShader);
+
+    // Register property which only textlabel used.
+    shader.RegisterProperty(PIXEL_SNAP_FACTOR_UNIFORM_NAME.data(), PIXEL_SNAP_DISABLED_VALUE);
   }
   return shader;
 }