Merge "Let we make WebView invisible if window is hide" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / atlas / text-atlas-renderer.cpp
index 1d8731d..5788d33 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -22,6 +22,7 @@
 #include <dali/devel-api/text-abstraction/font-client.h>
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/math/math-utils.h>
 #include <dali/public-api/rendering/geometry.h>
 #include <dali/public-api/rendering/renderer.h>
 #include <map>
@@ -204,7 +205,7 @@ struct AtlasRenderer::Impl
       if(!isOutline || (isOutline && !isColorGlyph))
       {
         // Retrieve the emoji's bitmap.
-        TextAbstraction::FontClient::GlyphBufferData glyphBufferData;
+        TextAbstraction::GlyphBufferData glyphBufferData;
         glyphBufferData.width  = isColorGlyph ? glyph.width : 0; // Desired width and height.
         glyphBufferData.height = isColorGlyph ? glyph.height : 0;
 
@@ -217,12 +218,12 @@ struct AtlasRenderer::Impl
 
         uint32_t glyphBufferSize = glyphBufferData.width * glyphBufferData.height * Pixel::GetBytesPerPixel(glyphBufferData.format);
         // If glyph buffer data don't have ownership, Or if we need to decompress, create new memory and replace ownership.
-        if(!glyphBufferData.isBufferOwned || glyphBufferData.compressionType != TextAbstraction::FontClient::GlyphBufferData::CompressionType::NO_COMPRESSION)
+        if(!glyphBufferData.isBufferOwned || glyphBufferData.compressionType != TextAbstraction::GlyphBufferData::CompressionType::NO_COMPRESSION)
         {
           uint8_t* newBuffer = (uint8_t*)malloc(glyphBufferSize);
           if(DALI_LIKELY(newBuffer != nullptr))
           {
-            TextAbstraction::FontClient::GlyphBufferData::Decompress(glyphBufferData, newBuffer);
+            TextAbstraction::GlyphBufferData::Decompress(glyphBufferData, newBuffer);
             if(glyphBufferData.isBufferOwned)
             {
               // Release previous buffer
@@ -230,7 +231,7 @@ struct AtlasRenderer::Impl
             }
             glyphBufferData.isBufferOwned   = true;
             glyphBufferData.buffer          = newBuffer;
-            glyphBufferData.compressionType = TextAbstraction::FontClient::GlyphBufferData::CompressionType::NO_COMPRESSION;
+            glyphBufferData.compressionType = TextAbstraction::GlyphBufferData::CompressionType::NO_COMPRESSION;
           }
         }
 
@@ -581,7 +582,7 @@ struct AtlasRenderer::Impl
       thereAreStrikethroughGlyphs                                                 = thereAreStrikethroughGlyphs || isGlyphStrikethrough;
 
       // No operation for white space
-      if(glyph.width && glyph.height)
+      if(!Dali::EqualsZero(glyph.width) && !Dali::EqualsZero(glyph.height))
       {
         // Check and update decorative-lines informations
         if(isGlyphUnderlined || isGlyphStrikethrough)
@@ -846,7 +847,7 @@ struct AtlasRenderer::Impl
       // The glyph is an emoji and is not a shadow.
       if(!mShaderRgba)
       {
-        mShaderRgba = Shader::New(SHADER_TEXT_ATLAS_SHADER_VERT, SHADER_TEXT_ATLAS_RGBA_SHADER_FRAG);
+        mShaderRgba = Shader::New(SHADER_TEXT_ATLAS_SHADER_VERT, SHADER_TEXT_ATLAS_RGBA_SHADER_FRAG, Shader::Hint::NONE, "TEXT_ATLAS_RGBA");
       }
       shader = mShaderRgba;
     }
@@ -855,7 +856,7 @@ struct AtlasRenderer::Impl
       // The glyph is text or a shadow.
       if(!mShaderL8)
       {
-        mShaderL8 = Shader::New(SHADER_TEXT_ATLAS_SHADER_VERT, SHADER_TEXT_ATLAS_L8_SHADER_FRAG);
+        mShaderL8 = Shader::New(SHADER_TEXT_ATLAS_SHADER_VERT, SHADER_TEXT_ATLAS_L8_SHADER_FRAG, Shader::Hint::NONE, "TEXT_ATLAS_L8");
       }
       shader = mShaderL8;
     }