From: Cheng-Shiun Tsai Date: Fri, 16 Aug 2019 09:41:38 +0000 (+0100) Subject: [dali_1.4.33] Merge branch 'devel/master' X-Git-Tag: dali_1.9.8~5^2~33 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=d7cef550d3627f3a161913ab1805a7faf0a15f36;hp=c0d8c3caf853d94266c589b425cadc26333f716a [dali_1.4.33] Merge branch 'devel/master' Change-Id: If8e056eae4585c61e123c1cb6e93b25164004462 --- 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 20f4480..f27f4d7 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 @@ -84,6 +84,7 @@ bool LayoutTextTest( const LayoutTextData& data ) fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" ); fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" ); fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" ); + fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHindiRegular.ttf" ); // 1) Create the model. LogicalModelPtr logicalModel; @@ -5603,3 +5604,197 @@ int UtcDaliTextLayoutSetGetDefaultLineSpacing(void) tet_result(TET_PASS); END_TEST; } + +int UtcDaliTextLayoutGetGlyphMetrics(void) +{ + tet_infoline(" UtcDaliTextLayoutGetGlyphMetrics"); + + // Test retrieving metrics from group of characters + + const std::string fontFamily( "TizenSansHindi" ); + + // Set a known font description + FontDescriptionRun fontDescriptionRun01; + fontDescriptionRun01.characterRun.characterIndex = 0u; + fontDescriptionRun01.characterRun.numberOfCharacters = 2u; + fontDescriptionRun01.familyLength = fontFamily.size(); + fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength]; + memcpy( fontDescriptionRun01.familyName, fontFamily.c_str(), fontDescriptionRun01.familyLength ); + fontDescriptionRun01.familyDefined = true; + fontDescriptionRun01.weightDefined = false; + fontDescriptionRun01.widthDefined = false; + fontDescriptionRun01.slantDefined = false; + fontDescriptionRun01.sizeDefined = false; + + // Set a known font description + FontDescriptionRun fontDescriptionRun02; + fontDescriptionRun02.characterRun.characterIndex = 0u; + fontDescriptionRun02.characterRun.numberOfCharacters = 2u; + fontDescriptionRun02.familyLength = fontFamily.size(); + fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength]; + memcpy( fontDescriptionRun02.familyName, fontFamily.c_str(), fontDescriptionRun02.familyLength ); + fontDescriptionRun02.familyDefined = true; + fontDescriptionRun02.weightDefined = false; + fontDescriptionRun02.widthDefined = false; + fontDescriptionRun02.slantDefined = false; + fontDescriptionRun02.sizeDefined = false; + + // Set a known font description + FontDescriptionRun fontDescriptionRun03; + fontDescriptionRun03.characterRun.characterIndex = 0u; + fontDescriptionRun03.characterRun.numberOfCharacters = 2u; + fontDescriptionRun03.familyLength = fontFamily.size(); + fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength]; + memcpy( fontDescriptionRun03.familyName, fontFamily.c_str(), fontDescriptionRun03.familyLength ); + fontDescriptionRun03.familyDefined = true; + fontDescriptionRun03.weightDefined = false; + fontDescriptionRun03.widthDefined = false; + fontDescriptionRun03.slantDefined = false; + fontDescriptionRun03.sizeDefined = false; + + Vector fontDescriptionRuns01; + fontDescriptionRuns01.PushBack( fontDescriptionRun01 ); + + Vector fontDescriptionRuns02; + fontDescriptionRuns02.PushBack( fontDescriptionRun02 ); + + Vector fontDescriptionRuns03; + fontDescriptionRuns03.PushBack( fontDescriptionRun03 ); + + // Set a text area. + Size textArea(100.f, 100.f); + + + // Group: second glyph doesn't exceed the width of the first glyph + float positions01[] = { 0.f, -11.f }; + + struct LineRun line01 = + { + { 0u, 1u }, + { 0u, 1u }, + 11.f, + 15.f, + -4.f, + 0.f, + 0.f, + 0.f, + false, + false + }; + Vector lines01; + lines01.PushBack( line01 ); + + 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 }; + + struct LineRun line02 = + { + { 0u, 2u }, + { 0u, 2u }, + 15.f, + 15.f, + -4.f, + 0.f, + 0.f, + 0.f, + false, + false + }; + Vector lines02; + lines02.PushBack( line02 ); + + Size layoutSize02 = Vector2(15.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 }; + + struct LineRun line03 = + { + { 0u, 2u }, + { 0u, 2u }, + 11.f, + 15.f, + -4.f, + 0.f, + 0.f, + 0.f, + false, + false + }; + Vector lines03; + lines03.PushBack( line03 ); + + Size layoutSize03 = Vector2(11.f, 19.f); + + ///////////////////////////// + + struct LayoutTextData data[] = + { + { + "Single glyph", + "प", + textArea, + 1u, + fontDescriptionRuns01.Begin(), + layoutSize01, + 1u, + positions01, + 1u, + lines01.Begin(), + Layout::Engine::SINGLE_LINE_BOX, + 0u, + 1u, + false, + true + }, + { + "Group: second glyph exceeds the width of the first glyph", + "पो", + textArea, + 1u, + fontDescriptionRuns02.Begin(), + layoutSize02, + 2u, + positions02, + 1u, + lines02.Begin(), + Layout::Engine::SINGLE_LINE_BOX, + 0u, + 2u, + false, + true + }, + { + "Group: second glyph doesn't exceed the width of the first glyph", + "पे", + textArea, + 1u, + fontDescriptionRuns03.Begin(), + layoutSize03, + 2u, + positions03, + 1u, + lines03.Begin(), + Layout::Engine::SINGLE_LINE_BOX, + 0u, + 2u, + false, + true + } + }; + const unsigned int numberOfTests = sizeof(data)/sizeof(LayoutTextData); + + for( unsigned int index = 0u; index < numberOfTests; ++index ) + { + ToolkitTestApplication application; + if( !LayoutTextTest( data[index] ) ) + { + tet_result(TET_FAIL); + } + } + + tet_result(TET_PASS); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp index fbc24bf..8e856bb 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -36,7 +36,8 @@ public: : mUrl( url ), mRenderer(), mWidth( 0 ), - mHeight( 0 ) + mHeight( 0 ), + mPreviousFrame( 0 ) { } @@ -69,8 +70,16 @@ public: { } - void Render( uint32_t frameNumber ) + bool Render( uint32_t frameNumber ) { + if( frameNumber == 1 && mPreviousFrame != frameNumber ) + { + mPreviousFrame = frameNumber; + // For test corverage + return false; + } + mPreviousFrame = frameNumber; + return true; } uint32_t GetTotalFrameNumber() const @@ -95,6 +104,7 @@ public: Dali::Renderer mRenderer; uint32_t mWidth; uint32_t mHeight; + uint32_t mPreviousFrame; }; inline VectorAnimationRenderer& GetImplementation( Dali::VectorAnimationRenderer& renderer ) @@ -166,9 +176,9 @@ void VectorAnimationRenderer::StopRender() Internal::Adaptor::GetImplementation( *this ).StopRender(); } -void VectorAnimationRenderer::Render( uint32_t frameNumber ) +bool VectorAnimationRenderer::Render( uint32_t frameNumber ) { - Internal::Adaptor::GetImplementation( *this ).Render( frameNumber ); + return Internal::Adaptor::GetImplementation( *this ).Render( frameNumber ); } uint32_t VectorAnimationRenderer::GetTotalFrameNumber() const diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp index 2726434..2b15b2b 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp @@ -24,9 +24,15 @@ #include #include +#define DALI_WINDOW_H +#include +#include + // INTERNAL INCLUDES #include "test-render-surface.h" +using AdaptorImpl = Dali::Internal::Adaptor::Adaptor; + namespace Dali { @@ -92,13 +98,15 @@ Window& Window::operator=(const Window& rhs) Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent ) { - Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent ); - return Window( window ); + return New( windowPosition, name, "", isTransparent ); } Dali::Window Window::New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent ) { Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, className, isTransparent ); + Dali::Window newWindow = Window( window ); + Dali::Adaptor::WindowCreatedSignalType& windowCreatedSignal = AdaptorImpl::Get().WindowCreatedSignal(); + windowCreatedSignal.Emit( newWindow ); return Window( window ); } @@ -140,6 +148,11 @@ KeyEventSignalType& KeyEventSignal( Window window ) return GetImplementation( window ).mScene.KeyEventSignal(); } +KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window ) +{ + return GetImplementation( window ).mScene.KeyEventGeneratedSignal(); +} + TouchSignalType& TouchSignal( Window window ) { return GetImplementation( window ).mScene.TouchSignal(); @@ -149,7 +162,6 @@ WheelEventSignalType& WheelEventSignal( Window window ) { return GetImplementation( window ).mScene.WheelEventSignal(); } - } // namespace DevelWindow } // Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h index c830af5..f2fc19a 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h @@ -68,6 +68,7 @@ namespace DevelWindow { typedef Signal< void () > EventProcessingFinishedSignalType; typedef Signal< void (const KeyEvent&) > KeyEventSignalType; +typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType; typedef Signal< void (const TouchData&) > TouchSignalType; typedef Signal< void (const WheelEvent&) > WheelEventSignalType; @@ -75,9 +76,9 @@ Dali::Window Get( Actor actor ); EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window ); KeyEventSignalType& KeyEventSignal( Dali::Window window ); +KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window ); TouchSignalType& TouchSignal( Dali::Window window ); WheelEventSignalType& WheelEventSignal( Window window ); - } } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/utc-Dali-KeyInputFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-KeyInputFocusManager.cpp index 4d191a8..4686512 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-KeyInputFocusManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-KeyInputFocusManager.cpp @@ -139,6 +139,7 @@ int UtcDaliKeyInputFocusManagerGet(void) // Check that focus manager is a singleton DALI_TEST_CHECK(manager == newManager); + END_TEST; } @@ -430,3 +431,49 @@ int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged(void) DALI_TEST_CHECK( lostActor == Control() ); END_TEST; } + +int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChangedforNewWindow(void) +{ + ToolkitTestApplication application; + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + + tet_infoline(" UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged"); + + PushButton pushButton1 = PushButton::New(); + PushButton pushButton2 = PushButton::New(); + + Window window = Window::New(PositionSize(0,0,0,0) ,"", false); + DALI_TEST_CHECK( window ); + + window.Add( pushButton1 ); + window.Add( pushButton2 ); + + PushButton gainActor, lostActor; + KeyInputFocusChangedCallback callback( gainActor, lostActor ); + manager.KeyInputFocusChangedSignal().Connect( &callback, &KeyInputFocusChangedCallback::Callback ); + + manager.SetFocus(pushButton1); + + DALI_TEST_CHECK( gainActor == pushButton1 ); + DALI_TEST_CHECK( lostActor == Control() ); + + gainActor.Reset(); + lostActor.Reset(); + + manager.SetFocus(pushButton2); + + DALI_TEST_CHECK( gainActor == pushButton2 ); + DALI_TEST_CHECK( lostActor == pushButton1 ); + + gainActor.Reset(); + lostActor.Reset(); + + // Removing the focus actor from the window would also result in signal emission. + window.Remove( pushButton1 ); + window.Remove( pushButton2 ); + DALI_TEST_CHECK( gainActor == Control() ); + DALI_TEST_CHECK( lostActor == Control() ); + + window.Reset(); + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp index a073847..0f1d493 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp @@ -217,6 +217,34 @@ public: Actor mActivatedActor; }; +class KeyEventCallback : public Dali::ConnectionTracker +{ +public: + /** + * Constructor + * @param[in] returnValue Set return value of KeyEvent callback. + * */ + KeyEventCallback( bool consumed ) + : mConsumed( consumed ), + mIsCalled( false ) + { + } + + bool Callback( Control control, const KeyEvent& keyEvent ) + { + mIsCalled = true; + return mConsumed; + } + + void Callback( const KeyEvent& keyEvent ) + { + mIsCalled = true; + } + + bool mConsumed; + bool mIsCalled; +}; + // Used to connect to signals via the ConnectSignal Handle method struct CallbackFunctor { @@ -1517,5 +1545,38 @@ int UtcDaliKeyboardFocusManagerEnableFocusIndicator(void) END_TEST; } +int UtcDaliKeyboardFocusManagerCheckConsumedKeyEvent(void) +{ + ToolkitTestApplication application; + + tet_infoline( "Ensure Window can't receive KeyEvent when Control already consumed it" ); + Dali::Integration::Scene scene = application.GetScene(); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK( ! manager.GetCurrentFocusActor() ); + + // Create the first actor and add it to the stage + Control control = Control::New(); + control.SetKeyboardFocusable(true); + scene.Add(control); + + KeyEventCallback controlCallback( true ); + control.KeyEventSignal().Connect( &controlCallback, &KeyEventCallback::Callback ); + + KeyEventCallback sceneCallback( false ); + scene.KeyEventSignal().Connect( &sceneCallback, &KeyEventCallback::Callback ); + + manager.SetCurrentFocusActor( control ); + + // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager + // It makes mIsFocusIndicatorEnabled true and add focus indicator to focused actor. + Integration::KeyEvent event1( "Right", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + application.ProcessEvent(event1); + + DALI_TEST_CHECK( controlCallback.mIsCalled ); + DALI_TEST_CHECK( !sceneCallback.mIsCalled ); + + END_TEST; +} diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.h b/dali-toolkit/internal/controls/image-view/image-view-impl.h index 334754b..fe1bac1 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.h +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.h @@ -90,7 +90,7 @@ public: /** * @brief Query whether alpha is pre-multiplied. * - * @return True is alpha is pre-multiplied, false otherwise. + * @return True if alpha is pre-multiplied, false otherwise. */ bool IsPreMultipliedAlphaEnabled() const; diff --git a/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp index f188281..71bc352 100644 --- a/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include // INTERNAL INCLUDES #include @@ -50,13 +52,26 @@ KeyInputFocusManager::KeyInputFocusManager() : mSlotDelegate( this ), mCurrentFocusControl() { - DevelStage::KeyEventGeneratedSignal( Stage::GetCurrent() ).Connect(mSlotDelegate, &KeyInputFocusManager::OnKeyEvent); + // Retrieve all the existing widnows + Dali::WindowContainer windows = Adaptor::Get().GetWindows(); + for ( auto iter = windows.begin(); iter != windows.end(); ++iter ) + { + DevelWindow::KeyEventGeneratedSignal( *iter ).Connect( mSlotDelegate, &KeyInputFocusManager::OnKeyEvent); + } + + // Get notified when any new window is created afterwards + Adaptor::Get().WindowCreatedSignal().Connect( mSlotDelegate, &KeyInputFocusManager::OnWindowCreated); } KeyInputFocusManager::~KeyInputFocusManager() { } +void KeyInputFocusManager::OnWindowCreated( Dali::Window& window ) +{ + DevelWindow::KeyEventGeneratedSignal( window ).Connect( mSlotDelegate, &KeyInputFocusManager::OnKeyEvent); +} + void KeyInputFocusManager::SetFocus( Toolkit::Control control ) { if( !control ) diff --git a/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h b/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h index f7886c2..0f066c5 100644 --- a/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h +++ b/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h @@ -30,6 +30,8 @@ namespace Dali { +class Window; + namespace Toolkit { @@ -90,6 +92,11 @@ protected: virtual ~KeyInputFocusManager(); private: + /** + * This will be called when a new window is created + * @param window The new window + */ + void OnWindowCreated( Dali::Window& window ); /** * Callback for the key event when no actor in the stage has gained the key input focus diff --git a/dali-toolkit/internal/text/glyph-metrics-helper.cpp b/dali-toolkit/internal/text/glyph-metrics-helper.cpp index ef9098c..b47889e 100755 --- a/dali-toolkit/internal/text/glyph-metrics-helper.cpp +++ b/dali-toolkit/internal/text/glyph-metrics-helper.cpp @@ -74,26 +74,33 @@ void GetGlyphsMetrics( GlyphIndex glyphIndex, glyphMetrics.fontId = firstGlyph.fontId; glyphMetrics.fontHeight = fontMetrics.height; - glyphMetrics.width = firstGlyph.width + ( ( firstGlyph.isItalicRequired && !isItalicFont ) ? static_cast( TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE * static_cast( firstGlyph.height ) ) : 0u ); + glyphMetrics.width = firstGlyph.width; glyphMetrics.advance = firstGlyph.advance; glyphMetrics.ascender = fontMetrics.ascender; glyphMetrics.xBearing = firstGlyph.xBearing; if( 1u < numberOfGlyphs ) { - const float widthInit = firstGlyph.xBearing; + float maxWidthEdge = firstGlyph.xBearing + firstGlyph.width; for( unsigned int i = 1u; i < numberOfGlyphs; ++i ) { const GlyphInfo& glyphInfo = *( glyphsBuffer + glyphIndex + i ); - glyphMetrics.width = glyphMetrics.advance + glyphInfo.xBearing + glyphInfo.width + ( ( firstGlyph.isItalicRequired && !isItalicFont ) ? static_cast( TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE * static_cast( firstGlyph.height ) ) : 0u ); - glyphMetrics.advance += glyphInfo.advance; + // update the initial xBearing if smaller. + glyphMetrics.xBearing = std::min( glyphMetrics.xBearing, glyphMetrics.advance + glyphInfo.xBearing ); + + // update the max width edge if bigger. + const float currentMaxGlyphWidthEdge = glyphMetrics.advance + glyphInfo.xBearing + glyphInfo.width; + maxWidthEdge = std::max( maxWidthEdge, currentMaxGlyphWidthEdge ); + glyphMetrics.advance += glyphInfo.advance; } - glyphMetrics.width -= widthInit; + glyphMetrics.width = maxWidthEdge - glyphMetrics.xBearing; } + + glyphMetrics.width += ( firstGlyph.isItalicRequired && !isItalicFont ) ? TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE * firstGlyph.height : 0.f; } } // namespace Text diff --git a/dali-toolkit/internal/text/glyph-metrics-helper.h b/dali-toolkit/internal/text/glyph-metrics-helper.h index 761ef86..6856d27 100644 --- a/dali-toolkit/internal/text/glyph-metrics-helper.h +++ b/dali-toolkit/internal/text/glyph-metrics-helper.h @@ -50,10 +50,10 @@ struct GlyphMetrics FontId fontId; ///< The font id of the glyphs. float fontHeight; ///< The font's height of those glyphs. - float width; ///< The sum of all the widths of all the glyphs. + float width; ///< The width of the group. float advance; ///< The sum of all the advances of all the glyphs. float ascender; ///< The font's ascender. - float xBearing; ///< The x bearing of the first glyph. + float xBearing; ///< The x bearing of the group. }; /** diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp index c70c37b..8939729 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -296,6 +296,8 @@ void AnimatedVectorImageVisual::DoSetOnStage( Actor& actor ) mPlacementActor = actor; mVectorRasterizeThread.SetRenderer( mImpl->mRenderer ); + + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOnStage [%p]\n", this ); } void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor ) @@ -316,6 +318,8 @@ void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor ) // Reset the visual size to zero so that when adding the actor back to stage the rasterization is forced mVisualSize = Vector2::ZERO; + + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOffStage [%p]\n", this ); } void AnimatedVectorImageVisual::OnSetTransform() @@ -324,7 +328,7 @@ void AnimatedVectorImageVisual::OnSetTransform() if( IsOnStage() ) { - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSetTransform: width = %f, height = %f\n", visualSize.width, visualSize.height ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSetTransform: width = %f, height = %f [%p]\n", visualSize.width, visualSize.height, this ); if( visualSize != mVisualSize ) { @@ -357,6 +361,8 @@ void AnimatedVectorImageVisual::OnSetTransform() { actor.AddRenderer( mImpl->mRenderer ); mPlacementActor.Reset(); + + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSetTransform: Renderer is added [%p]\n", this ); } ResourceReady( Toolkit::Visual::ResourceStatus::READY ); @@ -443,6 +449,8 @@ void AnimatedVectorImageVisual::OnResourceReady() mPlacementActor.Reset(); ResourceReady( Toolkit::Visual::ResourceStatus::READY ); + + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnResourceReady: Renderer is added [%p]\n", this ); } } diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp index 70a3302..fead5de 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp @@ -98,7 +98,7 @@ VectorRasterizeThread::~VectorRasterizeThread() mVectorRenderer.StopRender(); } - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::~VectorRasterizeThread: Join\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::~VectorRasterizeThread: Join [%p]\n", this ); Join(); } @@ -113,7 +113,7 @@ void VectorRasterizeThread::Run() Rasterize(); } - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Run: End of thread\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Run: End of thread [%p]\n", this ); } void VectorRasterizeThread::SetRenderer( Renderer renderer ) @@ -122,7 +122,7 @@ void VectorRasterizeThread::SetRenderer( Renderer renderer ) mVectorRenderer.SetRenderer( renderer ); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetRenderer\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetRenderer [%p]\n", this ); } void VectorRasterizeThread::SetSize( uint32_t width, uint32_t height ) @@ -137,7 +137,7 @@ void VectorRasterizeThread::SetSize( uint32_t width, uint32_t height ) mResourceReady = false; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetSize: width = %d, height = %d\n", width, height ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetSize: width = %d, height = %d [%p]\n", width, height, this ); } } @@ -152,7 +152,7 @@ void VectorRasterizeThread::PlayAnimation() mPlayState = PlayState::PLAYING; mConditionalWait.Notify( lock ); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PlayAnimation: Play\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PlayAnimation: Play [%p]\n", this ); } } @@ -165,7 +165,7 @@ void VectorRasterizeThread::StopAnimation() mPlayState = PlayState::STOPPING; mConditionalWait.Notify( lock ); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StopAnimation: Stop\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StopAnimation: Stop [%p]\n", this ); } } @@ -176,7 +176,7 @@ void VectorRasterizeThread::PauseAnimation() { mPlayState = PlayState::PAUSED; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PauseAnimation: Pause\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PauseAnimation: Pause [%p]\n", this ); } } @@ -189,7 +189,7 @@ void VectorRasterizeThread::RenderFrame() mNeedRender = true; mConditionalWait.Notify( lock ); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::RenderFrame: Render\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::RenderFrame: Render [%p]\n", this ); } } @@ -213,7 +213,7 @@ void VectorRasterizeThread::SetLoopCount( int32_t count ) mLoopCount = count; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopCount: [%d]\n", count ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopCount: [%d] [%p]\n", count, this ); } } @@ -253,7 +253,7 @@ void VectorRasterizeThread::SetPlayRange( uint32_t startFrame, uint32_t endFrame mResourceReady = false; } - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetPlayRangeInFrame: [%d, %d]\n", mStartFrame, mEndFrame ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetPlayRange: [%d, %d] [%p]\n", mStartFrame, mEndFrame, this ); } } } @@ -301,7 +301,7 @@ void VectorRasterizeThread::SetCurrentFrameNumber( uint32_t frameNumber ) mResourceReady = false; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentFrameNumber: frame number = %d\n", mCurrentFrame ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentFrameNumber: frame number = %d [%p]\n", mCurrentFrame, this ); } else { @@ -329,7 +329,7 @@ void VectorRasterizeThread::SetStopBehavior( DevelImageVisual::StopBehavior::Typ ConditionalWait::ScopedLock lock( mConditionalWait ); mStopBehavior = stopBehavior; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetStopBehavior: stop behavor = %d\n", mStopBehavior ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetStopBehavior: stop behavor = %d [%p]\n", mStopBehavior, this ); } void VectorRasterizeThread::SetLoopingMode( DevelImageVisual::LoopingMode::Type loopingMode ) @@ -337,7 +337,7 @@ void VectorRasterizeThread::SetLoopingMode( DevelImageVisual::LoopingMode::Type ConditionalWait::ScopedLock lock( mConditionalWait ); mLoopingMode = loopingMode; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopingMode: looping mode = %d\n", mLoopingMode ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopingMode: looping mode = %d [%p]\n", mLoopingMode, this ); } void VectorRasterizeThread::Initialize() @@ -356,7 +356,7 @@ void VectorRasterizeThread::Initialize() SetSize( width, height ); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Initialize: file = %s [%d frames, %f fps]\n", mUrl.c_str(), mTotalFrame, mFrameRate ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Initialize: file = %s [%d frames, %f fps] [%p]\n", mUrl.c_str(), mTotalFrame, mFrameRate, this ); } void VectorRasterizeThread::Rasterize() @@ -370,7 +370,7 @@ void VectorRasterizeThread::Rasterize() if( ( mPlayState == PlayState::PAUSED || mPlayState == PlayState::STOPPED ) && !mNeedRender && !mDestroyThread ) { - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Wait\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Wait [%p]\n", this ); mConditionalWait.Wait( lock ); } @@ -449,11 +449,15 @@ void VectorRasterizeThread::Rasterize() } // Rasterize - mVectorRenderer.Render( currentFrame ); + if( !mVectorRenderer.Render( currentFrame ) ) + { + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Rendering failed. Try again later.[%d] [%p]\n", currentFrame, this ); + mUpdateFrameNumber = false; + } if( !resourceReady ) { - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Resource ready trigger\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Resource ready trigger [%p]\n", this ); mResourceReadyTrigger->Trigger(); } @@ -467,7 +471,7 @@ void VectorRasterizeThread::Rasterize() // Animation is finished mAnimationFinishedTrigger->Trigger(); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished\n" ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished [%p]\n", this ); } auto timeToSleepUntil = currentFrameStartTime + std::chrono::nanoseconds( mFrameDurationNanoSeconds ); @@ -475,7 +479,7 @@ void VectorRasterizeThread::Rasterize() #if defined(DEBUG_ENABLED) auto sleepDuration = std::chrono::duration_cast< std::chrono::milliseconds >( timeToSleepUntil - std::chrono::system_clock::now() ); - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: [current = %d, sleep duration = %lld]\n", currentFrame, sleepDuration.count() ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: [current = %d, sleep duration = %lld] [%p]\n", currentFrame, sleepDuration.count(), this ); #endif std::this_thread::sleep_until( timeToSleepUntil ); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index f7c602d..52878cd 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 = 4; -const unsigned int TOOLKIT_MICRO_VERSION = 32; +const unsigned int TOOLKIT_MICRO_VERSION = 33; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 2ac6251..555ab2c 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.4.32 +Version: 1.4.33 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT