From 8edbfdd834492e432f26e7566f25c00c64f10287 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Thu, 18 Jun 2020 16:19:21 +0900 Subject: [PATCH 01/16] The advance of the letters is too narrow. So, remove the floor. Change-Id: Ia45a2a9af47f3f780c562cd619dda82f8a017a37 --- .../utc-Dali-DebugRendering.cpp | 4 +- .../utc-Dali-Text-Controller.cpp | 20 +- .../dali-toolkit-internal/utc-Dali-Text-Cursor.cpp | 42 +- .../dali-toolkit-internal/utc-Dali-Text-Layout.cpp | 480 ++++++++++----------- .../utc-Dali-Text-Shaping.cpp | 4 +- .../utc-Dali-Text-ViewModel.cpp | 26 +- .../src/dali-toolkit/utc-Dali-TextLabel.cpp | 2 +- 7 files changed, 289 insertions(+), 289 deletions(-) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp index 8b119d4..dc56382 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp @@ -187,10 +187,10 @@ int UtcDaliDebugRenderingGetVisual1(void) Vector2 naturalSize; textVisual.GetNaturalSize( naturalSize ); - DALI_TEST_EQUALS( naturalSize, Vector2( 78.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( naturalSize, Vector2( 82.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION ); const float height = textVisual.GetHeightForWidth( 40.f ); - DALI_TEST_EQUALS( height, 38.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( height, 57.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); // Test that NPatchVisual is replaced with debug visual // TEST_NPATCH_FILE_NAME: image_01.9.jpg diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 5db928d..b32e328 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -679,8 +679,8 @@ int UtcDaliTextControllerSetGetLineSpacingProperty(void) // single line, line spacing = 0px { const float EXPECTED_SPACING = 0.0f; - const Vector2 EXPECTED_LAYOUT_SIZE( 342.0f, 19.0f); - const Vector3 EXPECTED_NATURAL_SIZE( 342.0f, 20.0f, 0.0f ); + const Vector2 EXPECTED_LAYOUT_SIZE( 360.0f, 19.0f); + const Vector3 EXPECTED_NATURAL_SIZE( 360.0f, 20.0f, 0.0f ); controller->SetText(textSingle); controller->Relayout(size); @@ -698,8 +698,8 @@ int UtcDaliTextControllerSetGetLineSpacingProperty(void) // single line, line spacing = 20px { const float EXPECTED_SPACING = 20.0f; - const Vector2 EXPECTED_LAYOUT_SIZE( 342.0f, 19.0f ); - const Vector3 EXPECTED_NATURAL_SIZE( 342.0f, 40.0f, 0.0f ); + const Vector2 EXPECTED_LAYOUT_SIZE( 360.0f, 19.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 360.0f, 40.0f, 0.0f ); controller->SetText(textSingle); controller->Relayout(size); @@ -718,8 +718,8 @@ int UtcDaliTextControllerSetGetLineSpacingProperty(void) // multi-line, line spacing = 0px { const float EXPECTED_SPACING = 0.0f; - const Vector2 EXPECTED_LAYOUT_SIZE( 332.0f, 39.0f ); - const Vector3 EXPECTED_NATURAL_SIZE( 118.0f, 58.0f, 0.0f ); + const Vector2 EXPECTED_LAYOUT_SIZE( 350.0f, 39.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 124.0f, 58.0f, 0.0f ); controller->SetText(textMulti); controller->Relayout(size); @@ -738,8 +738,8 @@ int UtcDaliTextControllerSetGetLineSpacingProperty(void) // multi-line, line spacing = 20px { const float EXPECTED_SPACING = 20.0f; - const Vector2 EXPECTED_LAYOUT_SIZE( 118.0f, 57.0f ); - const Vector3 EXPECTED_NATURAL_SIZE( 118.0f, 118.0f, 0.0f ); + const Vector2 EXPECTED_LAYOUT_SIZE( 124.0f, 57.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 124.0f, 118.0f, 0.0f ); controller->SetText(textMulti); controller->Relayout(size); @@ -758,8 +758,8 @@ int UtcDaliTextControllerSetGetLineSpacingProperty(void) // multi-line, line spacing = 30px { const float EXPECTED_SPACING = 30.0f; - const Vector2 EXPECTED_LAYOUT_SIZE( 118.0f, 117.0f ); - const Vector3 EXPECTED_NATURAL_SIZE( 118.0f, 148.0f, 0.0f ); + const Vector2 EXPECTED_LAYOUT_SIZE( 124.0f, 117.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 124.0f, 148.0f, 0.0f ); controller->SetText(textMulti); controller->Relayout(size); diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp index 9c0842e..647b9e8 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp @@ -226,12 +226,12 @@ bool GetCursorPositionTest( const GetCursorPositionData& data ) GetCursorPosition( parameters, cursorInfo ); - if( cursorInfo.primaryPosition.x != data.visualX[index] ) + if( floor(cursorInfo.primaryPosition.x) != data.visualX[index] ) { std::cout << " test " << index << " failed. Different 'x' cursor position : " << cursorInfo.primaryPosition.x << ", expected : " << data.visualX[index] << std::endl; return false; } - if( cursorInfo.primaryPosition.y != data.visualY[index] ) + if( floor(cursorInfo.primaryPosition.y) != data.visualY[index] ) { std::cout << " test " << index << " failed. Different 'y' cursor position : " << cursorInfo.primaryPosition.y << ", expected : " << data.visualY[index] << std::endl; return false; @@ -388,13 +388,13 @@ int UtcDaliGetClosestCursorIndex(void) float visualX02[] = { -100.f, 1000.f, 60.f, 79.f, 83.f, 148.f, 99.f }; float visualY02[] = { -100.f, 1000.f, 12.f, 12.f, 12.f, 12.f, 12.f }; CharacterHitTest::Mode mode02[] = { CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP }; - CharacterIndex logicalIndex02[] = { 0, 21u, 8u, 11u, 11u, 13u, 20u }; + CharacterIndex logicalIndex02[] = { 0, 21u, 7u, 10u, 10u, 14u, 12u }; bool isCharacterHit02[] = { false, false, true, true, true, true, true }; float visualX03[] = { 19.f, 104.f, -2.f, 127.f }; float visualY03[] = { 12.f, 12.f, 12.f, 12.f }; CharacterHitTest::Mode mode03[] = { CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP }; - CharacterIndex logicalIndex03[] = { 3u, 12u, 0, 18u }; + CharacterIndex logicalIndex03[] = { 3u, 13u, 0, 18u }; bool isCharacterHit03[] = { true, true, false, false }; // 0 5 _ 6 11 12 @@ -412,13 +412,13 @@ int UtcDaliGetClosestCursorIndex(void) CharacterHitTest::Mode mode04[] = { CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP }; - CharacterIndex logicalIndex04[] = { 0, 6u, 6u, 11u, 11u, + CharacterIndex logicalIndex04[] = { 0, 5u, 6u, 11u, 11u, 12u, 16u, 17u, 21u, 21u, - 22u, 25u, 31u, 32u, 34u, 40u, 40u, + 22u, 25u, 30u, 32u, 35u, 33u, 40u, 41u }; - bool isCharacterHit04[] = { false, true, true, false, false, - false, true, true, false, false, - false, true, true, true, true, false, false }; + bool isCharacterHit04[] = { false, true, true, true, false, + false, true, true, true, false, + false, true, true, true, true, true, false }; // 0 10 20 30 40 46 // abcשנבdefג קכghiעיןjk lחלךmnoצמם pqrפרףstuד אוvwxה @@ -451,12 +451,12 @@ int UtcDaliGetClosestCursorIndex(void) CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP }; - CharacterIndex logicalIndex05[] = { 0, 10u, 20u, 30u, 40u, 46u, - 47u, 52u, 62u, 71u, 82u, 93u, - 94u, 99u, 112u, 122u, 131u, 140u, - 141u, 153u, 162u, 171u, 181u, 187u, - 188u, 194u, 201u, 213u, 222u, 234u, - 236u, 244u, 254u, 263u, 265u }; + CharacterIndex logicalIndex05[] = { 0, 10u, 19u, 28u, 39u, 44u, + 45u, 49u, 59u, 66u, 78u, 87u, + 89u, 96u, 107u, 115u, 124u, 133u, + 134u, 145u, 154u, 162u, 171u, 179u, + 180u, 184u, 191u, 203u, 212u, + 221u, 222u, 233u, 240u, 251u, 265u }; bool isCharacterHit05[] = { false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, @@ -495,12 +495,12 @@ int UtcDaliGetClosestCursorIndex(void) CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP }; - CharacterIndex logicalIndex06[] = { 0, 10u, 20u, 30u, 40u, 45u, - 46u, 50u, 60u, 70u, 80u, 92u, - 93u, 100u, 110u, 120u, 130u, 138u, - 139u, 150u, 160u, 170u, 180u, 185u, - 186u, 190u, 200u, 210u, 220u, 231u, - 232u, 240u, 250u, 260u, 265u }; + CharacterIndex logicalIndex06[] = { 0, 10u, 19u, 28u, 39u, 44u, + 45u, 48u, 57u, 65u, 78u, 87u, + 89u, 96u, 107u, 114u, 124u, 133u, + 134u, 144u, 154u, 162u, 171u, 178u, + 179u, 185u, 192u, 203u, 212u, 221u, + 222u, 232u, 240u, 251u, 265u }; bool isCharacterHit06[] = { false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp index 04ef6f0..763a5ac 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp @@ -62,7 +62,7 @@ void Print( const LineRun& line ) { std::cout << " glyph run, index : " << line.glyphRun.glyphIndex << ", num glyphs : " << line.glyphRun.numberOfGlyphs << std::endl; std::cout << " character run, index : " << line.characterRun.characterIndex << ", num chars : " << line.characterRun.numberOfCharacters << std::endl; - std::cout << " width : " << line.width << std::endl; + std::cout << " width : " << floor(line.width) << std::endl; std::cout << " ascender : " << line.ascender << std::endl; std::cout << " descender : " << line.descender << std::endl; std::cout << " extraLength : " << line.extraLength << std::endl; @@ -256,7 +256,7 @@ bool LayoutTextTest( const LayoutTextData& data ) return false; } - if( fabsf( line.width - expectedLine.width ) > Math::MACHINE_EPSILON_1 ) + if( fabsf( floor( line.width ) - expectedLine.width ) > Math::MACHINE_EPSILON_1 ) { std::cout << " Different line info for line : " << index << std::endl; Print( line ); @@ -591,13 +591,13 @@ int UtcDaliTextLayoutSmallTextArea02(void) Vector fontDescriptionRuns; fontDescriptionRuns.PushBack( fontDescriptionRun ); Size textArea(1.f, 1.f); - Size layoutSize(78.f, 19.f); - float positions[] = { 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f }; + Size layoutSize(81.f, 19.f); + float positions[] = { 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f }; struct LineRun line = { { 0u, 11u }, { 0u, 11u }, - 78.f, + 81.f, 15.f, -4.f, 0.f, @@ -675,20 +675,20 @@ int UtcDaliTextLayoutMultilineText01(void) fontDescriptionRuns.PushBack( fontDescriptionRun1 ); fontDescriptionRuns.PushBack( fontDescriptionRun2 ); Size textArea(100.f, 300.f); - Size layoutSize(91.f, 95.f); + Size layoutSize(97.f, 95.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f, 42.f, -12.f, - 0.f, -12.f, 8.f, -9.f, 16.f, -9.f, 26.f, -9.f, 35.f, -9.f, 44.f, -11.f, 50.f, -0.f, - 0.f, -12.f, 10.f, -12.f, 14.f, -12.f, 25.f, -9.f, 34.f, -9.f, 40.f, -9.f, 49.f, -9.f, 58.f, -11.f, 64.f, -0.f, - 0.f, -12.f, 4.f, -12.f, 8.f, -9.f, 18.f, -9.f, 27.f, -9.f, 34.f, -0.f, 40.f, -9.f, 49.f, -12.f, 53.f, -0.f, 58.f, -11.f, 65.f, -9.f, 74.f, -9.f, 82.f, -11.f, 90.f, -2.f + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f, 45.f, -12.f, + 0.f, -12.f, 9.f, -9.f, 18.f, -9.f, 28.f, -9.f, 38.f, -9.f, 47.f, -11.f, 53.f, -0.f, + 0.f, -12.f, 10.f, -12.f, 15.f, -12.f, 26.f, -9.f, 35.f, -9.f, 42.f, -9.f, 52.f, -9.f, 61.f, -11.f, 67.f, -0.f, + 0.f, -12.f, 4.f, -12.f, 9.f, -9.f, 19.f, -9.f, 29.f, -9.f, 36.f, -0.f, 42.f, -9.f, 52.f, -12.f, 57.f, -0.f, 62.f, -11.f, 69.f, -9.f, 79.f, -9.f, 87.f, -11.f, 95.f, -2.f }; struct LineRun line0 = { { 0u, 12u }, { 0u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -701,7 +701,7 @@ int UtcDaliTextLayoutMultilineText01(void) { { 12u, 6u }, { 12u, 6u }, - 42.f, + 44.f, 15.f, -4.f, 0.f, @@ -714,10 +714,10 @@ int UtcDaliTextLayoutMultilineText01(void) { { 18u, 7u }, { 18u, 7u }, - 49.f, + 53.f, 15.f, -4.f, - 5.f, + 6.f, 0.f, 0.f, false, @@ -727,10 +727,10 @@ int UtcDaliTextLayoutMultilineText01(void) { { 25u, 9u }, { 25u, 10u }, - 63.f, + 66.f, 15.f, -4.f, - 5.f, + 6.f, 0.f, 0.f, false, @@ -740,7 +740,7 @@ int UtcDaliTextLayoutMultilineText01(void) { { 34u, 14u }, { 35u, 14u }, - 91.f, + 97.f, 15.f, -4.f, 0.f, @@ -874,21 +874,21 @@ int UtcDaliTextLayoutMultilineText02(void) fontDescriptionRuns.PushBack( fontDescriptionRun4 ); fontDescriptionRuns.PushBack( fontDescriptionRun5 ); Size textArea(100.f, 300.f); - Size layoutSize(78.f, 114.f); + Size layoutSize(81.f, 114.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 0 .. 11 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 12 .. 21 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 22 .. 27 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 28 .. 37 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 38 .. 49 - 3.f, -13.f, 12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, // 50 .. 54 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 0 .. 11 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 12 .. 21 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 22 .. 27 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 28 .. 37 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 38 .. 49 + 4.f, -13.f, 13.f, -9.f, 23.f, -9.f, 36.f, -9.f, 0.f, -2.f, // 50 .. 54 }; struct LineRun line0 = { { 0u, 12u }, { 0u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -901,10 +901,10 @@ int UtcDaliTextLayoutMultilineText02(void) { { 12u, 10u }, { 12u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -914,7 +914,7 @@ int UtcDaliTextLayoutMultilineText02(void) { { 22u, 6u }, { 22u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -927,10 +927,10 @@ int UtcDaliTextLayoutMultilineText02(void) { { 28u, 10u }, { 28u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -940,7 +940,7 @@ int UtcDaliTextLayoutMultilineText02(void) { { 38u, 12u }, { 38u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -953,7 +953,7 @@ int UtcDaliTextLayoutMultilineText02(void) { { 50u, 5u }, { 50u, 5u }, - 42.f, + 45.f, 15.f, -4.f, 0.f, @@ -1024,18 +1024,18 @@ int UtcDaliTextLayoutMultilineText03(void) Vector fontDescriptionRuns; fontDescriptionRuns.PushBack( fontDescriptionRun ); Size textArea(100.f, 300.f); - Size layoutSize(94.f, 57.f); + Size layoutSize(98.f, 57.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -9.f, 46.f, -9.f, 56.f, -9.f, 62.f, -13.f, 65.f, -13.f, 74.f, -13.f, 83.f, -9.f, - 0.f, -9.f, 12.f, -9.f, 22.f, -13.f, 30.f, -9.f, 39.f, -13.f, 43.f, -13.f, 46.f, -9.f, 55.f, -9.f, 66.f, -9.f, 76.f, -9.f, 82.f, -13.f, 85.f, -13.f, - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f, + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -9.f, 48.f, -9.f, 58.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -13.f, 86.f, -9.f, + 0.f, -9.f, 13.f, -9.f, 23.f, -13.f, 31.f, -9.f, 41.f, -13.f, 45.f, -13.f, 48.f, -9.f, 57.f, -9.f, 69.f, -9.f, 79.f, -9.f, 85.f, -13.f, 88.f, -13.f, + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f, }; struct LineRun line0 = { { 0u, 12u }, { 0u, 12u }, - 91.f, + 95.f, 15.f, -4.f, 0.f, @@ -1048,7 +1048,7 @@ int UtcDaliTextLayoutMultilineText03(void) { { 12u, 12u }, { 12u, 12u }, - 94.f, + 98.f, 15.f, -4.f, 0.f, @@ -1061,7 +1061,7 @@ int UtcDaliTextLayoutMultilineText03(void) { { 24u, 5u }, { 24u, 5u }, - 42.f, + 44.f, 15.f, -4.f, 0.f, @@ -1128,16 +1128,16 @@ int UtcDaliTextLayoutMultilineText04(void) Vector fontDescriptionRuns; fontDescriptionRuns.PushBack( fontDescriptionRun ); Size textArea(100.f, 300.f); - Size layoutSize(81.f, 38.f); + Size layoutSize(84.f, 38.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -2.f, 81.f, -12.f + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -2.f, 85.f, -12.f }; struct LineRun line0 = { { 0u, 13u }, { 0u, 13u }, - 81.f, + 84.f, 15.f, -4.f, 0.f, @@ -1242,17 +1242,17 @@ int UtcDaliTextLayoutMultilineText05(void) fontDescriptionRuns.PushBack( fontDescriptionRun2 ); fontDescriptionRuns.PushBack( fontDescriptionRun3 ); Size textArea(100.f, 300.f); - Size layoutSize(87.f, 51.f); + Size layoutSize(89.f, 51.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -14.f, 59.f, -9.f, 69.f, -9.f, 75.f, -13.f, 78.f, -13.f, 87.f, -0.f, - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 60.f, -9.f, 71.f, -9.f, 77.f, -13.f, 80.f, -13.f, 89.f, -0.f, + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f }; struct LineRun line0 = { { 0u, 12u }, { 0u, 12u }, - 87.f, + 89.f, 25.f, -7.f, 4.f, @@ -1265,7 +1265,7 @@ int UtcDaliTextLayoutMultilineText05(void) { { 12u, 5u }, { 12u, 5u }, - 42.f, + 44.f, 15.f, -4.f, 0.f, @@ -1330,20 +1330,20 @@ int UtcDaliTextLayoutMultilineText06(void) fontDescriptionRuns.PushBack( fontDescriptionRun ); Size textArea(64.f, 100.f); - Size layoutSize(31.f, 38.f); + Size layoutSize(33.f, 38.f); float positions[] = { - 26.f, -13.f, 17.f, -10.f, 8.f, -10.f, 4.f, -10.f, 0.f, -0.f, - 22.f, -10.f, 17.f, -10.f, 12.f, -10.f, 4.f, -10.f, 0.f, -10.f + 28.f, -13.f, 18.f, -10.f, 9.f, -10.f, 4.f, -10.f, 0.f, -0.f, + 23.f, -10.f, 18.f, -10.f, 12.f, -10.f, 4.f, -10.f, 0.f, -10.f }; struct LineRun line0 = { { 0u, 5u }, { 0u, 5u }, - 30.f, + 32.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, true, @@ -1353,7 +1353,7 @@ int UtcDaliTextLayoutMultilineText06(void) { { 5u, 5u }, { 5u, 5u }, - 31.f, + 33.f, 15.f, -4.f, 0.f, @@ -1418,18 +1418,18 @@ int UtcDaliTextLayoutMultilineText07(void) fontDescriptionRuns.PushBack( fontDescriptionRun ); Size textArea(26.f, 100.f); - Size layoutSize(21.f, 57.f); + Size layoutSize(23.f, 57.f); float positions[] = { - 10.f, -10.f, 5.f, -10.f, 0.f, -10.f, - 11.f, -10.f, 7.f, -10.f, 0.f, -13.f, - 13.f, -10.f, 4.f, -10.f, 0.f, -10.f + 11.f, -10.f, 5.f, -10.f, 0.f, -10.f, + 12.f, -10.f, 8.f, -10.f, 0.f, -13.f, + 14.f, -10.f, 4.f, -10.f, 0.f, -10.f }; struct LineRun line0 = { { 0u, 3u }, { 0u, 3u }, - 19.f, + 20.f, 15.f, -4.f, 0.f, @@ -1442,7 +1442,7 @@ int UtcDaliTextLayoutMultilineText07(void) { { 3u, 3u }, { 3u, 3u }, - 21.f, + 22.f, 15.f, -4.f, 0.f, @@ -1455,7 +1455,7 @@ int UtcDaliTextLayoutMultilineText07(void) { { 6u, 3u }, { 6u, 3u }, - 21.f, + 23.f, 15.f, -4.f, 0.f, @@ -1748,34 +1748,34 @@ int UtcDaliTextUpdateLayout01(void) fontDescriptionRuns.PushBack( fontDescriptionRun16 ); fontDescriptionRuns.PushBack( fontDescriptionRun17 ); Size textArea(100.f, 300.f); - Size layoutSize(92.f, 361.f); + Size layoutSize(100.f, 361.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 0 .. 11 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 12 .. 21 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 22 .. 27 - 87.f, -8.f, 82.f, -6.f, 75.f, -8.f, 72.f, -7.f, 71.f, -11.f, 67.f, -0.f, 63.f, -7.f, 62.f, -11.f, 57.f, -11.f, 51.f, -8.f, 50.f, -11.f, 45.f, -11.f, 40.f, -8.f, 37.f, -0.f, 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 0.f, -0.f, // 28 .. 47 - 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 35.f, -0.f, 25.f, -10.f, 17.f, -13.f, 12.f, -10.f, 4.f, -10.f, 0.f, -0.f, // 48 .. 58 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 0.f, -0.f, // 59 .. 63 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 64 .. 73 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 74 .. 85 - 3.f, -13.f, 12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, 0.f, -12.f, // 86 .. 91 - 0.f, -13.f, 8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f, // 92 .. 103 - 81.f, -8.f, 76.f, -6.f, 69.f, -8.f, 66.f, -7.f, 65.f, -11.f, 61.f, -0.f, 57.f, -7.f, 56.f, -11.f, 51.f, -11.f, 45.f, -8.f, 44.f, -11.f, 39.f, -11.f, 34.f, -8.f, 31.f, -0.f, 21.f, -10.f, 13.f, -13.f, 8.f, -10.f, 0.f, -10.f, 88.f, -0.f, // 104 .. 122 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -0.f, // 123 .. 127 - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 128 .. 139 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 140 .. 149 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 150 .. 155 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 156 .. 165 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 166 .. 177 - 47.f, -8.f, 42.f, -6.f, 35.f, -8.f, 32.f, -7.f, 31.f, -11.f, 27.f, -0.f, 23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f, // 178 .. 191 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 0 .. 11 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 12 .. 21 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 22 .. 27 + 58.f, -8.f, 52.f, -6.f, 45.f, -8.f, 41.f, -7.f, 39.f, -11.f, 34.f, -0.f, 30.f, -7.f, 28.f, -11.f, 23.f, -11.f, 16.f, -8.f, 15.f, -11.f, 9.f, -11.f, 4.f, -8.f, 0.f, -0.f, 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, // 28 .. 47 + 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, 59.f, -10.f, 50.f, -13.f, 45.f, -10.f, 36.f, -10.f, 31.f, -0.f, // 48 .. 58 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 0.f, -0.f, // 59 .. 63 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 64 .. 73 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 74 .. 85 + 4.f, -13.f, 13.f, -9.f, 23.f, -9.f, 36.f, -9.f, 0.f, -2.f, 0.f, -12.f, // 86 .. 91 + 0.f, -13.f, 8.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 79.f, -0.f, // 92 .. 103 + 91.f, -8.f, 85.f, -6.f, 78.f, -8.f, 74.f, -7.f, 72.f, -11.f, 67.f, -0.f, 63.f, -7.f, 61.f, -11.f, 56.f, -11.f, 49.f, -8.f, 48.f, -11.f, 42.f, -11.f, 37.f, -8.f, 33.f, -0.f, 23.f, -10.f, 14.f, -13.f, 9.f, -10.f, 0.f, -10.f, 98.f, -0.f, // 104 .. 122 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -0.f, // 123 .. 127 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 128 .. 139 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 140 .. 149 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 150 .. 155 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 156 .. 165 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 166 .. 177 + 54.f, -8.f, 49.f, -6.f, 41.f, -8.f, 37.f, -7.f, 35.f, -11.f, 31.f, -0.f, 26.f, -7.f, 24.f, -11.f, 19.f, -11.f, 12.f, -8.f, 11.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f, // 178 .. 191 }; struct LineRun line01 = { { 0u, 12u }, { 0u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -1788,10 +1788,10 @@ int UtcDaliTextUpdateLayout01(void) { { 12u, 10u }, { 12u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -1801,7 +1801,7 @@ int UtcDaliTextUpdateLayout01(void) { { 22u, 6u }, { 22u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -1812,9 +1812,9 @@ int UtcDaliTextUpdateLayout01(void) }; struct LineRun line04 = { - { 28u, 20u }, - { 28u, 20u }, - 92.f, + { 28u, 14u }, + { 28u, 14u }, + 63.f, 15.f, -4.f, 4.f, @@ -1825,22 +1825,22 @@ int UtcDaliTextUpdateLayout01(void) }; struct LineRun line05 = { - { 48u, 11u }, - { 48u, 11u }, - 75.f, + { 42, 12u }, + { 42, 12u }, + 79.f, 15.f, -4.f, 4.f, 0.f, 0.f, - false, + true, false }; struct LineRun line06 = { - { 59u, 5u }, - { 59u, 5u }, - 29.f, + { 54u, 10u }, + { 54u, 10u }, + 69.f, 15.f, -4.f, 0.f, @@ -1853,10 +1853,10 @@ int UtcDaliTextUpdateLayout01(void) { { 64u, 10u }, { 64u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, true, @@ -1866,7 +1866,7 @@ int UtcDaliTextUpdateLayout01(void) { { 74u, 12u }, { 74u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -1879,7 +1879,7 @@ int UtcDaliTextUpdateLayout01(void) { { 86u, 6u }, { 86u, 6u }, - 42.f, + 45.f, 15.f, -4.f, 0.f, @@ -1892,7 +1892,7 @@ int UtcDaliTextUpdateLayout01(void) { { 92u, 12u }, { 92u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -1905,10 +1905,10 @@ int UtcDaliTextUpdateLayout01(void) { { 104u, 19u }, { 104u, 19u }, - 90.f, + 100.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -1918,7 +1918,7 @@ int UtcDaliTextUpdateLayout01(void) { { 123u, 5u }, { 123u, 5u }, - 29.f, + 31.f, 15.f, -4.f, 0.f, @@ -1931,7 +1931,7 @@ int UtcDaliTextUpdateLayout01(void) { { 128u, 12u }, { 128u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -1944,10 +1944,10 @@ int UtcDaliTextUpdateLayout01(void) { { 140u, 10u }, { 140u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -1957,7 +1957,7 @@ int UtcDaliTextUpdateLayout01(void) { { 150u, 6u }, { 150u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -1970,10 +1970,10 @@ int UtcDaliTextUpdateLayout01(void) { { 156u, 10u }, { 156u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, true, @@ -1983,7 +1983,7 @@ int UtcDaliTextUpdateLayout01(void) { { 166u, 12u }, { 166u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -1996,7 +1996,7 @@ int UtcDaliTextUpdateLayout01(void) { { 178u, 14u }, { 178u, 14u }, - 56.f, + 63.f, 15.f, -4.f, 0.f, @@ -2323,34 +2323,34 @@ int UtcDaliTextUpdateLayout02(void) fontDescriptionRuns.PushBack( fontDescriptionRun16 ); fontDescriptionRuns.PushBack( fontDescriptionRun17 ); Size textArea(100.f, 300.f); - Size layoutSize(92.f, 361.f); + Size layoutSize(100.f, 361.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 0 .. 11 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 12 .. 21 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 22 .. 27 - 87.f, -8.f, 82.f, -6.f, 75.f, -8.f, 72.f, -7.f, 71.f, -11.f, 67.f, -0.f, 63.f, -7.f, 62.f, -11.f, 57.f, -11.f, 51.f, -8.f, 50.f, -11.f, 45.f, -11.f, 40.f, -8.f, 37.f, -0.f, 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 0.f, -0.f, // 28 .. 47 - 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 35.f, -0.f, 25.f, -10.f, 17.f, -13.f, 12.f, -10.f, 4.f, -10.f, 0.f, -0.f, // 48 .. 58 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 0.f, -0.f, // 59 .. 63 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 64 .. 73 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 74 .. 85 - 3.f, -13.f, 12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, 0.f, -12.f, // 86 .. 91 - 0.f, -13.f, 8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f, // 92 .. 103 - 81.f, -8.f, 76.f, -6.f, 69.f, -8.f, 66.f, -7.f, 65.f, -11.f, 61.f, -0.f, 57.f, -7.f, 56.f, -11.f, 51.f, -11.f, 45.f, -8.f, 44.f, -11.f, 39.f, -11.f, 34.f, -8.f, 31.f, -0.f, 21.f, -10.f, 13.f, -13.f, 8.f, -10.f, 0.f, -10.f, 88.f, -0.f, // 104 .. 122 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -0.f, // 123 .. 127 - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 128 .. 139 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 140 .. 149 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 150 .. 155 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 156 .. 165 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 166 .. 177 - 47.f, -8.f, 42.f, -6.f, 35.f, -8.f, 32.f, -7.f, 31.f, -11.f, 27.f, -0.f, 23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f, // 178 .. 191 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 0 .. 11 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 12 .. 21 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 22 .. 27 + 58.f, -8.f, 52.f, -6.f, 45.f, -8.f, 41.f, -7.f, 39.f, -11.f, 34.f, -0.f, 30.f, -7.f, 28.f, -11.f, 23.f, -11.f, 16.f, -8.f, 15.f, -11.f, 9.f, -11.f, 4.f, -8.f, 0.f, -0.f, 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, // 28 .. 47 + 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, 59.f, -10.f, 50.f, -13.f, 45.f, -10.f, 36.f, -10.f, 31.f, -0.f, // 48 .. 58 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 0.f, -0.f, // 59 .. 63 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 64 .. 73 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 74 .. 85 + 4.f, -13.f, 13.f, -9.f, 23.f, -9.f, 36.f, -9.f, 0.f, -2.f, 0.f, -12.f, // 86 .. 91 + 0.f, -13.f, 8.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 79.f, -0.f, // 92 .. 103 + 91.f, -8.f, 85.f, -6.f, 78.f, -8.f, 74.f, -7.f, 72.f, -11.f, 67.f, -0.f, 63.f, -7.f, 61.f, -11.f, 56.f, -11.f, 49.f, -8.f, 48.f, -11.f, 42.f, -11.f, 37.f, -8.f, 33.f, -0.f, 23.f, -10.f, 14.f, -13.f, 9.f, -10.f, 0.f, -10.f, 98.f, -0.f, // 104 .. 122 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -0.f, // 123 .. 127 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 128 .. 139 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 140 .. 149 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 150 .. 155 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 156 .. 165 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 166 .. 177 + 54.f, -8.f, 49.f, -6.f, 41.f, -8.f, 37.f, -7.f, 35.f, -11.f, 31.f, -0.f, 26.f, -7.f, 24.f, -11.f, 19.f, -11.f, 12.f, -8.f, 11.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f, // 178 .. 191 }; struct LineRun line01 = { { 0u, 12u }, { 0u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -2363,10 +2363,10 @@ int UtcDaliTextUpdateLayout02(void) { { 12u, 10u }, { 12u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -2376,7 +2376,7 @@ int UtcDaliTextUpdateLayout02(void) { { 22u, 6u }, { 22u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -2387,9 +2387,9 @@ int UtcDaliTextUpdateLayout02(void) }; struct LineRun line04 = { - { 28u, 20u }, - { 28u, 20u }, - 92.f, + { 28u, 14u }, + { 28u, 14u }, + 63.f, 15.f, -4.f, 4.f, @@ -2400,9 +2400,9 @@ int UtcDaliTextUpdateLayout02(void) }; struct LineRun line05 = { - { 48u, 11u }, - { 48u, 11u }, - 75.f, + { 42u, 12u }, + { 42u, 12u }, + 79.f, 15.f, -4.f, 4.f, @@ -2413,9 +2413,9 @@ int UtcDaliTextUpdateLayout02(void) }; struct LineRun line06 = { - { 59u, 5u }, - { 59u, 5u }, - 29.f, + { 54u, 10u }, + { 54u, 10u }, + 69.f, 15.f, -4.f, 0.f, @@ -2428,10 +2428,10 @@ int UtcDaliTextUpdateLayout02(void) { { 64u, 10u }, { 64u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -2441,7 +2441,7 @@ int UtcDaliTextUpdateLayout02(void) { { 74u, 12u }, { 74u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -2454,7 +2454,7 @@ int UtcDaliTextUpdateLayout02(void) { { 86u, 6u }, { 86u, 6u }, - 42.f, + 45.f, 15.f, -4.f, 0.f, @@ -2467,7 +2467,7 @@ int UtcDaliTextUpdateLayout02(void) { { 92u, 12u }, { 92u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -2480,10 +2480,10 @@ int UtcDaliTextUpdateLayout02(void) { { 104u, 19u }, { 104u, 19u }, - 90.f, + 100.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -2493,7 +2493,7 @@ int UtcDaliTextUpdateLayout02(void) { { 123u, 5u }, { 123u, 5u }, - 29.f, + 31.f, 15.f, -4.f, 0.f, @@ -2506,7 +2506,7 @@ int UtcDaliTextUpdateLayout02(void) { { 128u, 12u }, { 128u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -2519,10 +2519,10 @@ int UtcDaliTextUpdateLayout02(void) { { 140u, 10u }, { 140u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -2532,7 +2532,7 @@ int UtcDaliTextUpdateLayout02(void) { { 150u, 6u }, { 150u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -2545,10 +2545,10 @@ int UtcDaliTextUpdateLayout02(void) { { 156u, 10u }, { 156u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -2558,7 +2558,7 @@ int UtcDaliTextUpdateLayout02(void) { { 166u, 12u }, { 166u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -2571,7 +2571,7 @@ int UtcDaliTextUpdateLayout02(void) { { 178u, 14u }, { 178u, 14u }, - 56.f, + 63.f, 15.f, -4.f, 0.f, @@ -2898,34 +2898,34 @@ int UtcDaliTextUpdateLayout03(void) fontDescriptionRuns.PushBack( fontDescriptionRun16 ); fontDescriptionRuns.PushBack( fontDescriptionRun17 ); Size textArea(100.f, 300.f); - Size layoutSize(92.f, 361.f); + Size layoutSize(100.f, 361.f); float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 0 .. 11 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 12 .. 21 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 22 .. 27 - 87.f, -8.f, 82.f, -6.f, 75.f, -8.f, 72.f, -7.f, 71.f, -11.f, 67.f, -0.f, 63.f, -7.f, 62.f, -11.f, 57.f, -11.f, 51.f, -8.f, 50.f, -11.f, 45.f, -11.f, 40.f, -8.f, 37.f, -0.f, 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 0.f, -0.f, // 28 .. 47 - 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 35.f, -0.f, 25.f, -10.f, 17.f, -13.f, 12.f, -10.f, 4.f, -10.f, 0.f, -0.f, // 48 .. 58 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 0.f, -0.f, // 59 .. 63 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 64 .. 73 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 74 .. 85 - 3.f, -13.f, 12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, 0.f, -12.f, // 86 .. 91 - 0.f, -13.f, 8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f, // 92 .. 103 - 81.f, -8.f, 76.f, -6.f, 69.f, -8.f, 66.f, -7.f, 65.f, -11.f, 61.f, -0.f, 57.f, -7.f, 56.f, -11.f, 51.f, -11.f, 45.f, -8.f, 44.f, -11.f, 39.f, -11.f, 34.f, -8.f, 31.f, -0.f, 21.f, -10.f, 13.f, -13.f, 8.f, -10.f, 0.f, -10.f, 88.f, -0.f, // 104 .. 122 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -0.f, // 123 .. 127 - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, // 128 .. 139 - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f, // 140 .. 149 - 21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f, // 150 .. 155 - 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 156 .. 165 - 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f, // 166 .. 177 - 47.f, -8.f, 42.f, -6.f, 35.f, -8.f, 32.f, -7.f, 31.f, -11.f, 27.f, -0.f, 23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f, // 178 .. 191 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 0 .. 11 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 12 .. 21 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 22 .. 27 + 58.f, -8.f, 52.f, -6.f, 45.f, -8.f, 41.f, -7.f, 39.f, -11.f, 34.f, -0.f, 30.f, -7.f, 28.f, -11.f, 23.f, -11.f, 16.f, -8.f, 15.f, -11.f, 9.f, -11.f, 4.f, -8.f, 0.f, -0.f, 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, // 28 .. 47 + 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, 59.f, -10.f, 50.f, -13.f, 45.f, -10.f, 36.f, -10.f, 31.f, -0.f, // 48 .. 58 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 0.f, -0.f, // 59 .. 63 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 64 .. 73 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 74 .. 85 + 4.f, -13.f, 13.f, -9.f, 23.f, -9.f, 36.f, -9.f, 0.f, -2.f, 0.f, -12.f, // 86 .. 91 + 0.f, -13.f, 8.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 79.f, -0.f, // 92 .. 103 + 91.f, -8.f, 85.f, -6.f, 78.f, -8.f, 74.f, -7.f, 72.f, -11.f, 67.f, -0.f, 63.f, -7.f, 61.f, -11.f, 56.f, -11.f, 49.f, -8.f, 48.f, -11.f, 42.f, -11.f, 37.f, -8.f, 33.f, -0.f, 23.f, -10.f, 14.f, -13.f, 9.f, -10.f, 0.f, -10.f, 98.f, -0.f, // 104 .. 122 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -0.f, // 123 .. 127 + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 128 .. 139 + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 69.f, -10.f, 60.f, -13.f, 54.f, -10.f, 46.f, -10.f, 79.f, -0.f, // 140 .. 149 + 23.f, -10.f, 18.f, -10.f, 10.f, -13.f, 0.f, -10.f, 31.f, -2.f, 35.f, -12.f, // 150 .. 155 + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 156 .. 165 + 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 166 .. 177 + 54.f, -8.f, 49.f, -6.f, 41.f, -8.f, 37.f, -7.f, 35.f, -11.f, 31.f, -0.f, 26.f, -7.f, 24.f, -11.f, 19.f, -11.f, 12.f, -8.f, 11.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f, // 178 .. 191 }; struct LineRun line01 = { { 0u, 12u }, { 0u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -2938,10 +2938,10 @@ int UtcDaliTextUpdateLayout03(void) { { 12u, 10u }, { 12u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -2951,7 +2951,7 @@ int UtcDaliTextUpdateLayout03(void) { { 22u, 6u }, { 22u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -2962,9 +2962,9 @@ int UtcDaliTextUpdateLayout03(void) }; struct LineRun line04 = { - { 28u, 20u }, - { 28u, 20u }, - 92.f, + { 28u, 14u }, + { 28u, 14u }, + 63.f, 15.f, -4.f, 4.f, @@ -2975,9 +2975,9 @@ int UtcDaliTextUpdateLayout03(void) }; struct LineRun line05 = { - { 48u, 11u }, - { 48u, 11u }, - 75.f, + { 42u, 12u }, + { 42u, 12u }, + 79.f, 15.f, -4.f, 4.f, @@ -2988,9 +2988,9 @@ int UtcDaliTextUpdateLayout03(void) }; struct LineRun line06 = { - { 59u, 5u }, - { 59u, 5u }, - 29.f, + { 54u, 10u }, + { 54u, 10u }, + 69.f, 15.f, -4.f, 0.f, @@ -3003,10 +3003,10 @@ int UtcDaliTextUpdateLayout03(void) { { 64u, 10u }, { 64u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -3016,7 +3016,7 @@ int UtcDaliTextUpdateLayout03(void) { { 74u, 12u }, { 74u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -3029,7 +3029,7 @@ int UtcDaliTextUpdateLayout03(void) { { 86u, 6u }, { 86u, 6u }, - 42.f, + 45.f, 15.f, -4.f, 0.f, @@ -3042,7 +3042,7 @@ int UtcDaliTextUpdateLayout03(void) { { 92u, 12u }, { 92u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -3055,10 +3055,10 @@ int UtcDaliTextUpdateLayout03(void) { { 104u, 19u }, { 104u, 19u }, - 90.f, + 100.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -3068,7 +3068,7 @@ int UtcDaliTextUpdateLayout03(void) { { 123u, 5u }, { 123u, 5u }, - 29.f, + 31.f, 15.f, -4.f, 0.f, @@ -3081,7 +3081,7 @@ int UtcDaliTextUpdateLayout03(void) { { 128u, 12u }, { 128u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -3094,10 +3094,10 @@ int UtcDaliTextUpdateLayout03(void) { { 140u, 10u }, { 140u, 10u }, - 75.f, + 79.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -3107,7 +3107,7 @@ int UtcDaliTextUpdateLayout03(void) { { 150u, 6u }, { 150u, 6u }, - 32.f, + 34.f, 15.f, -4.f, 0.f, @@ -3120,10 +3120,10 @@ int UtcDaliTextUpdateLayout03(void) { { 156u, 10u }, { 156u, 10u }, - 65.f, + 69.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -3133,7 +3133,7 @@ int UtcDaliTextUpdateLayout03(void) { { 166u, 12u }, { 166u, 12u }, - 76.f, + 79.f, 15.f, -4.f, 4.f, @@ -3146,7 +3146,7 @@ int UtcDaliTextUpdateLayout03(void) { { 178u, 14u }, { 178u, 14u }, - 56.f, + 63.f, 15.f, -4.f, 0.f, @@ -3249,9 +3249,9 @@ int UtcDaliTextLayoutEllipsis01(void) struct LineRun line01 = { - { 0u, 14u }, - { 0u, 14u }, - 99.f, + { 0u, 13u }, + { 0u, 13u }, + 93.f, 15.f, -4.f, 0.f, @@ -3265,7 +3265,7 @@ int UtcDaliTextLayoutEllipsis01(void) float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, 82.f, -13.f, + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, 85.f, -13.f, }; Size textArea( 100.f, 50.f ); @@ -3328,7 +3328,7 @@ int UtcDaliTextLayoutEllipsis02(void) { { 0u, 12u }, { 0u, 12u }, - 78.f, + 81.f, 15.f, -4.f, 4.f, @@ -3341,7 +3341,7 @@ int UtcDaliTextLayoutEllipsis02(void) { { 12u, 12u }, { 12u, 12u }, - 93.f, + 95.f, 15.f, -4.f, 0.f, @@ -3356,8 +3356,8 @@ int UtcDaliTextLayoutEllipsis02(void) float positions[] = { - 0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f, - 0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -13.f, 52.f, -9.f, 61.f, -13.f, 65.f, -13.f, 68.f, -9.f, 77.f, -0.f, 81.f, -9.f, + 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, + 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 46.f, -13.f, 54.f, -9.f, 64.f, -13.f, 68.f, -13.f, 71.f, -9.f, 80.f, -0.f, 84.f, -9.f, }; Size textArea( 100.f, 50.f ); @@ -3484,9 +3484,9 @@ int UtcDaliTextLayoutEllipsis03(void) struct LineRun line01 = { - { 0u, 17u }, - { 0u, 17u }, - 100.f, + { 0u, 14u }, + { 0u, 14u }, + 97.f, 15.f, -4.f, 0.f, @@ -3500,7 +3500,7 @@ int UtcDaliTextLayoutEllipsis03(void) float positions[] = { - 91.f, -10.f, 83.f, -13.f, 78.f, -10.f, 70.f, -10.f, 65.f, -0.f, 57.f, -10.f, 52.f, -10.f, 45.f, -13.f, 36.f, -10.f, 31.f, -0.f, 24.f, -8.f, 19.f, -6.f, 12.f, -8.f, 9.f, -7.f, 8.f, -11.f, 4.f, -0.f, + 88.f, -10.f, 80.f, -13.f, 74.f, -10.f, 66.f, -10.f, 60.f, -0.f, 52.f, -10.f, 47.f, -10.f, 39.f, -13.f, 30.f, -10.f, 24.f, -0.f, 17.f, -8.f, 12.f, -6.f, 4.f, -8.f, 0.f, -7.f, 77.f, -11.f, 72.f, -0.f, }; Size textArea( 100.f, 50.f ); @@ -3627,12 +3627,12 @@ int UtcDaliTextLayoutEllipsis04(void) struct LineRun line01 = { - { 0u, 16u }, - { 0u, 16u }, - 94.f, + { 0u, 10u }, + { 0u, 10u }, + 69.f, 15.f, -4.f, - 3.f, + 5.f, 0.f, 0.f, false, @@ -3640,12 +3640,12 @@ int UtcDaliTextLayoutEllipsis04(void) }; struct LineRun line02 = { - { 16u, 18u }, - { 16u, 18u }, - 97.f, + { 10u, 19u }, + { 10u, 19u }, + 99.f, 15.f, -4.f, - 4.f, + 5.f, 0.f, 0.f, false, @@ -3657,8 +3657,8 @@ int UtcDaliTextLayoutEllipsis04(void) float positions[] = { - 86.f, -10.f, 78.f, -13.f, 73.f, -10.f, 65.f, -10.f, 60.f, -0.f, 52.f, -10.f, 47.f, -10.f, 40.f, -13.f, 31.f, -10.f, 26.f, -0.f, 19.f, -8.f, 14.f, -6.f, 7.f, -8.f, 4.f, -7.f, 3.f, -11.f, 0.f, -0.f, - 95.f, -7.f, 94.f, -11.f, 89.f, -11.f, 83.f, -8.f, 82.f, -11.f, 77.f, -11.f, 72.f, -8.f, 69.f, -0.f, 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f, + 63.f, -10.f, 54.f, -13.f, 49.f, -10.f, 41.f, -10.f, 35.f, -0.f, 27.f, -10.f, 22.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, 95.f, -8.f, 90.f, -6.f, 82.f, -8.f, 78.f, -7.f, 77.f, -11.f, 72.f, -0.f, + 67.f, -7.f, 66.f, -11.f, 60.f, -11.f, 54.f, -8.f, 52.f, -11.f, 46.f, -11.f, 41.f, -8.f, 37.f, -0.f, 27.f, -10.f, 18.f, -13.f, 13.f, -10.f, 4.f, -10.f, 0.f, -0.f, 93.f, -10.f, 88.f, -10.f, 80.f, -13.f, 71.f, -10.f, 65.f, -0.f, }; Size textArea( 100.f, 50.f ); @@ -3719,7 +3719,7 @@ int UtcDaliTextLayoutEllipsis05(void) { { 0u, 11u }, { 0u, 11u }, - 78.f, + 81.f, 15.f, -4.f, 0.f, @@ -3737,7 +3737,7 @@ int UtcDaliTextLayoutEllipsis05(void) }; Size textArea( 100.f, 19.f ); - Size layoutSize( 78.f, 19.f ); + Size layoutSize( 81.f, 19.f ); LayoutTextData data = { @@ -3980,7 +3980,7 @@ int UtcDaliTextAlign02(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 0.f, 0.f, 2.f, 61.f, 0.f, 0.f }; + float positions[] = { 0.f, 0.f, 33.f, 19.f, 0.f, 0.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -4222,7 +4222,7 @@ int UtcDaliTextAlign04(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 11.f, 17.f, 0.f, 0.f, 0.f, 0.f }; + float positions[] = { 9.f, 15.f, 0.f, 0.f, 0.f, 0.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -4343,7 +4343,7 @@ int UtcDaliTextAlign05(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 0.f, 0.f, -1.f, 30.f, 0.f, 0.f }; + float positions[] = { 0.f, 0.f, 14.f, 9.f, 0.f, 0.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -4464,7 +4464,7 @@ int UtcDaliTextAlign06(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 0.f, 0.f, 0.f, 0.f, 11.f, 21.f }; + float positions[] = { 0.f, 0.f, 0.f, 0.f, 9.f, 17.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -4585,7 +4585,7 @@ int UtcDaliTextAlign07(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 22.f, 35.f, 0.f, 0.f, 0.f, 0.f }; + float positions[] = { 19.f, 31.f, 0.f, 0.f, 0.f, 0.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -4827,7 +4827,7 @@ int UtcDaliTextAlign09(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 0.f, 0.f, 0.f, 0.f, 22.f, 42.f }; + float positions[] = { 0.f, 0.f, 0.f, 0.f, 19.f, 34.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -5069,7 +5069,7 @@ int UtcDaliTextAlign11(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { 22.f, 35.f, 2.f, 0.f, 0.f, 0.f }; + float positions[] = { 19.f, 31.f, 33.f, 0.f, 0.f, 0.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -5316,13 +5316,13 @@ int UtcDaliTextLayoutGetGlyphMetrics(void) Size layoutSize01 = Vector2(11.f, 19.f); // Group: second glyph doesn't exceed the width of the first glyph - float positions02[] = { 0.f, -11.f , 7.f, -15.f }; + float positions02[] = { 0.f, -11.f, 7.f, -15.f, }; struct LineRun line02 = { { 0u, 2u }, { 0u, 2u }, - 15.f, + 16.f, 15.f, -4.f, 0.f, @@ -5334,7 +5334,7 @@ int UtcDaliTextLayoutGetGlyphMetrics(void) Vector lines02; lines02.PushBack( line02 ); - Size layoutSize02 = Vector2(15.f, 19.f); + Size layoutSize02 = Vector2(16.f, 19.f); // Group: second glyph doesn't exceed the width of the first glyph float positions03[] = { 0.f, -11.f , 2.f, -15.f }; diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Shaping.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Shaping.cpp index 9dd7d57..a7534f9 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Shaping.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Shaping.cpp @@ -87,7 +87,7 @@ bool IsEqualGlyph ( const GlyphInfoData& glyphData, const GlyphInfo& glyph ) { return false; } - if( fabsf( glyphData.advance - glyph.advance ) > Math::MACHINE_EPSILON_1000 ) + if( fabsf( glyphData.advance - floor(glyph.advance) ) > Math::MACHINE_EPSILON_1000 ) { return false; } @@ -247,7 +247,7 @@ bool ShapeInfoTest( const ShapeInfoData& data ) std::cout << " height : " << glyphInfo.height << std::endl; std::cout << " xBearing : " << glyphInfo.xBearing << std::endl; std::cout << " yBearing : " << glyphInfo.yBearing << std::endl; - std::cout << " advance : " << glyphInfo.advance << std::endl; + std::cout << " advance : " << floor(glyphInfo.advance) << std::endl; std::cout << " scaleFactor : " << glyphInfo.scaleFactor << std::endl; std::cout << " isItalicRequired : " << glyphInfo.isItalicRequired << std::endl; std::cout << " isBoldRequired : " << glyphInfo.isBoldRequired << std::endl; diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp index 74be44b..07779ea 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp @@ -49,14 +49,14 @@ const char* LOREM_IPSUM = "Lorem ipsum dolor sit amet, aeque definiebas ea mei, "Aliquip sanctůs delicáta quí ěá, et natum aliquam est?\n" "Asšúm sapěret usu ůť.\n" "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n"; -const Vector2 LOREM_SCROLL_POSITION( 0.f, -265.f ); -const Length LOREM_NUMBER_OF_LINES = 35u; +const Vector2 LOREM_SCROLL_POSITION( 0.f, -284.f ); +const Length LOREM_NUMBER_OF_LINES = 36u; const Length LOREM_NUMBER_OF_LINES_ELIDED = 21u; const Length LOREM_NUMBER_OF_GLYPHS = 632; -const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 395u; +const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 373u; // The expected layout size for UtcDaliTextViewModelGetLayoutSize -const Size LAYOUT_SIZE( 194.f, 45.f ); +const Size LAYOUT_SIZE( 182.f, 45.f ); // The expected color indices for UtcDaliTextViewModelGetColors const ColorIndex COLOR_INDICES[] = { 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 2u, 2u, 2u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 3u, 1u, 1u, 1u, 0u, 0u, 0u, 0u }; @@ -132,16 +132,16 @@ bool ElideTest( const ElideData& data ) const LineRun& lastLine = *( model->GetLines() + numberOfLines - 1u ); const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex; - std::cout << " last line alignment offset : " << lastLine.alignmentOffset << std::endl; + std::cout << " last line alignment offset : " << floor(lastLine.alignmentOffset) << std::endl; for( unsigned int index = 0u; index < numberOfLastLineGlyphs; ++index ) { - if( *( data.positions + index ) != ( lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + index ) ).x ) ) + if( *( data.positions + index ) != floor(lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + index ) ).x ) ) { std::cout << " different layout :"; for( unsigned int i = 0; i < numberOfLastLineGlyphs; ++i ) { - std::cout << " " << ( lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + i ) ).x ); + std::cout << " " << floor( lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + i ) ).x ); } std::cout << std::endl; std::cout << " expected :"; @@ -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, 16.f, 26.f, 33.f, 41.f, 45.f, 54.f, 64.0f }; + float positions01[] = { 0.f, 8.f, 17.f, 27.f, 35.f, 43.f, 47.f, 58.f, 64.0f }; Size textSize02( 80.f, 100.f ); - float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 13.0f }; + float positions02[] = { 69.f, 63.f, 58.f, 49.f, 45.f, 41.f, 32.f, 23.f, 8.f }; Size textSize03( 80.f, 100.f ); - float positions03[] = { 74.f, 69.f, 66.f, 61.f, 53.f, 51.f, 47.f, 46.f, 41.f, 31.f, 28.f, 14.f, 7.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 }; Size textSize04( 80.f, 10.f ); float positions04[] = { 2.f }; @@ -609,7 +609,7 @@ int UtcDaliTextViewModelElideText02(void) "Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.", textSize01, 5u, - 37u, + 36u, positions01 }, { @@ -617,7 +617,7 @@ int UtcDaliTextViewModelElideText02(void) "צעד על לשון המלצת לאחרונה, אם לכאן שנורו סרבול מדע, קרן דת שפות להפוך.", textSize02, 5u, - 49u, + 44u, positions02 }, { @@ -625,7 +625,7 @@ int UtcDaliTextViewModelElideText02(void) "عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.", textSize03, 5u, - 73u, + 62u, positions03 }, { diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index d420979..310c401 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -1566,7 +1566,7 @@ int UtcDaliToolkitTextlabelTextFit(void) application.SendNotification(); application.Render(); - const Vector3 EXPECTED_NATURAL_SIZE( 460.0f, 98.0f, 0.0f ); + const Vector3 EXPECTED_NATURAL_SIZE( 452.0f, 94.0f, 0.0f ); DALI_TEST_EQUALS( EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION ); // check pixel size -- 2.7.4 From bf22b2b1b11ea7372af52e194a0749373aab6bc0 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 17 Jun 2020 17:14:09 +0900 Subject: [PATCH 02/16] Add tc log to check a failure Change-Id: I1dbfda76c3084fcc759d72e1ca9ae60c2e7259e7 --- .../src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index f05394e..c27e1b9 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -845,6 +845,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap ); DALI_TEST_CHECK( visual ); + tet_printf( "1. Visual is created.\n" ); + DummyControl actor = DummyControl::New( true ); DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() ); dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); @@ -866,6 +868,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION ); + tet_printf( "2. The current frame number is [%d].\n", value->Get< int >() ); + Property::Array array; array.PushBack( 0 ); array.PushBack( 2 ); @@ -883,6 +887,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION ); + tet_printf( "3. The current frame number is [%d].\n", value->Get< int >() ); + // Change play range attributes.Clear(); array.Clear(); @@ -913,6 +919,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); + tet_printf( "4. The current frame number is [%d].\n", value->Get< int >() ); + // Jump to the same position DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3 ); @@ -923,6 +931,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); + tet_printf( "5. The current frame number is [%d].\n", value->Get< int >() ); + END_TEST; } -- 2.7.4 From 766b696f942747143c05ee5fceb31981cb21e4c1 Mon Sep 17 00:00:00 2001 From: Sunghyun kim Date: Wed, 15 Jan 2020 18:27:23 +0900 Subject: [PATCH 03/16] Change size for new visual using initialized transformMap when mVisual is not updated. When the size was set for the new visual, there was an issue that the previous transformMap was set together. so in order to prevent this, The new visual has been changed to use the initialized map. Change-Id: I1ce1b735691e1b4963c3d4f3faf07d2c148ad478 --- dali-toolkit/internal/controls/image-view/image-view-impl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index 28cbfff..9843128 100755 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -316,11 +316,12 @@ void ImageView::OnRelayout( const Vector2& size, RelayoutContainer& container ) mVisual.SetTransformAndSize( transformMap, size ); // mVisual is not updated util the resource is ready in the case of visual replacement. - // So apply the transform and size to the new visual. + // in this case, the Property Map must be initialized so that the previous value is not reused. + // after mVisual is updated, the correct value will be reset. Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, Toolkit::ImageView::Property::IMAGE ); if( visual && visual != mVisual ) { - visual.SetTransformAndSize( transformMap, size ); + visual.SetTransformAndSize( Property::Map(), size ); } } } -- 2.7.4 From 5445229af6789b68b0e2146be55d6c79abb3e274 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 18 Jun 2020 15:55:54 +0100 Subject: [PATCH 04/16] Make some methods consts TextSelectionPopupImpl Change-Id: I9b924ba321f0f493f76563bacb6d9e84fb42a825 --- .../src/dali-toolkit-internal/CMakeLists.txt | 1 + .../utc-Dali-TextSelectionPopup-internal.cpp | 51 ++++++++++++++++++++++ .../dali-toolkit/utc-Dali-TextSelectionPopup.cpp | 22 ++++++++++ .../text-controls/text-selection-popup-impl.cpp | 4 +- .../text-controls/text-selection-popup-impl.h | 4 +- 5 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index 98172fb..0b58b91 100755 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -27,6 +27,7 @@ SET(TC_SOURCES utc-Dali-Text-Typesetter.cpp utc-Dali-Text-ViewModel.cpp utc-Dali-TextField-internal.cpp + utc-Dali-TextSelectionPopup-internal.cpp utc-Dali-TextureManager.cpp utc-Dali-Visuals-internal.cpp utc-Dali-VisualModel.cpp diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp new file mode 100644 index 0000000..13c7ca8 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include + +// THIS IS THE HEADER WE ARE TESTING +#define private public // To access private members of class, just in the internal test cases +#include +#undef private + +using namespace Dali; +using namespace Toolkit; + +void dali_textselectionpopupinternal_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_textselectionpopupinternal_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliToolkitTextSelectionPopupIconPropertiesN(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + + Toolkit::Internal::TextSelectionPopup& popupImpl = GetImpl(popup); + DALI_TEST_EQUALS(std::string(), popupImpl.GetButtonImage(Toolkit::TextSelectionPopup::NONE), TEST_LOCATION); + DALI_TEST_EQUALS(std::string(), popupImpl.GetButtonImage(Toolkit::TextSelectionPopup::Buttons(-1)), TEST_LOCATION); + + END_TEST; +} + diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp index 4e17c01..e86f836 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp @@ -230,3 +230,25 @@ int UtcDaliToolkitTextSelectionToolBarScrollView(void) END_TEST; } +int UtcDaliToolkitTextSelectionPopupSizeProperties(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + + const Vector2 popupMaxSize(200.0f, 300.0f); + const Vector2 optionMaxSize(50.0f, 100.0f); + const Vector2 optionMinSize(10.0f, 10.0f); + const Vector2 optionDividerSize(5.0f, 5.0f); + popup.SetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE, popupMaxSize); + popup.SetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE, optionMaxSize); + popup.SetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE, optionMinSize); + popup.SetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize); + + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE).Get(), popupMaxSize, TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE).Get(), optionMaxSize, TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE).Get(), optionMinSize, TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE).Get(), optionDividerSize, TEST_LOCATION); + + END_TEST; +} + diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index c9bc2b3..8aa3438 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -526,7 +526,7 @@ void TextSelectionPopup::SetDimensionToCustomise( const PopupCustomisations& set } // switch } -Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& settingToCustomise ) +Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& settingToCustomise ) const { switch( settingToCustomise ) { @@ -772,7 +772,7 @@ std::string TextSelectionPopup::GetPressedImage() const } } - std::size_t TextSelectionPopup::GetNumberOfEnabledOptions() + std::size_t TextSelectionPopup::GetNumberOfEnabledOptions() const { std::size_t numberOfOptions = 0u; for( std::vector::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it ) diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index a79a925..9ec2dc5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -203,7 +203,7 @@ private: // Implementation * * @param[in] setting The setting from the PopupCustomisations enum */ - Size GetDimensionToCustomise( const PopupCustomisations& setting ); + Size GetDimensionToCustomise( const PopupCustomisations& setting ) const; /** * @brief Sets the image for the given button of the Popup. @@ -239,7 +239,7 @@ private: // Implementation void AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption ); - std::size_t GetNumberOfEnabledOptions(); + std::size_t GetNumberOfEnabledOptions() const; void AddPopupOptionsToToolbar( bool showIcons, bool showCaptions ); -- 2.7.4 From b31917b6a4822be9c81a91c76601b4893c6aed00 Mon Sep 17 00:00:00 2001 From: Anton Obzhirov Date: Wed, 20 May 2020 20:53:44 +0100 Subject: [PATCH 05/16] Add partial update support. Change-Id: I0b6129903affd0fa0b22ef319ff9d78720f8fdc3 --- .../dali-toolkit-test-utils/test-application.cpp | 38 ++++++++++++++++++---- .../dali-toolkit-test-utils/test-application.h | 6 +++- .../toolkit-scene-holder-impl.h | 4 +-- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp index e8c0d12..b2a3fb9 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -26,13 +26,15 @@ TestApplication::TestApplication( uint32_t surfaceWidth, uint32_t surfaceHeight, uint32_t horizontalDpi, uint32_t verticalDpi, - bool initialize ) + bool initialize, + bool enablePartialUpdate ) : mCore( NULL ), mSurfaceWidth( surfaceWidth ), mSurfaceHeight( surfaceHeight ), mFrame( 0u ), mDpi{ horizontalDpi, verticalDpi }, - mLastVSyncTime(0u) + mLastVSyncTime(0u), + mPartialUpdateEnabled(enablePartialUpdate) { if( initialize ) { @@ -59,7 +61,8 @@ void TestApplication::CreateCore() mGlContextHelperAbstraction, Integration::RenderToFrameBuffer::FALSE, Integration::DepthBufferAvailable::TRUE, - Integration::StencilBufferAvailable::TRUE ); + Integration::StencilBufferAvailable::TRUE, + mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE ); mCore->ContextCreated(); @@ -193,8 +196,8 @@ bool TestApplication::Render( uint32_t intervalMilliseconds, const char* locatio mRenderStatus.SetNeedsPostRender( false ); mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ ); - mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/); - mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/); + mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ ); + mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ ); mCore->PostRender( false /*do not skip rendering*/ ); mFrame++; @@ -202,6 +205,27 @@ bool TestApplication::Render( uint32_t intervalMilliseconds, const char* locatio return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); } +bool TestApplication::PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector>& damagedRects) +{ + DoUpdate(intervalMilliseconds, location); + + mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ ); + mCore->PreRender(mScene, damagedRects); + + return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); +} + +bool TestApplication::RenderWithPartialUpdate(std::vector>& damagedRects, Rect& clippingRect) +{ + mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/, clippingRect); + mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/, clippingRect); + mCore->PostRender(false /*do not skip rendering*/); + + mFrame++; + + return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); +} + uint32_t TestApplication::GetUpdateStatus() { return mStatus.KeepUpdating(); @@ -227,8 +251,8 @@ bool TestApplication::RenderOnly( ) { // Update Time values mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ ); - mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/); - mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/); + mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ ); + mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ ); mCore->PostRender( false /*do not skip rendering*/ ); mFrame++; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h index e96f759..1df0743 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h @@ -51,7 +51,8 @@ public: uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI, uint32_t verticalDpi = DEFAULT_VERTICAL_DPI, - bool initialize = true ); + bool initialize = true, + bool enablePartialUpdate = false ); void Initialize(); void CreateCore(); @@ -69,6 +70,8 @@ public: void ProcessEvent(const Integration::Event& event); void SendNotification(); bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL ); + bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector>& damagedRects); + bool RenderWithPartialUpdate(std::vector>& damagedRects, Rect& clippingRect); uint32_t GetUpdateStatus(); bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); bool RenderOnly( ); @@ -108,6 +111,7 @@ protected: struct { uint32_t x; uint32_t y; } mDpi; uint32_t mLastVSyncTime; + bool mPartialUpdateEnabled; static bool mLoggingEnabled; }; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h index b466cfc..52c11c2 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h @@ -49,9 +49,9 @@ public: virtual void StartRender() {}; - virtual bool PreRender( bool resizingSurface ) { return false; }; + virtual bool PreRender( bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect ) { return false; }; - virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) {}; + virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector>& damagedRects ) {}; virtual void StopRender() {}; -- 2.7.4 From c7a0d1b696703373ad27d945ea6a8abf26937cf4 Mon Sep 17 00:00:00 2001 From: Sunghyun Kim Date: Mon, 22 Jun 2020 17:34:07 +0900 Subject: [PATCH 06/16] DALi Version 1.5.17 Change-Id: I0e4fa03c953e23e459343c73182fd98807cd73f7 --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 6268f35..1553ce2 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 16; +const unsigned int TOOLKIT_MICRO_VERSION = 17; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 1319a54..6c2f417 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -Version: 1.5.16 +Version: 1.5.17 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From 9280bc99d1a632c6cafddd185377847097866d38 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 22 Jun 2020 18:31:15 +0900 Subject: [PATCH 07/16] Fix AnimatedVectorImageVisual tc failure Change-Id: I51fdaf5395c1d36a14cf6644065007fe9091a517 --- .../src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index c27e1b9..7816a11 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -194,8 +194,12 @@ int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void) application.SendNotification(); application.Render(); + // Trigger count is 1 - render a frame + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + // renderer is added to actor DALI_TEST_CHECK( actor.GetRendererCount() == 1u ); + Renderer renderer = actor.GetRendererAt( 0u ); DALI_TEST_CHECK( renderer ); @@ -864,6 +868,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION ); @@ -883,6 +889,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 2, TEST_LOCATION ); @@ -927,6 +935,8 @@ int UtcDaliAnimatedVectorImageVisualJumpTo(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER ); DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION ); -- 2.7.4 From e12e3567121d07d92b18f0ce8aab3a2785402b6c Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 22 Jun 2020 17:36:17 +0900 Subject: [PATCH 08/16] Add npatch utility Change-Id: I31cece8e4a1f85c515038f66a9afa3b697e7a112 --- .../utc-Dali-Visuals-internal.cpp | 140 --------- automated-tests/src/dali-toolkit/CMakeLists.txt | 1 + .../src/dali-toolkit/utc-Dali-NPatchUtilities.cpp | 302 ++++++++++++++++++++ .../src/dali-toolkit/utc-Dali-VisualFactory.cpp | 3 +- dali-toolkit/devel-api/file.list | 6 + .../devel-api/utility/npatch-utilities.cpp | 317 +++++++++++++++++++++ dali-toolkit/devel-api/utility/npatch-utilities.h | 75 +++++ dali-toolkit/internal/visuals/npatch-loader.cpp | 224 +-------------- dali-toolkit/internal/visuals/npatch-loader.h | 17 +- .../internal/visuals/npatch/npatch-visual.cpp | 8 +- 10 files changed, 715 insertions(+), 378 deletions(-) create mode 100644 automated-tests/src/dali-toolkit/utc-Dali-NPatchUtilities.cpp create mode 100644 dali-toolkit/devel-api/utility/npatch-utilities.cpp create mode 100644 dali-toolkit/devel-api/utility/npatch-utilities.h diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals-internal.cpp index d20cbcf..d607e33 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Visuals-internal.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include <../dali-toolkit/dali-toolkit-test-utils/dummy-control.h> #include @@ -161,145 +160,6 @@ int UtcDaliVisualSetProperties(void) END_TEST; } -int UtcDaliNPatchBufferGetRedOffsetAndMask(void) -{ - TestApplication application; - - tet_infoline("UtcDaliNPatchBufferGetRedOffsetAndMask"); - - int byteOffset = 0; - int bitMask = 0; - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::A8, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::L8, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::LA88, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGB888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGB8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGBA8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::BGR8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 2 && bitMask == 0xff ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::BGRA8888, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 2 && bitMask == 0xff ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGB565, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xf8 ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::BGR565, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x1f ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGBA4444, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xf0 ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::BGRA4444, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0xf0 ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGBA5551, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xf8 ); - - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::BGRA5551, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x1e ); - - // Compressed formats are not supported - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::INVALID, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_R11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SIGNED_R11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RG11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SIGNED_RG11_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC1, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA8_ETC2_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - - // Not supported - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGB16F, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - Toolkit::Internal::NPatchBuffer::GetRedOffsetAndMask( Pixel::RGB32F, byteOffset, bitMask ); - DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); - - END_TEST; -} - int UtcDaliAnimatedVectorImageVisualCreateInstancePropertyMap(void) { ToolkitTestApplication application; diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index 849bf3a..1488b2c 100755 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -71,6 +71,7 @@ SET(TC_SOURCES utc-Dali-SyncImageLoader.cpp utc-Dali-ControlWrapper.cpp utc-Dali-DragAndDropDetector.cpp + utc-Dali-NPatchUtilities.cpp ) # Append list of test harness files (Won't get parsed for test cases) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-NPatchUtilities.cpp b/automated-tests/src/dali-toolkit/utc-Dali-NPatchUtilities.cpp new file mode 100644 index 0000000..64f57d5 --- /dev/null +++ b/automated-tests/src/dali-toolkit/utc-Dali-NPatchUtilities.cpp @@ -0,0 +1,302 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ + +void InitialiseRegionsToZeroAlpha( Dali::Devel::PixelBuffer pixelBuffer, uint32_t width, uint32_t height, Pixel::Format pixelFormat ) +{ + unsigned char* buffer = pixelBuffer.GetBuffer(); + uint32_t bytesPerPixel = GetBytesPerPixel( pixelFormat ); + + for( uint32_t row = 0; row < width; ++row ) + { + uint32_t pixelOffset = row * bytesPerPixel; + buffer[ pixelOffset + 3 ] = 0x00; + pixelOffset += ( height - 1 ) * width * bytesPerPixel; + buffer[ pixelOffset + 3 ] = 0x00; + } + + for( unsigned int column = 0; column < height; ++column ) + { + uint32_t pixelOffset = column * width * bytesPerPixel; + buffer[ pixelOffset + 3 ] = 0x00; + pixelOffset += ( width -1 ) * bytesPerPixel; + buffer[ pixelOffset + 3 ] = 0x00; + } +} + +void AddStretchRegionsToImage( Dali::Devel::PixelBuffer pixelBuffer, uint32_t width, uint32_t height, const Vector4& requiredStretchBorder, Pixel::Format pixelFormat ) +{ + unsigned char* buffer = pixelBuffer.GetBuffer(); + uint32_t bytesPerPixel = GetBytesPerPixel( pixelFormat ); + + for( uint32_t column = requiredStretchBorder.x; column < width - requiredStretchBorder.z; ++column ) + { + uint32_t pixelOffset = column * bytesPerPixel; + buffer[ pixelOffset ] = 0x00; + buffer[ pixelOffset + 1 ] = 0x00; + buffer[ pixelOffset + 2 ] = 0x00; + buffer[ pixelOffset + 3 ] = 0xFF; + } + + for( uint32_t row = requiredStretchBorder.y; row < height - requiredStretchBorder.w; ++row ) + { + unsigned int pixelOffset = row * width * bytesPerPixel; + buffer[ pixelOffset ] = 0x00; + buffer[ pixelOffset + 1 ] = 0x00; + buffer[ pixelOffset + 2 ] = 0x00; + buffer[ pixelOffset + 3 ] = 0xFF; + } +} + +Dali::Devel::PixelBuffer CustomizeNPatch( uint32_t width, uint32_t height, const Vector4& requiredStretchBorder ) +{ + Pixel::Format pixelFormat = Pixel::RGBA8888; + Dali::Devel::PixelBuffer pixelBuffer = Dali::Devel::PixelBuffer::New( width, height, pixelFormat ); + + unsigned char* buffer = pixelBuffer.GetBuffer(); + memset( buffer, 0, width * height * Dali::Pixel::GetBytesPerPixel( pixelFormat ) ); + + InitialiseRegionsToZeroAlpha( pixelBuffer, width, height, pixelFormat ); + + AddStretchRegionsToImage( pixelBuffer, width, height, requiredStretchBorder, pixelFormat ); + + return pixelBuffer; +} + +} //namespace + +void dali_npatch_utilities_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_npatch_utilities_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliNPatchUtilityGetRedOffsetAndMask(void) +{ + TestApplication application; + + tet_infoline("UtcDaliNPatchUtilityGetRedOffsetAndMask"); + + int32_t byteOffset = 0; + int32_t bitMask = 0; + + NPatchUtility::GetRedOffsetAndMask( Pixel::A8, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::L8, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::LA88, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::RGB888, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); + NPatchUtility::GetRedOffsetAndMask( Pixel::RGB8888, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); + NPatchUtility::GetRedOffsetAndMask( Pixel::RGBA8888, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::BGR8888, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 2 && bitMask == 0xff ); + NPatchUtility::GetRedOffsetAndMask( Pixel::BGRA8888, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 2 && bitMask == 0xff ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::RGB565, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xf8 ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::BGR565, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x1f ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::RGBA4444, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xf0 ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::BGRA4444, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0xf0 ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::RGBA5551, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xf8 ); + + NPatchUtility::GetRedOffsetAndMask( Pixel::BGRA5551, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x1e ); + + // Compressed formats are not supported + NPatchUtility::GetRedOffsetAndMask( Pixel::INVALID, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_R11_EAC, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SIGNED_R11_EAC, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RG11_EAC, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SIGNED_RG11_EAC, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC2, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ETC2, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC1, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA8_ETC2_EAC, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + + // Not supported + NPatchUtility::GetRedOffsetAndMask( Pixel::RGB16F, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + NPatchUtility::GetRedOffsetAndMask( Pixel::RGB32F, byteOffset, bitMask ); + DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 ); + + END_TEST; +} + +int UtcDaliNPatchUtilityParseBorders(void) +{ + TestApplication application; + tet_infoline("UtcDaliNPatchUtilityParseBorders"); + + /* Stretch region left(2) top(2) right (2) bottom (2) + * ss + * OOOOOO + * OOOOOOc + * sOOooOOc + * sOOooOOc + * OOOOOOc + * OOOOOO + * cccc + */ + + const unsigned int imageHeight = 18; + const unsigned int imageWidth = 28; + const Vector4 requiredStretchBorder( 3, 4, 5, 6 ); + + Dali::Devel::PixelBuffer pixelBuffer = CustomizeNPatch( imageHeight, imageWidth, requiredStretchBorder ); + DALI_TEST_CHECK( pixelBuffer ); + + if( pixelBuffer ) + { + NPatchUtility::StretchRanges stretchPixelsX; + NPatchUtility::StretchRanges stretchPixelsY; + + NPatchUtility::ParseBorders( pixelBuffer, stretchPixelsX, stretchPixelsY ); + + DALI_TEST_CHECK( stretchPixelsX.Size() == 1 ); + DALI_TEST_CHECK( stretchPixelsY.Size() == 1 ); + + Vector4 stretchBorders; + //The NPatch image stretch pixels are in the cropped image space, inset by 1 to get it to uncropped image space + stretchBorders.x = stretchPixelsX[ 0 ].GetX() + 1; + stretchBorders.y = stretchPixelsY[ 0 ].GetX() + 1; + stretchBorders.z = imageHeight - stretchPixelsX[ 0 ].GetY() - 1; + stretchBorders.w = imageWidth - stretchPixelsY[ 0 ].GetY() - 1; + + DALI_TEST_EQUALS( stretchBorders, requiredStretchBorder, 0.001, TEST_LOCATION ); + } + else + { + test_return_value = TET_FAIL; + } + + END_TEST; +} + +int UtcDaliNPatchUtilityIsNinePatchUrl(void) +{ + tet_infoline( "UtcDaliNPatchUtilityIsNinePatchUrl" ); + + DALI_TEST_CHECK( NPatchUtility::IsNinePatchUrl( "test.9.jpg" ) ); + DALI_TEST_CHECK( NPatchUtility::IsNinePatchUrl( "test.#.jpg" ) ); + DALI_TEST_CHECK( !NPatchUtility::IsNinePatchUrl( "test.9" ) ); + DALI_TEST_CHECK( !NPatchUtility::IsNinePatchUrl( "test.#" ) ); + DALI_TEST_CHECK( !NPatchUtility::IsNinePatchUrl( "test" ) ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp index 513e132..b4c4f3f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "dummy-control.h" #include @@ -33,7 +34,7 @@ using namespace Dali::Toolkit; namespace { -typedef Toolkit::Internal::NPatchLoader::StretchRanges StretchRanges; +typedef Toolkit::NPatchUtility::StretchRanges StretchRanges; const char* TEST_9_PATCH_FILE_NAME = TEST_RESOURCE_DIR "/demo-tile-texture-focused.9.png"; const char* TEST_NPATCH_FILE_NAME = TEST_RESOURCE_DIR "/heartsframe.9.png"; diff --git a/dali-toolkit/devel-api/file.list b/dali-toolkit/devel-api/file.list index 5eb6d82..36f0649 100755 --- a/dali-toolkit/devel-api/file.list +++ b/dali-toolkit/devel-api/file.list @@ -47,6 +47,7 @@ SET( devel_api_src_files ${devel_api_src_dir}/transition-effects/cube-transition-effect.cpp ${devel_api_src_dir}/transition-effects/cube-transition-fold-effect.cpp ${devel_api_src_dir}/transition-effects/cube-transition-wave-effect.cpp + ${devel_api_src_dir}/utility/npatch-utilities.cpp ${devel_api_src_dir}/visual-factory/transition-data.cpp ${devel_api_src_dir}/visual-factory/visual-factory.cpp ${devel_api_src_dir}/visual-factory/visual-base.cpp @@ -223,6 +224,10 @@ SET( devel_api_drag_and_drop_detector_header_files ${devel_api_src_dir}/drag-drop-detector/drag-and-drop-detector.h ) +SET( devel_api_utility_header_files + ${devel_api_src_dir}/utility/npatch-utilities.h +) + SET( SOURCES ${SOURCES} ${devel_api_src_files} ) @@ -259,4 +264,5 @@ SET( DEVEL_API_HEADERS ${DEVEL_API_HEADERS} ${devel_api_video_view_header_files} ${devel_api_web_view_header_files} ${devel_api_drag_and_drop_detector_header_files} + ${devel_api_utility_header_files} ) diff --git a/dali-toolkit/devel-api/utility/npatch-utilities.cpp b/dali-toolkit/devel-api/utility/npatch-utilities.cpp new file mode 100644 index 0000000..a8b6e32 --- /dev/null +++ b/dali-toolkit/devel-api/utility/npatch-utilities.cpp @@ -0,0 +1,317 @@ +/* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace NPatchUtility +{ + +namespace +{ + +Uint16Pair ParseRange( uint32_t& index, uint32_t width, uint8_t*& pixel, uint32_t pixelStride, int32_t testByte, int32_t testBits, int32_t testValue ) +{ + unsigned int start = 0xFFFF; + for( ; index < width; ++index, pixel += pixelStride ) + { + if( ( pixel[ testByte ] & testBits ) == testValue ) + { + start = index; + ++index; + pixel += pixelStride; + break; + } + } + + unsigned int end = width; + for( ; index < width; ++index, pixel += pixelStride ) + { + if( ( pixel[ testByte ] & testBits ) != testValue ) + { + end = index; + ++index; + pixel += pixelStride; + break; + } + } + + return Uint16Pair( start, end ); +} + +} // unnamed namespace + +void GetRedOffsetAndMask( Dali::Pixel::Format pixelFormat, int32_t& byteOffset, int32_t& bitMask ) +{ + switch( pixelFormat ) + { + case Dali::Pixel::A8: + case Dali::Pixel::L8: + case Dali::Pixel::LA88: + { + byteOffset = 0; + bitMask = 0; + break; + } + case Dali::Pixel::RGB888: + case Dali::Pixel::RGB8888: + case Dali::Pixel::RGBA8888: + { + byteOffset = 0; + bitMask = 0xFF; + break; + } + case Dali::Pixel::BGR8888: + case Dali::Pixel::BGRA8888: + { + byteOffset = 2; + bitMask = 0xff; + break; + } + case Dali::Pixel::RGB565: + { + byteOffset = 0; + bitMask = 0xf8; + break; + } + case Dali::Pixel::BGR565: + { + byteOffset = 1; + bitMask = 0x1f; + break; + } + case Dali::Pixel::RGBA4444: + { + byteOffset = 0; + bitMask = 0xf0; + break; + } + case Dali::Pixel::BGRA4444: + { + byteOffset = 1; + bitMask = 0xf0; + break; + } + case Dali::Pixel::RGBA5551: + { + byteOffset = 0; + bitMask = 0xf8; + break; + } + case Dali::Pixel::BGRA5551: + { + byteOffset = 1; + bitMask = 0x1e; + break; + } + case Dali::Pixel::INVALID: + case Dali::Pixel::COMPRESSED_R11_EAC: + case Dali::Pixel::COMPRESSED_SIGNED_R11_EAC: + case Dali::Pixel::COMPRESSED_RG11_EAC: + case Dali::Pixel::COMPRESSED_SIGNED_RG11_EAC: + case Dali::Pixel::COMPRESSED_RGB8_ETC2: + case Dali::Pixel::COMPRESSED_SRGB8_ETC2: + case Dali::Pixel::COMPRESSED_RGB8_ETC1: + case Dali::Pixel::COMPRESSED_RGB_PVRTC_4BPPV1: + case Dali::Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + case Dali::Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + case Dali::Pixel::COMPRESSED_RGBA8_ETC2_EAC: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR: + case Dali::Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: + case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: + { + DALI_LOG_ERROR("Pixel formats for compressed images are not compatible with simple masking-out of per-pixel alpha.\n"); + byteOffset=0; + bitMask=0; + break; + } + case Dali::Pixel::RGB16F: + case Dali::Pixel::RGB32F: + case Dali::Pixel::DEPTH_UNSIGNED_INT: + case Dali::Pixel::DEPTH_FLOAT: + case Dali::Pixel::DEPTH_STENCIL: + { + DALI_LOG_ERROR("Pixel format not compatible.\n"); + byteOffset=0; + bitMask=0; + break; + } + } +} + +void ParseBorders( Devel::PixelBuffer& pixelBuffer, StretchRanges& stretchPixelsX, StretchRanges& stretchPixelsY ) +{ + stretchPixelsX.Clear(); + stretchPixelsY.Clear(); + + Pixel::Format pixelFormat = pixelBuffer.GetPixelFormat(); + + int32_t alphaByte = 0; + int32_t alphaBits = 0; + Pixel::GetAlphaOffsetAndMask( pixelFormat, alphaByte, alphaBits ); + + int32_t testByte = alphaByte; + int32_t testBits = alphaBits; + int32_t testValue = alphaBits; // Opaque == stretch + if( !alphaBits ) + { + GetRedOffsetAndMask( pixelFormat, testByte, testBits ); + testValue = 0; // Black == stretch + } + + uint32_t bytesPerPixel = Pixel::GetBytesPerPixel( pixelFormat ); + uint32_t width = pixelBuffer.GetWidth(); + uint32_t height = pixelBuffer.GetHeight(); + uint8_t* srcPixels = pixelBuffer.GetBuffer(); + uint32_t srcStride = width * bytesPerPixel; + + // TOP + uint8_t* top = srcPixels + bytesPerPixel; + uint32_t index = 0; + + for( ; index < width - 2; ) + { + Uint16Pair range = ParseRange( index, width - 2, top, bytesPerPixel, testByte, testBits, testValue ); + if( range.GetX() != 0xFFFF ) + { + stretchPixelsX.PushBack( range ); + } + } + + // LEFT + uint8_t* left = srcPixels + srcStride; + index = 0; + for( ; index < height - 2; ) + { + Uint16Pair range = ParseRange( index, height - 2, left, srcStride, testByte, testBits, testValue ); + if( range.GetX() != 0xFFFF ) + { + stretchPixelsY.PushBack( range ); + } + } + + // If there are no stretch pixels then make the entire image stretchable + if( stretchPixelsX.Size() == 0 ) + { + stretchPixelsX.PushBack( Uint16Pair( 0, width - 2 ) ); + } + if( stretchPixelsY.Size() == 0 ) + { + stretchPixelsY.PushBack( Uint16Pair( 0, height - 2 ) ); + } +} + +bool IsNinePatchUrl( const std::string& url ) +{ + bool match = false; + + std::string::const_reverse_iterator iter = url.rbegin(); + enum { SUFFIX, HASH, HASH_DOT, DONE } state = SUFFIX; + while(iter < url.rend()) + { + switch(state) + { + case SUFFIX: + { + if(*iter == '.') + { + state = HASH; + } + else if(!isalnum(*iter)) + { + state = DONE; + } + } + break; + case HASH: + { + if( *iter == '#' || *iter == '9' ) + { + state = HASH_DOT; + } + else + { + state = DONE; + } + } + break; + case HASH_DOT: + { + if(*iter == '.') + { + match = true; + } + state = DONE; // Stop testing characters + } + break; + case DONE: + { + } + break; + } + + // Satisfy prevent + if( state == DONE ) + { + break; + } + + ++iter; + } + return match; +} + +} // namespace NPatchBuffer + +} // namespace Toolkit + +} // namespace Dali diff --git a/dali-toolkit/devel-api/utility/npatch-utilities.h b/dali-toolkit/devel-api/utility/npatch-utilities.h new file mode 100644 index 0000000..c85e6cd --- /dev/null +++ b/dali-toolkit/devel-api/utility/npatch-utilities.h @@ -0,0 +1,75 @@ +#ifndef DALI_TOOLKIT_NPATCH_UTILITIES_H +#define DALI_TOOLKIT_NPATCH_UTILITIES_H + +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace NPatchUtility +{ + +/** + * The list that includes stretch pixel ranges + */ +using StretchRanges = Dali::Vector< Uint16Pair >; + +/** + * @brief Get the offset of the red channel for the format. + * + * @param[in] pixelFormat The pixel format + * @param[out] byteOffset The byte offset of the red channel. + * @param[out] bitMask The bit mask of the red channel. + */ +DALI_TOOLKIT_API void GetRedOffsetAndMask( Dali::Pixel::Format pixelFormat, int& byteOffset, int& bitMask ); + +/** + * @brief Read the borders of the buffer and determine the child area and stretch borders. + * + * @param[in] pixelBuffer The npatch image buffer. + * @param[out] stretchPixelsX The horizontal stretchable pixels in the cropped image space. + * @param[out] stretchPixelsY The vertical stretchable pixels in the cropped image space. + */ +DALI_TOOLKIT_API void ParseBorders( Devel::PixelBuffer& pixelBuffer, StretchRanges& stretchPixelsX, StretchRanges& stretchPixelsY ); + +/** + * @brief Helper method to determine if the filename indicates that the image has a 9 patch or n patch border. + * + * @param [in] url The URL of the image file. + * @return true if it is a 9 patch or n patch image + */ +DALI_TOOLKIT_API bool IsNinePatchUrl( const std::string& url ); + +} // namespace NPatchUtility + +} // namespace Toolkit + +} // namespace Dali + +#endif // DALI_TOOLKIT_NPATCH_UTILITIES_H diff --git a/dali-toolkit/internal/visuals/npatch-loader.cpp b/dali-toolkit/internal/visuals/npatch-loader.cpp index 0c6409d..d4a1f0e 100644 --- a/dali-toolkit/internal/visuals/npatch-loader.cpp +++ b/dali-toolkit/internal/visuals/npatch-loader.cpp @@ -18,8 +18,7 @@ // CLASS HEADER #include -// EXTERNAL HEADER -#include +// EXTERNAL INCLUDES #include #include @@ -35,226 +34,11 @@ namespace Internal namespace NPatchBuffer { -void GetRedOffsetAndMask( Dali::Pixel::Format pixelFormat, int& byteOffset, int& bitMask ) -{ - switch( pixelFormat ) - { - case Dali::Pixel::A8: - case Dali::Pixel::L8: - case Dali::Pixel::LA88: - { - byteOffset = 0; - bitMask = 0; - break; - } - case Dali::Pixel::RGB888: - case Dali::Pixel::RGB8888: - case Dali::Pixel::RGBA8888: - { - byteOffset = 0; - bitMask = 0xFF; - break; - } - case Dali::Pixel::BGR8888: - case Dali::Pixel::BGRA8888: - { - byteOffset = 2; - bitMask = 0xff; - break; - } - case Dali::Pixel::RGB565: - { - byteOffset = 0; - bitMask = 0xf8; - break; - } - case Dali::Pixel::BGR565: - { - byteOffset = 1; - bitMask = 0x1f; - break; - } - case Dali::Pixel::RGBA4444: - { - byteOffset = 0; - bitMask = 0xf0; - break; - } - case Dali::Pixel::BGRA4444: - { - byteOffset = 1; - bitMask = 0xf0; - break; - } - case Dali::Pixel::RGBA5551: - { - byteOffset = 0; - bitMask = 0xf8; - break; - } - case Dali::Pixel::BGRA5551: - { - byteOffset = 1; - bitMask = 0x1e; - break; - } - case Dali::Pixel::INVALID: - case Dali::Pixel::COMPRESSED_R11_EAC: - case Dali::Pixel::COMPRESSED_SIGNED_R11_EAC: - case Dali::Pixel::COMPRESSED_RG11_EAC: - case Dali::Pixel::COMPRESSED_SIGNED_RG11_EAC: - case Dali::Pixel::COMPRESSED_RGB8_ETC2: - case Dali::Pixel::COMPRESSED_SRGB8_ETC2: - case Dali::Pixel::COMPRESSED_RGB8_ETC1: - case Dali::Pixel::COMPRESSED_RGB_PVRTC_4BPPV1: - case Dali::Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: - case Dali::Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - case Dali::Pixel::COMPRESSED_RGBA8_ETC2_EAC: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR: - case Dali::Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: - case Dali::Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: - { - DALI_LOG_ERROR("Pixel formats for compressed images are not compatible with simple masking-out of per-pixel alpha.\n"); - byteOffset=0; - bitMask=0; - break; - } - case Dali::Pixel::RGB16F: - case Dali::Pixel::RGB32F: - case Dali::Pixel::DEPTH_UNSIGNED_INT: - case Dali::Pixel::DEPTH_FLOAT: - case Dali::Pixel::DEPTH_STENCIL: - { - DALI_LOG_ERROR("Pixel format not compatible.\n"); - byteOffset=0; - bitMask=0; - break; - } - } -} - -Uint16Pair ParseRange( unsigned int& index, unsigned int width, unsigned char*& pixel, unsigned int pixelStride, int testByte, int testBits, int testValue ) -{ - unsigned int start = 0xFFFF; - for( ; index < width; ++index, pixel += pixelStride ) - { - if( ( pixel[ testByte ] & testBits ) == testValue ) - { - start = index; - ++index; - pixel += pixelStride; - break; - } - } - - unsigned int end = width; - for( ; index < width; ++index, pixel += pixelStride ) - { - if( ( pixel[ testByte ] & testBits ) != testValue ) - { - end = index; - ++index; - pixel += pixelStride; - break; - } - } - - return Uint16Pair( start, end ); -} - -void ParseBorders( Devel::PixelBuffer& pixelBuffer, NPatchLoader::Data* data ) -{ - data->stretchPixelsX.Clear(); - data->stretchPixelsY.Clear(); - - Pixel::Format pixelFormat = pixelBuffer.GetPixelFormat(); - - int alphaByte = 0; - int alphaBits = 0; - Pixel::GetAlphaOffsetAndMask( pixelFormat, alphaByte, alphaBits ); - - int testByte = alphaByte; - int testBits = alphaBits; - int testValue = alphaBits; // Opaque == stretch - if( !alphaBits ) - { - GetRedOffsetAndMask( pixelFormat, testByte, testBits ); - testValue = 0; // Black == stretch - } - - unsigned int bytesPerPixel = Pixel::GetBytesPerPixel( pixelFormat ); - unsigned int width = pixelBuffer.GetWidth(); - unsigned int height = pixelBuffer.GetHeight(); - unsigned char* srcPixels = pixelBuffer.GetBuffer(); - unsigned int srcStride = width * bytesPerPixel; - - // TOP - unsigned char* top = srcPixels + bytesPerPixel; - unsigned int index = 0; - - for( ; index < width - 2; ) - { - Uint16Pair range = ParseRange( index, width - 2, top, bytesPerPixel, testByte, testBits, testValue ); - if( range.GetX() != 0xFFFF ) - { - data->stretchPixelsX.PushBack( range ); - } - } - - // LEFT - unsigned char* left = srcPixels + srcStride; - index = 0; - for( ; index < height - 2; ) - { - Uint16Pair range = ParseRange( index, height - 2, left, srcStride, testByte, testBits, testValue ); - if( range.GetX() != 0xFFFF ) - { - data->stretchPixelsY.PushBack( range ); - } - } - - // If there are no stretch pixels then make the entire image stretchable - if( data->stretchPixelsX.Size() == 0 ) - { - data->stretchPixelsX.PushBack( Uint16Pair( 0, width - 2 ) ); - } - if( data->stretchPixelsY.Size() == 0 ) - { - data->stretchPixelsY.PushBack( Uint16Pair( 0, height - 2 ) ); - } -} - void SetLoadedNPatchData( NPatchLoader::Data* data, Devel::PixelBuffer& pixelBuffer ) { if( data->border == Rect< int >( 0, 0, 0, 0 ) ) { - NPatchBuffer::ParseBorders( pixelBuffer, data ); + NPatchUtility::ParseBorders( pixelBuffer, data->stretchPixelsX, data->stretchPixelsY ); // Crop the image pixelBuffer.Crop( 1, 1, pixelBuffer.GetWidth() - 2, pixelBuffer.GetHeight() - 2 ); @@ -328,10 +112,10 @@ std::size_t NPatchLoader::Load( TextureManager& textureManager, TextureUploadObs data->textureSet = mCache[ index ]->textureSet; - StretchRanges stretchRangesX; + NPatchUtility::StretchRanges stretchRangesX; stretchRangesX.PushBack( Uint16Pair( border.left, ( (data->croppedWidth >= static_cast< unsigned int >( border.right )) ? data->croppedWidth - border.right : 0 ) ) ); - StretchRanges stretchRangesY; + NPatchUtility::StretchRanges stretchRangesY; stretchRangesY.PushBack( Uint16Pair( border.top, ( (data->croppedHeight >= static_cast< unsigned int >( border.bottom )) ? data->croppedHeight - border.bottom : 0 ) ) ); data->stretchPixelsX = stretchRangesX; diff --git a/dali-toolkit/internal/visuals/npatch-loader.h b/dali-toolkit/internal/visuals/npatch-loader.h index 6bdc2f9..58bd73f 100644 --- a/dali-toolkit/internal/visuals/npatch-loader.h +++ b/dali-toolkit/internal/visuals/npatch-loader.h @@ -20,12 +20,12 @@ // EXTERNAL INCLUDES #include #include -#include #include #include -// INTERNAL HEADERS +// INTERNAL INCLUDES #include +#include namespace Dali { @@ -36,13 +36,6 @@ namespace Toolkit namespace Internal { -namespace NPatchBuffer -{ - -void GetRedOffsetAndMask( Dali::Pixel::Format pixelFormat, int& byteOffset, int& bitMask ); - -} // namespace NPatchBuffer - /** * The manager for loading Npatch textures. * It caches them internally for better performance; i.e. to avoid loading and @@ -56,8 +49,6 @@ class NPatchLoader { public: - typedef Dali::Vector< Uint16Pair > StretchRanges; - enum { UNINITIALIZED_ID = 0 ///< uninitialised id, use to initialize ids @@ -77,8 +68,8 @@ public: std::string url; ///< Url of the N-Patch TextureSet textureSet; ///< Texture containing the cropped image - StretchRanges stretchPixelsX; ///< X stretch pixels - StretchRanges stretchPixelsY; ///< Y stretch pixels + NPatchUtility::StretchRanges stretchPixelsX; ///< X stretch pixels + NPatchUtility::StretchRanges stretchPixelsY; ///< Y stretch pixels std::size_t hash; ///< Hash code for the Url uint32_t croppedWidth; ///< Width of the cropped middle part of N-patch uint32_t croppedHeight; ///< Height of the cropped middle part of N-patch diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp index ef77ee5..02f9e1b 100755 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -223,13 +223,13 @@ void AddVertex( Vector< Vector2 >& vertices, unsigned int x, unsigned int y ) vertices.PushBack( Vector2( x, y ) ); } -void RegisterStretchProperties( Renderer& renderer, const char * uniformName, const NPatchLoader::StretchRanges& stretchPixels, uint16_t imageExtent) +void RegisterStretchProperties( Renderer& renderer, const char * uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent) { uint16_t prevEnd = 0; uint16_t prevFix = 0; uint16_t prevStretch = 0; unsigned int i = 1; - for( NPatchLoader::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i ) + for( NPatchUtility::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i ) { uint16_t start = it->GetX(); uint16_t end = it->GetY(); @@ -518,8 +518,8 @@ Shader NPatchVisual::CreateShader() const NPatchLoader::Data* data; // 0 is either no data (load failed?) or no stretch regions on image // for both cases we use the default shader - NPatchLoader::StretchRanges::SizeType xStretchCount = 0; - NPatchLoader::StretchRanges::SizeType yStretchCount = 0; + NPatchUtility::StretchRanges::SizeType xStretchCount = 0; + NPatchUtility::StretchRanges::SizeType yStretchCount = 0; auto fragmentShader = mAuxiliaryPixelBuffer ? FRAGMENT_MASK_SHADER : FRAGMENT_SHADER; -- 2.7.4 From d50b2163fcc2c91b0cb25f9b5f3d849e4e247e09 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Thu, 25 Jun 2020 11:24:28 +0900 Subject: [PATCH 09/16] Change target share directory from dali to dali-legacy Change-Id: I854e6e6f307708af3f7ec5e64f3fde930fd2e34e Signed-off-by: Seungho, Baek --- CMakeLists.txt | 10 +++++----- build/tizen/CMakeLists.txt | 12 ++++++------ packaging/dali-toolkit.spec | 20 ++++++++++++++++++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff17e64..a2fe956 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,11 +4,11 @@ PROJECT (dali-toolkit) ADD_DEFINITIONS( -DDALI_ENV="../../dali-env" --DDALI_DATA_READ_ONLY_DIR=DALI_ENV"/opt/share/dali" --DDALI_IMAGE_DIR=DALI_ENV"/opt/share/dali/toolkit/images/" --DDALI_STYLE_DIR=DALI_ENV"/opt/share/dali/toolkit/styles/" --DDALI_SOUND_DIR=DALI_ENV"/opt/share/dali/toolkit/sounds/" --DDALI_STYLE_IMAGE_DIR=DALI_ENV"/opt/share/dali/toolkit/styles/images/" +-DDALI_DATA_READ_ONLY_DIR=DALI_ENV"/opt/share/dali-legacy" +-DDALI_IMAGE_DIR=DALI_ENV"/opt/share/dali-legacy/toolkit/images/" +-DDALI_STYLE_DIR=DALI_ENV"/opt/share/dali-legacy/toolkit/styles/" +-DDALI_SOUND_DIR=DALI_ENV"/opt/share/dali-legacy/toolkit/sounds/" +-DDALI_STYLE_IMAGE_DIR=DALI_ENV"/opt/share/dali-legacy/toolkit/styles/images/" -DCURL_STATICLIB=0 /DBUILDING_DALI_TOOLKIT /vmg diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 25edb06..fde4eb2 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -79,13 +79,13 @@ SET( toolkit_style_images_dir ${STYLE_DIR}/images ) IF( DEFINED ENV{DALI_DATA_RW_DIR} ) SET( dataReadWriteDir $ENV{DALI_DATA_RW_DIR} ) ELSE() - SET( dataReadWriteDir ${CMAKE_INSTALL_PREFIX}/share/dali/ ) + SET( dataReadWriteDir ${CMAKE_INSTALL_PREFIX}/share/dali-legacy/ ) ENDIF() IF( DEFINED ENV{DALI_DATA_RO_DIR} ) SET( dataReadOnlyDir $ENV{DALI_DATA_RO_DIR} ) ELSE() - SET( dataReadOnlyDir ${CMAKE_INSTALL_PREFIX}/share/dali/ ) + SET( dataReadOnlyDir ${CMAKE_INSTALL_PREFIX}/share/dali-legacy/ ) ENDIF() # Set up compiler definitions @@ -115,10 +115,10 @@ IF( WIN32 ) SET( INSTALL_SHARE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share" ) ENDIF() - ADD_DEFINITIONS( -DDALI_IMAGE_DIR=\"${INSTALL_SHARE_DIR}/dali/toolkit/images/\" - -DDALI_SOUND_DIR=\"${INSTALL_SHARE_DIR}/dali/toolkit/sounds/\" - -DDALI_STYLE_DIR=\"${INSTALL_SHARE_DIR}/dali/toolkit/styles/\" - -DDALI_STYLE_IMAGE_DIR=\"${INSTALL_SHARE_DIR}/dali/toolkit/styles/images/\" + ADD_DEFINITIONS( -DDALI_IMAGE_DIR=\"${INSTALL_SHARE_DIR}/dali-legacy/toolkit/images/\" + -DDALI_SOUND_DIR=\"${INSTALL_SHARE_DIR}/dali-legacy/toolkit/sounds/\" + -DDALI_STYLE_DIR=\"${INSTALL_SHARE_DIR}/dali-legacy/toolkit/styles/\" + -DDALI_STYLE_IMAGE_DIR=\"${INSTALL_SHARE_DIR}/dali-legacy/toolkit/styles/images/\" -DDALI_DATA_READ_ONLY_DIR=\"${INSTALL_SHARE_DIR}/\" ) ENDIF() ELSEIF( UNIX ) diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 6c2f417..71dced0 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -88,8 +88,8 @@ Application development package for Dali 3D engine toolkit - headers and package %prep %setup -q -%define dali_data_rw_dir %TZ_SYS_SHARE/dali/ -%define dali_data_ro_dir %TZ_SYS_RO_SHARE/dali/ +%define dali_data_rw_dir %TZ_SYS_SHARE/dali-legacy/ +%define dali_data_ro_dir %TZ_SYS_RO_SHARE/dali-legacy/ %define dali_toolkit_image_files %{dali_data_ro_dir}/toolkit/images/ %define dali_toolkit_sound_files %{dali_data_ro_dir}/toolkit/sounds/ @@ -194,6 +194,7 @@ popd %pre resources_360x360 case "$1" in 2) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf ./* popd @@ -203,6 +204,7 @@ esac %pre resources_480x800 case "$1" in 2) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf ./* popd @@ -212,6 +214,7 @@ esac %pre resources_720x1280 case "$1" in 2) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf ./* popd @@ -221,6 +224,7 @@ esac %pre resources_1920x1080 case "$1" in 2) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf ./* popd @@ -235,21 +239,25 @@ esac exit 0 %post resources_360x360 +mkdir -p %{dali_toolkit_style_files}/360x360 pushd %{dali_toolkit_style_files}/360x360 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done popd %post resources_480x800 +mkdir -p %{dali_toolkit_style_files}/480x800 pushd %{dali_toolkit_style_files}/480x800 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done popd %post resources_720x1280 +mkdir -p %{dali_toolkit_style_files}/720x1280 pushd %{dali_toolkit_style_files}/720x1280 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done popd %post resources_1920x1080 +mkdir -p %{dali_toolkit_style_files}/1920x1080 pushd %{dali_toolkit_style_files}/1920x1080 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done popd @@ -262,6 +270,7 @@ popd case "$1" in 0) %preun resources_360x360 + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} mv images ./360x360 mv dali-toolkit-default-theme.json ./360x360 @@ -273,6 +282,7 @@ esac case "$1" in 0) %preun resources_480x800 + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} mv images ./480x800 mv dali-toolkit-default-theme.json ./480x800 @@ -284,6 +294,7 @@ esac case "$1" in 0) %preun resources_720x1280 + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} mv images ./720x1280 mv dali-toolkit-default-theme.json ./720x1280 @@ -295,6 +306,7 @@ esac case "$1" in 0) %preun resources_1920x1080 + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} mv images ./1920x1080 mv dali-toolkit-default-theme.json ./1920x1080 @@ -312,6 +324,7 @@ exit 0 %postun resources_360x360 case "$1" in 0) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf * popd @@ -321,6 +334,7 @@ esac %postun resources_480x800 case "$1" in 0) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf * popd @@ -330,6 +344,7 @@ esac %postun resources_720x1280 case "$1" in 0) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf * popd @@ -339,6 +354,7 @@ esac %postun resources_1920x1080 case "$1" in 0) + mkdir -p %{dali_toolkit_style_files} pushd %{dali_toolkit_style_files} rm -rf * popd -- 2.7.4 From e76b7c695d12f578a61afa1788cd8cd8d9700bfe Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Fri, 12 Jun 2020 21:43:23 +0900 Subject: [PATCH 10/16] Support WebP format - Modified animated-image-visual to support webp amimated image format - Added and removed some functions of image-cache to use rolling-animated-image-cache for the both of gif and webp - Checked whether mFrameDelayTimer is null or not for the case that Action::PLAY is entered but the system do not support animated webp Change-Id: I254c4c8e715772acb6c0725c58e64aba1a6dafc4 Signed-off-by: Seungho, Baek --- .../dali-toolkit/utc-Dali-AnimatedImageVisual.cpp | 2 +- dali-toolkit/internal/file.list | 2 +- .../animated-image/animated-image-visual.cpp | 35 +++++----- .../visuals/animated-image/animated-image-visual.h | 15 ++--- .../visuals/animated-image/fixed-image-cache.cpp | 26 +++----- .../visuals/animated-image/fixed-image-cache.h | 6 +- .../internal/visuals/animated-image/image-cache.h | 10 ++- ...-cache.cpp => rolling-animated-image-cache.cpp} | 78 +++++++++------------- ...mage-cache.h => rolling-animated-image-cache.h} | 42 ++++++------ .../visuals/animated-image/rolling-image-cache.cpp | 21 +----- .../visuals/animated-image/rolling-image-cache.h | 6 +- .../internal/visuals/visual-factory-impl.cpp | 2 + dali-toolkit/internal/visuals/visual-url.cpp | 12 +++- dali-toolkit/internal/visuals/visual-url.h | 3 +- 14 files changed, 112 insertions(+), 148 deletions(-) rename dali-toolkit/internal/visuals/animated-image/{rolling-gif-image-cache.cpp => rolling-animated-image-cache.cpp} (68%) rename dali-toolkit/internal/visuals/animated-image/{rolling-gif-image-cache.h => rolling-animated-image-cache.h} (72%) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp index bb591dd..bad5ea0 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp @@ -293,7 +293,7 @@ int UtcDaliAnimatedImageVisualStopBehavior(void) } -int UtcDaliAnimatedImageVisualGif01(void) +int UtcDaliAnimatedImageVisualAnimatedImage01(void) { ToolkitTestApplication application; TestGlAbstraction& gl = application.GetGlAbstraction(); diff --git a/dali-toolkit/internal/file.list b/dali-toolkit/internal/file.list index 8f3b2f2..246ba89 100644 --- a/dali-toolkit/internal/file.list +++ b/dali-toolkit/internal/file.list @@ -17,7 +17,7 @@ SET( toolkit_src_files ${toolkit_src_dir}/visuals/animated-image/image-cache.cpp ${toolkit_src_dir}/visuals/animated-image/fixed-image-cache.cpp ${toolkit_src_dir}/visuals/animated-image/rolling-image-cache.cpp - ${toolkit_src_dir}/visuals/animated-image/rolling-gif-image-cache.cpp + ${toolkit_src_dir}/visuals/animated-image/rolling-animated-image-cache.cpp ${toolkit_src_dir}/visuals/animated-vector-image/animated-vector-image-visual.cpp ${toolkit_src_dir}/visuals/animated-vector-image/vector-animation-task.cpp ${toolkit_src_dir}/visuals/animated-vector-image/vector-animation-thread.cpp diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp index 386013a..fdde260 100755 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -111,7 +111,7 @@ Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, " AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties ) { AnimatedImageVisualPtr visual( new AnimatedImageVisual( factoryCache, shaderFactory ) ); - visual->InitializeGif( imageUrl ); + visual->InitializeAnimatedImage( imageUrl ); visual->SetProperties( properties ); if( visual->mFrameCount > 0 ) @@ -149,7 +149,7 @@ AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCach AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl ) { AnimatedImageVisualPtr visual( new AnimatedImageVisual( factoryCache, shaderFactory ) ); - visual->InitializeGif( imageUrl ); + visual->InitializeAnimatedImage( imageUrl ); if( visual->mFrameCount > 0 ) { @@ -159,12 +159,11 @@ AnimatedImageVisualPtr AnimatedImageVisual::New( VisualFactoryCache& factoryCach return visual; } -void AnimatedImageVisual::InitializeGif( const VisualUrl& imageUrl ) +void AnimatedImageVisual::InitializeAnimatedImage( const VisualUrl& imageUrl ) { mImageUrl = imageUrl; - mGifLoading = GifLoading::New( imageUrl.GetUrl(), imageUrl.IsLocalResource() ); - mFrameCount = mGifLoading->GetImageCount(); - mGifLoading->LoadFrameDelays( mFrameDelayContainer ); + mAnimatedImageLoading = AnimatedImageLoading::New( imageUrl.GetUrl(), imageUrl.IsLocalResource() ); + mFrameCount = mAnimatedImageLoading.GetImageCount(); } AnimatedImageVisual::AnimatedImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory ) @@ -174,7 +173,7 @@ AnimatedImageVisual::AnimatedImageVisual( VisualFactoryCache& factoryCache, Imag mImageVisualShaderFactory( shaderFactory ), mPixelArea( FULL_TEXTURE_RECT ), mImageUrl(), - mGifLoading( nullptr ), + mAnimatedImageLoading(), mCurrentFrameIndex( 0 ), mImageUrls( NULL ), mImageCache( NULL ), @@ -206,7 +205,7 @@ void AnimatedImageVisual::GetNaturalSize( Vector2& naturalSize ) { if( mImageUrl.IsValid() ) { - mImageSize = mGifLoading->GetImageSize(); + mImageSize = mAnimatedImageLoading.GetImageSize(); } else if( mImageUrls && mImageUrls->size() > 0 ) { @@ -270,7 +269,7 @@ void AnimatedImageVisual::OnDoAction( const Dali::Property::Index actionId, cons } case DevelAnimatedImageVisual::Action::PLAY: { - if( IsOnStage() && mActionStatus != DevelAnimatedImageVisual::Action::PLAY ) + if( mFrameDelayTimer && IsOnStage() && mActionStatus != DevelAnimatedImageVisual::Action::PLAY ) { mFrameDelayTimer.Start(); } @@ -542,9 +541,9 @@ void AnimatedImageVisual::LoadFirstBatch() mUrlIndex = 0; TextureManager& textureManager = mFactoryCache.GetTextureManager(); - if( mGifLoading != nullptr ) + if( mAnimatedImageLoading ) { - mImageCache = new RollingGifImageCache( textureManager, *mGifLoading, mFrameCount, *this, cacheSize, batchSize ); + mImageCache = new RollingAnimatedImageCache( textureManager, mAnimatedImageLoading, mFrameCount, *this, cacheSize, batchSize ); } else if( mImageUrls ) { @@ -592,11 +591,10 @@ void AnimatedImageVisual::StartFirstFrame( TextureSet& textureSet ) if( mFrameCount > 1 ) { int frameDelay = mFrameDelay; // from URL array - if( mFrameDelayContainer.Count() > 0 ) // from GIF + if( mAnimatedImageLoading && mImageCache ) { - frameDelay = mFrameDelayContainer[0]; + frameDelay = mImageCache->GetFrameInterval( 0 ); } - mFrameDelayTimer = Timer::New( frameDelay ); mFrameDelayTimer.TickSignal().Connect( this, &AnimatedImageVisual::DisplayNextFrame ); mFrameDelayTimer.Start(); @@ -706,11 +704,10 @@ bool AnimatedImageVisual::DisplayNextFrame() return DisplayNextFrame(); } } - - if( mFrameDelayContainer.Count() > 0 ) + // TODO : newly added one. + if( mAnimatedImageLoading && mImageCache ) { - unsigned int delay = mFrameDelayContainer[mCurrentFrameIndex]; - + unsigned int delay = mImageCache->GetFrameInterval( mCurrentFrameIndex ); if( mFrameDelayTimer.GetInterval() != delay ) { mFrameDelayTimer.SetInterval( delay ); diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h index 0d21f97..7c0764e 100755 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include // INTERNAL INCLUDES #include @@ -92,7 +92,7 @@ public: * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] shaderFactory The ImageVisualShaderFactory object - * @param[in] imageUrl The URL to gif resource to use + * @param[in] imageUrl The URL to animated image resource to use * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ @@ -224,10 +224,10 @@ private: bool DisplayNextFrame(); /** - * Initialize the gif variables. - * @param[in] imageUrl The url of the animated gif + * Initialize the animated image variables. + * @param[in] imageUrl The url of the animated image */ - void InitializeGif( const VisualUrl& imageUrl ); + void InitializeAnimatedImage( const VisualUrl& imageUrl ); // Undefined AnimatedImageVisual( const AnimatedImageVisual& animatedImageVisual ); @@ -241,11 +241,10 @@ private: WeakHandle mPlacementActor; ImageVisualShaderFactory& mImageVisualShaderFactory; - // Variables for GIF player - Dali::Vector mFrameDelayContainer; + // Variables for Animated Image player Vector4 mPixelArea; VisualUrl mImageUrl; - std::unique_ptr mGifLoading; // Only needed for animated gifs + Dali::AnimatedImageLoading mAnimatedImageLoading; // Only needed for animated image uint32_t mCurrentFrameIndex; // Frame index into textureRects // Variables for Multi-Image player diff --git a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp index d71ee94..726cd39 100644 --- a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp @@ -58,8 +58,14 @@ TextureSet FixedImageCache::Frame( uint32_t frameIndex ) { while( frameIndex > mFront ) { - NextFrame(); + ++mFront; + if( mFront >= mImageUrls.size() ) + { + mFront = 0; + } + LoadBatch(); } + mFront = frameIndex; TextureSet textureSet; @@ -87,23 +93,9 @@ TextureSet FixedImageCache::FirstFrame() return textureSet; } -TextureSet FixedImageCache::NextFrame() +uint32_t FixedImageCache::GetFrameInterval( uint32_t frameIndex ) { - TextureSet textureSet; - ++mFront; - mFront %= mImageUrls.size(); - - if( IsFrontReady() == true ) - { - textureSet = GetFrontTextureSet(); - } - else - { - mWaitingForReadyFrame = true; - } - LoadBatch(); - - return textureSet; + return 0u; } bool FixedImageCache::IsFrontReady() const diff --git a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h index d884e28..5063232 100644 --- a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h +++ b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h @@ -61,11 +61,9 @@ public: TextureSet FirstFrame() override; /** - * Get the next frame. If it's not ready, this will trigger the - * sending of FrameReady() when the image becomes ready. - * This will trigger the loading of the next batch. + * Get the interval of Nth frame. */ - TextureSet NextFrame() override; + uint32_t GetFrameInterval( uint32_t frameIndex ) override; private: /** diff --git a/dali-toolkit/internal/visuals/animated-image/image-cache.h b/dali-toolkit/internal/visuals/animated-image/image-cache.h index 7354992..1d385c8 100644 --- a/dali-toolkit/internal/visuals/animated-image/image-cache.h +++ b/dali-toolkit/internal/visuals/animated-image/image-cache.h @@ -79,17 +79,15 @@ public: virtual TextureSet FirstFrame() = 0; /** - * Get the next frame. If it's not ready, this will trigger the + * Get the Nth frame. If it's not ready, this will trigger the * sending of FrameReady() when the image becomes ready. - * This will trigger the loading of the next batch. */ - virtual TextureSet NextFrame() = 0; + virtual TextureSet Frame( uint32_t frameIndex ) = 0; /** - * Get the Nth frame. If it's not ready, this will trigger the - * sending of FrameReady() when the image becomes ready. + * Get the interval of Nth frame. */ - virtual TextureSet Frame( uint32_t frameIndex ) = 0; + virtual uint32_t GetFrameInterval( uint32_t frameIndex ) = 0; private: diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-gif-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp similarity index 68% rename from dali-toolkit/internal/visuals/animated-image/rolling-gif-image-cache.cpp rename to dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp index 04f0f1d..c421678 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-gif-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp @@ -15,7 +15,7 @@ */ // CLASS HEADER -#include "rolling-gif-image-cache.h" +#include "rolling-animated-image-cache.h" // EXTERNAL HEADERS @@ -58,11 +58,11 @@ namespace Toolkit namespace Internal { -RollingGifImageCache::RollingGifImageCache( - TextureManager& textureManager, GifLoading& gifLoading, uint32_t frameCount, ImageCache::FrameReadyObserver& observer, +RollingAnimatedImageCache::RollingAnimatedImageCache( + TextureManager& textureManager, AnimatedImageLoading& animatedImageLoading, uint32_t frameCount, ImageCache::FrameReadyObserver& observer, uint16_t cacheSize, uint16_t batchSize ) : ImageCache( textureManager, observer, batchSize ), - mGifLoading( gifLoading ), + mAnimatedImageLoading( animatedImageLoading ), mFrameCount( frameCount ), mFrameIndex( 0 ), mCacheSize( cacheSize ), @@ -72,11 +72,11 @@ RollingGifImageCache::RollingGifImageCache( LoadBatch(); } -RollingGifImageCache::~RollingGifImageCache() +RollingAnimatedImageCache::~RollingAnimatedImageCache() { if( mTextureManagerAlive ) { - while( !mQueue.IsEmpty() ) + while( IsFrontReady() ) { ImageFrame imageFrame = mQueue.PopFront(); Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl ); @@ -84,64 +84,51 @@ RollingGifImageCache::~RollingGifImageCache() } } -TextureSet RollingGifImageCache::Frame( uint32_t frameIndex ) +TextureSet RollingAnimatedImageCache::Frame( uint32_t frameIndex ) { - // If a frame of frameIndex is not loaded, clear the queue and remove all loaded textures. - if( mImageUrls[ frameIndex ].mTextureId == TextureManager::INVALID_TEXTURE_ID ) + bool popExist = false; + while( IsFrontReady() && mQueue.Front().mFrameNumber != frameIndex ) { - mFrameIndex = frameIndex; - while( !mQueue.IsEmpty() ) - { - ImageFrame imageFrame = mQueue.PopFront(); - Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl ); - mImageUrls[ imageFrame.mFrameNumber ].mTextureId = TextureManager::INVALID_TEXTURE_ID; - } - LoadBatch(); + ImageFrame imageFrame = mQueue.PopFront(); + Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl ); + mImageUrls[ imageFrame.mFrameNumber ].mTextureId = TextureManager::INVALID_TEXTURE_ID; + popExist = true; } - // If the frame is already loaded, remove previous frames of the frame in the queue - // and load new frames amount of removed frames. - else + if( popExist || mImageUrls[ frameIndex ].mTextureId == TextureManager::INVALID_TEXTURE_ID ) { - bool popExist = false; - while( !mQueue.IsEmpty() && mQueue.Front().mFrameNumber != frameIndex ) + // If the frame of frameIndex was already loaded, load batch from the last frame of queue + if( IsFrontReady() ) { - ImageFrame imageFrame = mQueue.PopFront(); - Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl ); - mImageUrls[ imageFrame.mFrameNumber ].mTextureId = TextureManager::INVALID_TEXTURE_ID; - popExist = true; + mFrameIndex = ( mQueue.Back().mFrameNumber + 1 ) % mFrameCount; } - if( popExist ) + // If the queue is empty, load batch from the frame of frameIndex + else { - mFrameIndex = ( mQueue.Back().mFrameNumber + 1 ) % mFrameCount; - LoadBatch(); + mFrameIndex = frameIndex; } + LoadBatch(); } return GetFrontTextureSet(); } -TextureSet RollingGifImageCache::FirstFrame() +TextureSet RollingAnimatedImageCache::FirstFrame() { return Frame( 0u ); } -TextureSet RollingGifImageCache::NextFrame() +uint32_t RollingAnimatedImageCache::GetFrameInterval( uint32_t frameIndex ) { - ImageFrame imageFrame = mQueue.PopFront(); - Dali::Toolkit::TextureManager::RemoveTexture( mImageUrls[ imageFrame.mFrameNumber ].mUrl ); - mImageUrls[ imageFrame.mFrameNumber ].mTextureId = TextureManager::INVALID_TEXTURE_ID; - - LoadBatch(); - - return GetFrontTextureSet(); + Frame( frameIndex ); + return mAnimatedImageLoading.GetFrameInterval( frameIndex ); } -bool RollingGifImageCache::IsFrontReady() const +bool RollingAnimatedImageCache::IsFrontReady() const { return ( !mQueue.IsEmpty() ); } -void RollingGifImageCache::LoadBatch() +void RollingAnimatedImageCache::LoadBatch() { // Try and load up to mBatchSize images, until the cache is filled. // Once the cache is filled, as frames progress, the old frame is @@ -151,9 +138,8 @@ void RollingGifImageCache::LoadBatch() // Get the smallest number of frames we need to load int batchSize = std::min( std::size_t(mBatchSize), mCacheSize - mQueue.Count() ); - DALI_LOG_INFO( gAnimImgLogFilter, Debug::Concise, "RollingGifImageCache::LoadBatch() mFrameIndex:%d batchSize:%d\n", mFrameIndex, batchSize ); - - if( mGifLoading.LoadNextNFrames( mFrameIndex, batchSize, pixelDataList) ) + DALI_LOG_INFO( gAnimImgLogFilter, Debug::Concise, "RollingAnimatedImageCache::LoadBatch() mFrameIndex:%d batchSize:%d\n", mFrameIndex, batchSize ); + if( mAnimatedImageLoading.LoadNextNFrames( mFrameIndex, batchSize, pixelDataList) ) { unsigned int pixelDataListCount = pixelDataList.size(); @@ -203,15 +189,15 @@ void RollingGifImageCache::LoadBatch() LOG_CACHE; } -TextureSet RollingGifImageCache::GetFrontTextureSet() const +TextureSet RollingAnimatedImageCache::GetFrontTextureSet() const { - DALI_LOG_INFO( gAnimImgLogFilter, Debug::Concise, "RollingGifImageCache::GetFrontTextureSet() FrameNumber:%d\n", mQueue[ 0 ].mFrameNumber ); + DALI_LOG_INFO( gAnimImgLogFilter, Debug::Concise, "RollingAnimatedImageCache::GetFrontTextureSet() FrameNumber:%d\n", mQueue[ 0 ].mFrameNumber ); TextureManager::TextureId textureId = GetCachedTextureId( 0 ); return mTextureManager.GetTextureSet( textureId ); } -TextureManager::TextureId RollingGifImageCache::GetCachedTextureId( int index ) const +TextureManager::TextureId RollingAnimatedImageCache::GetCachedTextureId( int index ) const { return mImageUrls[ mQueue[ index ].mFrameNumber ].mTextureId; } diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-gif-image-cache.h b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h similarity index 72% rename from dali-toolkit/internal/visuals/animated-image/rolling-gif-image-cache.h rename to dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h index 91a1210..503f65e 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-gif-image-cache.h +++ b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h @@ -1,5 +1,5 @@ -#ifndef DALI_TOOLKIT_INTERNAL_ROLLING_GIF_IMAGE_CACHE_H -#define DALI_TOOLKIT_INTERNAL_ROLLING_GIF_IMAGE_CACHE_H +#ifndef DALI_TOOLKIT_INTERNAL_ROLLING_ANIMATED_IMAGE_CACHE_H +#define DALI_TOOLKIT_INTERNAL_ROLLING_ANIMATED_IMAGE_CACHE_H /* * Copyright (c) 2020 Samsung Electronics Co., Ltd. @@ -18,7 +18,7 @@ */ // EXTERNAL INCLUDES -#include +#include #include #include #include @@ -31,20 +31,20 @@ namespace Internal { /** - * Class to manage a rolling cache of GIF images, where the cache size + * Class to manage a rolling cache of Animated images, where the cache size * is smaller than the total number of images. * * Frames are always ready, so the observer.FrameReady callback is never triggered; * the FirstFrame and NextFrame APIs will always return a texture. */ -class RollingGifImageCache : public ImageCache +class RollingAnimatedImageCache : public ImageCache { public: /** * Constructor. * @param[in] textureManager The texture manager - * @param[in] gifLoader The loaded gif image - * @param[in] frameCount The number of frames in the gif + * @param[in] animatedImageLoader The loaded animated image + * @param[in] frameCount The number of frames in the animated image * @param[in] observer FrameReady observer * @param[in] cacheSize The size of the cache * @param[in] batchSize The size of a batch to load @@ -52,8 +52,8 @@ public: * This will start loading textures immediately, according to the * batch and cache sizes. */ - RollingGifImageCache( TextureManager& textureManager, - GifLoading& gifLoader, + RollingAnimatedImageCache( TextureManager& textureManager, + AnimatedImageLoading& animatedImageLoader, uint32_t frameCount, ImageCache::FrameReadyObserver& observer, uint16_t cacheSize, @@ -62,7 +62,7 @@ public: /** * Destructor */ - virtual ~RollingGifImageCache(); + virtual ~RollingAnimatedImageCache(); /** * Get the Nth frame. If it's not ready, this will trigger the @@ -77,11 +77,9 @@ public: TextureSet FirstFrame() override; /** - * Get the next frame. If it's not ready, this will trigger the - * sending of FrameReady() when the image becomes ready. - * This will trigger the loading of the next batch. + * Get the interval of Nth frame. */ - TextureSet NextFrame() override; + uint32_t GetFrameInterval( uint32_t frameIndex ) override; private: /** @@ -114,16 +112,18 @@ private: unsigned int mFrameNumber = 0u; }; - GifLoading& mGifLoading; - uint32_t mFrameCount; - int mFrameIndex; - std::vector mImageUrls; - uint16_t mCacheSize; - CircularQueue mQueue; + Dali::AnimatedImageLoading& mAnimatedImageLoading; + uint32_t mFrameCount; + int mFrameIndex; + std::vector mImageUrls; + uint16_t mCacheSize; + CircularQueue mQueue; }; } // namespace Internal + } // namespace Toolkit + } // namespace Dali -#endif +#endif //DALI_TOOLKIT_INTERNAL_ROLLING_ANIMATED_IMAGE_CACHE_H diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp index 21f81b7..2284778 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp @@ -131,26 +131,9 @@ TextureSet RollingImageCache::FirstFrame() return Frame( 0u ); } -TextureSet RollingImageCache::NextFrame() +uint32_t RollingImageCache::GetFrameInterval( uint32_t frameIndex ) { - TextureSet textureSet; - - ImageFrame imageFrame = mQueue.PopFront(); - mTextureManager.Remove( mImageUrls[ imageFrame.mUrlIndex ].mTextureId, this ); - mImageUrls[ imageFrame.mUrlIndex ].mTextureId = TextureManager::INVALID_TEXTURE_ID; - - LoadBatch(); - - if( IsFrontReady() == true ) - { - textureSet = GetFrontTextureSet(); - } - else - { - mWaitingForReadyFrame = true; - } - - return textureSet; + return 0u; } bool RollingImageCache::IsFrontReady() const diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.h b/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.h index 47a5155..f57b5c2 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.h +++ b/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.h @@ -72,11 +72,9 @@ public: TextureSet FirstFrame() override; /** - * Get the next frame. If it's not ready, this will trigger the - * sending of FrameReady() when the image becomes ready. - * This will trigger the loading of the next batch. + * Get the interval of Nth frame. */ - TextureSet NextFrame() override; + uint32_t GetFrameInterval( uint32_t frameIndex ) override; private: /** diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index dc35220..d753ddb 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -165,6 +165,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property break; } case VisualUrl::GIF: + case VisualUrl::WEBP: { visualPtr = AnimatedImageVisual::New( GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl, propertyMap ); break; @@ -361,6 +362,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image break; } case VisualUrl::GIF: + case VisualUrl::WEBP: { visualPtr = AnimatedImageVisual::New( GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl ); break; diff --git a/dali-toolkit/internal/visuals/visual-url.cpp b/dali-toolkit/internal/visuals/visual-url.cpp index 731ed20..451ac06 100644 --- a/dali-toolkit/internal/visuals/visual-url.cpp +++ b/dali-toolkit/internal/visuals/visual-url.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 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. @@ -99,9 +99,11 @@ VisualUrl::Type ResolveType( const std::string& url ) enum { SUFFIX, HASH, HASH_DOT } state = SUFFIX; char SVG[ 4 ] = { 'g', 'v', 's', '.' }; char GIF[ 4 ] = { 'f', 'i', 'g', '.' }; + char WEBP[ 5 ] = { 'p', 'b', 'e', 'w', '.' }; char JSON[ 5 ] = { 'n', 'o', 's', 'j', '.' }; unsigned int svgScore = 0; unsigned int gifScore = 0; + unsigned int webpScore = 0; unsigned int jsonScore = 0; int index = count; while( --index >= 0 ) @@ -124,6 +126,14 @@ VisualUrl::Type ResolveType( const std::string& url ) return VisualUrl::GIF; } } + if( ( offsetFromEnd < sizeof(WEBP) )&&( currentChar == WEBP[ offsetFromEnd ] ) ) + { + // early out if WEBP as can't be used in N patch for now + if( ++webpScore == sizeof(WEBP) ) + { + return VisualUrl::WEBP; + } + } if( ( offsetFromEnd < sizeof(JSON) )&&( currentChar == JSON[ offsetFromEnd ] ) ) { // early out if JSON as can't be used in N patch for now diff --git a/dali-toolkit/internal/visuals/visual-url.h b/dali-toolkit/internal/visuals/visual-url.h index f3af2e0..63ad5e4 100644 --- a/dali-toolkit/internal/visuals/visual-url.h +++ b/dali-toolkit/internal/visuals/visual-url.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_VISUAL_URL_H /* - * Copyright (c) 2017 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. @@ -41,6 +41,7 @@ public: N_PATCH, SVG, GIF, + WEBP, JSON }; -- 2.7.4 From 0b2c26595d9bddb2c7ec9f9f7931920c9185501e Mon Sep 17 00:00:00 2001 From: Sunghyun kim Date: Mon, 13 Jan 2020 16:05:19 +0900 Subject: [PATCH 11/16] Change not to use the mask if it is set to an empty path If an application sets an empty path to the alpha mask, unload the alpha mask. Change-Id: Id70bf53f5fc631c9d82a59472f4d05d5d276f6b9 --- .../utc-Dali-TextureManager.cpp | 68 ++++++++++++++++++++++ .../internal/visuals/texture-manager-impl.cpp | 4 +- 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp index f2b032d..a6b7460 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp @@ -25,6 +25,7 @@ #include #include #include +#include using namespace Dali::Toolkit::Internal; @@ -204,3 +205,70 @@ int UtcTextureManagerCachingForDifferentLoadingType(void) END_TEST; } + +int UtcTextureManagerUseInvalidMask(void) +{ + ToolkitTestApplication application; + tet_infoline( "UtcTextureManagerUseInvalidMask" ); + + TextureManager textureManager; // Create new texture manager + + TestObserver observer; + std::string filename( TEST_IMAGE_FILE_NAME ); + std::string maskname(""); + TextureManager::MaskingDataPointer maskInfo = nullptr; + maskInfo.reset(new TextureManager::MaskingData()); + maskInfo->mAlphaMaskUrl = maskname; + maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID; + maskInfo->mCropToMask = true; + maskInfo->mContentScaleFactor = 1.0f; + + auto textureId( TextureManager::INVALID_TEXTURE_ID ); + Vector4 atlasRect( 0.f, 0.f, 1.f, 1.f ); + Dali::ImageDimensions atlasRectSize( 0,0 ); + bool synchronousLoading(false); + bool atlasingStatus(false); + bool loadingStatus(false); + auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; + ImageAtlasManagerPtr atlasManager = nullptr; + Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr; + + textureManager.LoadTexture( + filename, + ImageDimensions(), + FittingMode::SCALE_TO_FILL, + SamplingMode::BOX_THEN_LINEAR, + maskInfo, + synchronousLoading, + textureId, + atlasRect, + atlasRectSize, + atlasingStatus, + loadingStatus, + WrapMode::DEFAULT, + WrapMode::DEFAULT, + &observer, + atlasUploadObserver, + atlasManager, + true, + TextureManager::ReloadPolicy::CACHED, + preMultiply + ); + + DALI_TEST_EQUALS( observer.mLoaded, false, TEST_LOCATION ); + DALI_TEST_EQUALS( observer.mObserverCalled, false, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( observer.mLoaded, true, TEST_LOCATION ); + DALI_TEST_EQUALS( observer.mObserverCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( observer.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION ); + + END_TEST; +} diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.cpp b/dali-toolkit/internal/visuals/texture-manager-impl.cpp index 8912c17..f4fa5fb 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.cpp +++ b/dali-toolkit/internal/visuals/texture-manager-impl.cpp @@ -208,7 +208,7 @@ TextureSet TextureManager::LoadTexture( { Devel::PixelBuffer pixelBuffer = LoadImageFromFile( url.GetUrl(), desiredSize, fittingMode, samplingMode, orientationCorrection ); - if( maskInfo ) + if( maskInfo && maskInfo->mAlphaMaskUrl.IsValid() ) { Devel::PixelBuffer maskPixelBuffer = LoadImageFromFile( maskInfo->mAlphaMaskUrl.GetUrl(), ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::NO_FILTER, true ); @@ -270,7 +270,7 @@ TextureSet TextureManager::LoadTexture( if( !textureSet ) // big image, no atlasing or atlasing failed { atlasingStatus = false; - if( !maskInfo ) + if( !maskInfo || !maskInfo->mAlphaMaskUrl.IsValid() ) { textureId = RequestLoad( url, desiredSize, fittingMode, samplingMode, TextureManager::NO_ATLAS, textureObserver, orientationCorrection, reloadPolicy, preMultiplyOnLoad ); -- 2.7.4 From 22145128af65439a70266fd55533efaf9db78579 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Mon, 6 Jul 2020 17:55:33 +0900 Subject: [PATCH 12/16] DALi Version 1.5.18 Change-Id: I20a7a54967ece305e8db8faa5c332bf4cccf5faa Signed-off-by: Seungho, Baek --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 1553ce2..1fc75cb 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 17; +const unsigned int TOOLKIT_MICRO_VERSION = 18; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 71dced0..ee0f96b 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -Version: 1.5.17 +Version: 1.5.18 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From 946af1f4d8c0e6d04868ae73fef6299943ac960e Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Fri, 26 Jun 2020 15:44:13 +0100 Subject: [PATCH 13/16] Fixes for the CMake build on MS-Windows. Change-Id: I4812a6292521f777c3e020130c84da794b8f007e Signed-off-by: Victor Cebollada --- build/tizen/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index fde4eb2..0423307 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -283,6 +283,8 @@ IF( WIN32 ) FIND_PACKAGE( unofficial-angle REQUIRED ) FIND_PACKAGE( unofficial-cairo REQUIRED ) + FIND_PACKAGE( WebP REQUIRED ) + SET( DALIADAPTOR_LDFLAGS "${DALIADAPTOR_LDFLAGS}" dali-adaptor::dali-adaptor ) -- 2.7.4 From 651ecbbdae3201c84119a5efd4e6c54d382abe3f Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Tue, 30 Jun 2020 16:48:44 +0100 Subject: [PATCH 14/16] Fixed SVACE error in TextVisual Change-Id: Icf15764d48b0b879577451172bced309bfffada4 --- dali-toolkit/internal/visuals/text/text-visual.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) mode change 100755 => 100644 dali-toolkit/internal/visuals/text/text-visual.cpp diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp old mode 100755 new mode 100644 index a3057c3..04f3618 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 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. @@ -820,8 +820,11 @@ void TextVisual::AddRenderer( Actor& actor, const Vector2& size, bool hasMultipl // Get the current offset for recalculate the offset when tiling. Property::Map retMap; mImpl->mTransform.GetPropertyMap( retMap ); - Vector2 offSet = retMap.Find( Dali::Toolkit::Visual::Transform::Property::OFFSET )->Get< Vector2 >(); - info.offSet = offSet; + Property::Value* offsetValue = retMap.Find( Dali::Toolkit::Visual::Transform::Property::OFFSET ); + if( offsetValue ) + { + offsetValue->Get( info.offSet ); + } // Create a textureset in the default renderer. CreateTextureSet( info, mImpl->mRenderer, sampler, hasMultipleTextColors, containsColorGlyph, styleEnabled ); -- 2.7.4 From cad91bf56a353ee70a33952d3968597a012a19b6 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Thu, 9 Jul 2020 13:19:03 +0900 Subject: [PATCH 15/16] DALi Version 1.5.19 Change-Id: I9d341fff0e8e67a550e6d459df55021ba0411716 Signed-off-by: Seungho, Baek --- dali-toolkit/public-api/dali-toolkit-version.cpp | 2 +- packaging/dali-toolkit.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 1fc75cb..57cd508 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 5; -const unsigned int TOOLKIT_MICRO_VERSION = 18; +const unsigned int TOOLKIT_MICRO_VERSION = 19; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index ee0f96b..ba76dd8 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -Version: 1.5.18 +Version: 1.5.19 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT -- 2.7.4 From 2c7f0246a7bbfeb207fcd84a68c41dbeff0a24f0 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 6 Jul 2020 15:41:28 +0900 Subject: [PATCH 16/16] (Vector) Ensure not to add duplicated task Change-Id: I3f023b6615ca36b40ddc3534fd8faab7985eb08e --- .../utc-Dali-AnimatedVectorImageVisual.cpp | 4 ++ .../vector-animation-task.cpp | 15 +----- .../animated-vector-image/vector-animation-task.h | 1 - .../vector-animation-thread.cpp | 60 +++++++++++++++++----- .../vector-animation-thread.h | 1 + 5 files changed, 53 insertions(+), 28 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index 7816a11..8e19dcb 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -270,6 +270,8 @@ int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + Property::Map resultMap; resultMap = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); @@ -679,6 +681,8 @@ int UtcDaliAnimatedVectorImageVisualPlayRange(void) application.SendNotification(); application.Render(); + std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); // wait for next rasterize thread run + map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL ); value = map.Find( DevelImageVisual::Property::PLAY_RANGE ); diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp index 55968e1..bae4fbc 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp @@ -70,7 +70,6 @@ VectorAnimationTask::VectorAnimationTask( VisualFactoryCache& factoryCache, cons mAnimationDataIndex( 0 ), mLoopCount( LOOP_FOREVER ), mCurrentLoop( 0 ), - mResourceReady( false ), mForward( true ), mUpdateFrameNumber( false ), mNeedAnimationFinishedTrigger( true ), @@ -138,8 +137,6 @@ void VectorAnimationTask::SetSize( uint32_t width, uint32_t height ) mWidth = width; mHeight = height; - mResourceReady = false; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetSize: width = %d, height = %d [%p]\n", width, height, this ); } } @@ -148,6 +145,7 @@ void VectorAnimationTask::PlayAnimation() { if( mPlayState != PlayState::PLAYING ) { + mNeedAnimationFinishedTrigger = true; mUpdateFrameNumber = false; mPlayState = PlayState::PLAYING; @@ -266,12 +264,10 @@ void VectorAnimationTask::SetPlayRange( const Property::Array& playRange ) if( mStartFrame > mCurrentFrame ) { mCurrentFrame = mStartFrame; - mResourceReady = false; } else if( mEndFrame < mCurrentFrame ) { mCurrentFrame = mEndFrame; - mResourceReady = false; } DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%p]\n", mStartFrame, mEndFrame, this ); @@ -302,7 +298,6 @@ void VectorAnimationTask::SetCurrentFrameNumber( uint32_t frameNumber ) { mCurrentFrame = frameNumber; mUpdateFrameNumber = false; - mResourceReady = false; DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetCurrentFrameNumber: frame number = %d [%p]\n", mCurrentFrame, this ); } @@ -394,10 +389,7 @@ bool VectorAnimationTask::Rasterize() currentFrame = mCurrentFrame; - // Reset values - mResourceReady = true; mUpdateFrameNumber = true; - mNeedAnimationFinishedTrigger = true; if( mPlayState == PlayState::STOPPING ) { @@ -462,11 +454,6 @@ bool VectorAnimationTask::Rasterize() { DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Rasterize: Rendering failed. Try again later.[%d] [%p]\n", currentFrame, this ); mUpdateFrameNumber = false; - - if( !mResourceReady ) - { - mResourceReady = false; - } } } diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h index 79c3ee2..844d378 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h @@ -309,7 +309,6 @@ private: uint32_t mAnimationDataIndex; int32_t mLoopCount; int32_t mCurrentLoop; - bool mResourceReady; bool mForward; bool mUpdateFrameNumber; bool mNeedAnimationFinishedTrigger; diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp index 8403e6a..c80e00a 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp @@ -59,6 +59,7 @@ Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, VectorAnimationThread::VectorAnimationThread() : mAnimationTasks(), mCompletedTasks(), + mWorkingTasks(), mRasterizers( GetNumberOfThreads( NUMBER_OF_RASTERIZE_THREADS_ENV, DEFAULT_NUMBER_OF_RASTERIZE_THREADS ), [&]() { return RasterizeHelper( *this ); } ), mSleepThread( MakeCallback( this, &VectorAnimationThread::OnAwakeFromSleep ) ), mConditionalWait(), @@ -75,6 +76,7 @@ VectorAnimationThread::~VectorAnimationThread() { ConditionalWait::ScopedLock lock( mConditionalWait ); mDestroyThread = true; + mNeedToSleep = false; mConditionalWait.Notify( lock ); } @@ -108,6 +110,7 @@ void VectorAnimationThread::AddTask( VectorAnimationTaskPtr task ) mAnimationTasks.push_back( task ); } + mNeedToSleep = false; // wake up the animation thread mConditionalWait.Notify( lock ); } @@ -115,14 +118,35 @@ void VectorAnimationThread::AddTask( VectorAnimationTaskPtr task ) void VectorAnimationThread::OnTaskCompleted( VectorAnimationTaskPtr task, bool keepAnimation ) { - if( keepAnimation && !mDestroyThread ) + if( !mDestroyThread ) { ConditionalWait::ScopedLock lock( mConditionalWait ); + bool needRasterize = false; + + auto workingTask = std::find( mWorkingTasks.begin(), mWorkingTasks.end(), task ); + if( workingTask != mWorkingTasks.end() ) + { + mWorkingTasks.erase( workingTask ); + } - if( mCompletedTasks.end() == std::find( mCompletedTasks.begin(), mCompletedTasks.end(), task ) ) + // Check pending task + if( mAnimationTasks.end() != std::find( mAnimationTasks.begin(), mAnimationTasks.end(), task ) ) { - mCompletedTasks.push_back( task ); + needRasterize = true; + } + + if( keepAnimation ) + { + if( mCompletedTasks.end() == std::find( mCompletedTasks.begin(), mCompletedTasks.end(), task ) ) + { + mCompletedTasks.push_back( task ); + needRasterize = true; + } + } + if( needRasterize ) + { + mNeedToSleep = false; // wake up the animation thread mConditionalWait.Notify( lock ); } @@ -156,12 +180,12 @@ void VectorAnimationThread::Rasterize() ConditionalWait::ScopedLock lock( mConditionalWait ); // conditional wait - if( (mAnimationTasks.empty() && mCompletedTasks.empty() ) || mNeedToSleep ) + if( mNeedToSleep ) { mConditionalWait.Wait( lock ); } - mNeedToSleep = false; + mNeedToSleep = true; // Process completed tasks for( auto&& task : mCompletedTasks ) @@ -192,10 +216,9 @@ void VectorAnimationThread::Rasterize() mCompletedTasks.clear(); // pop out the next task from the queue - while( !mAnimationTasks.empty() && !mNeedToSleep ) + for( auto it = mAnimationTasks.begin(); it != mAnimationTasks.end(); ) { - std::vector< VectorAnimationTaskPtr >::iterator next = mAnimationTasks.begin(); - VectorAnimationTaskPtr nextTask = *next; + VectorAnimationTaskPtr nextTask = *it; auto currentTime = std::chrono::system_clock::now(); auto nextFrameTime = nextTask->GetNextFrameTime(); @@ -208,17 +231,28 @@ void VectorAnimationThread::Rasterize() if( nextFrameTime <= currentTime ) { - mAnimationTasks.erase( next ); + // If the task is not in the working list + if( std::find( mWorkingTasks.begin(), mWorkingTasks.end(), nextTask ) == mWorkingTasks.end() ) + { + it = mAnimationTasks.erase( it ); + + // Add it to the working list + mWorkingTasks.push_back( nextTask ); - auto rasterizerHelperIt = mRasterizers.GetNext(); - DALI_ASSERT_ALWAYS( rasterizerHelperIt != mRasterizers.End() ); + auto rasterizerHelperIt = mRasterizers.GetNext(); + DALI_ASSERT_ALWAYS( rasterizerHelperIt != mRasterizers.End() ); - rasterizerHelperIt->Rasterize( nextTask ); + rasterizerHelperIt->Rasterize( nextTask ); + } + else + { + it++; + } } else { - mNeedToSleep = true; mSleepThread.SleepUntil( nextFrameTime ); + break; } } } diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h index 8d3dd64..964f662 100755 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h @@ -183,6 +183,7 @@ private: std::vector< VectorAnimationTaskPtr > mAnimationTasks; std::vector< VectorAnimationTaskPtr > mCompletedTasks; + std::vector< VectorAnimationTaskPtr > mWorkingTasks; RoundRobinContainerView< RasterizeHelper > mRasterizers; SleepThread mSleepThread; ConditionalWait mConditionalWait; -- 2.7.4