Corrects the position. 36/238436/9
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 14 Jul 2020 07:33:59 +0000 (16:33 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Mon, 20 Jul 2020 01:01:56 +0000 (01:01 +0000)
This required correction as the advance value changed after the patch
https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-adaptor/+/236448/

And after applying this patch, there is a pixel alignment issue in TextField.
So I add a sampler NEAREST.

Change-Id: I314cd9bf5d4db9a2b7ab04b6581ac63dd1bd886a

automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp [changed mode: 0644->0755]
dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h [changed mode: 0644->0755]

index 647b9e8..2ab84e7 100755 (executable)
@@ -414,7 +414,7 @@ int UtcDaliGetClosestCursorIndex(void)
                                       CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP };
   CharacterIndex logicalIndex04[] = {    0,  5u,  6u, 11u, 11u,
                                        12u, 16u, 17u, 21u, 21u,
-                                       22u, 25u, 30u, 32u, 35u, 33u, 40u,
+                                       22u, 25u, 31u, 32u, 35u, 34u, 40u,
                                        41u };
   bool isCharacterHit04[] = { false, true, true, true, false,
                               false, true, true, true, false,
@@ -453,7 +453,7 @@ int UtcDaliGetClosestCursorIndex(void)
                                       CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP };
   CharacterIndex logicalIndex05[] = {    0,  10u,  19u,  28u,  39u,  44u,
                                        45u,  49u,  59u,  66u,  78u,  87u,
-                                       89u,  96u, 107u, 115u, 124u, 133u,
+                                       89u,  96u, 106u, 115u, 124u, 133u,
                                       134u, 145u, 154u, 162u, 171u, 179u,
                                       180u, 184u, 191u, 203u, 212u,
                                       221u, 222u, 233u, 240u, 251u, 265u };
index 763a5ac..05226d4 100755 (executable)
@@ -199,7 +199,7 @@ bool LayoutTextTest( const LayoutTextData& data )
   {
     const Vector2& position = *( glyphPositions.Begin() + index );
 
-    if( fabsf( position.x - *( data.positions + 2u * index ) ) > Math::MACHINE_EPSILON_1000 )
+    if( fabsf( std::round( position.x ) - *( data.positions + 2u * index ) ) > Math::MACHINE_EPSILON_1000 )
     {
       std::cout << "  Different position for glyph " << index << " x : " << position.x << ", expected : " << *( data.positions + 2u * index ) << std::endl;
       return false;
index 07779ea..f243f08 100755 (executable)
@@ -583,13 +583,13 @@ int UtcDaliTextViewModelElideText02(void)
   Size textSize00( 100.f, 100.f );
 
   Size textSize01( 80.f, 100.f );
-  float positions01[] = { 0.f, 8.f, 17.f, 27.f, 35.f, 43.f, 47.f, 58.f, 64.0f };
+  float positions01[] = { 0.f, 8.f, 16.f, 26.f, 34.f, 43.f, 47.f, 58.f, 64.0f };
 
   Size textSize02( 80.f, 100.f );
-  float positions02[] = { 69.f, 63.f, 58.f, 49.f, 45.f, 41.f, 32.f, 23.f, 8.f };
+  float positions02[] = { 69.f, 63.f, 58.f, 50.f, 45.f, 41.f, 32.f, 23.f, 9.f };
 
   Size textSize03( 80.f, 100.f );
-  float positions03[] = { 55.f, 48.f, 44.f, 42.f, 36.f, 29.f, 26.f, 20.f, 13.f, 8.f, 4.f, 6.f };
+  float positions03[] = { 54.f, 47.f, 44.f, 41.f, 36.f, 29.f, 25.f, 20.f, 13.f, 8.f, 4.f, 6.f };
 
   Size textSize04( 80.f, 10.f );
   float positions04[] = { 2.f };
index fb63d96..e13c842 100755 (executable)
@@ -670,7 +670,7 @@ struct Engine::Impl
       const GlyphInfo& glyph = *( glyphsBuffer + i );
       Vector2& position = *( glyphPositionsBuffer + i );
 
-      position.x = std::roundf( penX + glyph.xBearing );
+      position.x = penX + glyph.xBearing;
       position.y = -glyph.yBearing;
 
       penX += ( glyph.advance + interGlyphExtraAdvance );
@@ -732,7 +732,7 @@ struct Engine::Impl
         const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
         Vector2& position = *( glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex );
 
-        position.x = std::round( penX + glyph.xBearing );
+        position.x = penX + glyph.xBearing;
         position.y = -glyph.yBearing;
 
        penX += ( glyph.advance + layoutParameters.interGlyphExtraAdvance );
old mode 100644 (file)
new mode 100755 (executable)
index 3fd324d..a972810
@@ -41,6 +41,8 @@ namespace Internal
 AtlasGlyphManager::AtlasGlyphManager()
 {
   mAtlasManager = Dali::Toolkit::AtlasManager::New();
+  mSampler = Sampler::New();
+  mSampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
 }
 
 void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
@@ -58,6 +60,7 @@ void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
     Dali::Texture atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId );
     TextureSet textureSet = TextureSet::New();
     textureSet.SetTexture( 0u, atlas );
+    textureSet.SetSampler( 0u, mSampler);
     mAtlasManager.SetTextures( slot.mAtlasId, textureSet );
   }
 
old mode 100644 (file)
new mode 100755 (executable)
index 3d2613e..e78b095
@@ -134,6 +134,7 @@ private:
   Dali::Toolkit::AtlasManager mAtlasManager;          ///> Atlas Manager created by GlyphManager
   std::vector< FontGlyphRecord > mFontGlyphRecords;
   Toolkit::AtlasGlyphManager::Metrics mMetrics;       ///> Metrics to pass back on GlyphManager status
+  Sampler mSampler;
 };
 
 } // namespace Internal