From: Francisco Santos Date: Thu, 25 Jun 2015 14:23:06 +0000 (+0100) Subject: Merge branch 'devel/master' into devel/new_mesh X-Git-Tag: dali_1.0.47~13^2~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=refs%2Fchanges%2F13%2F42313%2F3 Merge branch 'devel/master' into devel/new_mesh Conflicts: automated-tests/src/dali-toolkit/CMakeLists.txt dali-toolkit/devel-api/shader-effects/distance-field-effect.cpp dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp dali-toolkit/internal/atlas-manager/atlas-manager-impl.h dali-toolkit/internal/atlas-manager/atlas-manager.cpp dali-toolkit/internal/atlas-manager/atlas-manager.h dali-toolkit/internal/controls/text-controls/text-label-impl.cpp dali-toolkit/internal/controls/text-controls/text-label-impl.h dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp dali-toolkit/internal/text/decorator/text-decorator.cpp dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.cpp dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp dali-toolkit/public-api/controls/control-impl.cpp Change-Id: I48b90c6c4696dbc7b65659ecf6004a09a17c7ab0 --- 31df2b9472ccbe0ae460a958535be8ef790c96f2 diff --cc automated-tests/src/dali-toolkit/CMakeLists.txt index 9217cd0,803d2ed..bdf225c --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@@ -11,8 -11,14 +11,9 @@@ SET(TC_SOURCE utc-Dali-BloomView.cpp utc-Dali-BubbleEmitter.cpp utc-Dali-Builder.cpp - utc-Dali-CarouselEffect.cpp utc-Dali-CheckBoxButton.cpp utc-Dali-CubeTransitionEffect.cpp - utc-Dali-DisplacementEffect.cpp - utc-Dali-DistanceFieldEffect.cpp + utc-Dali-EffectsView.cpp utc-Dali-GaussianBlurView.cpp utc-Dali-JsonParser.cpp utc-Dali-KeyInputFocusManager.cpp @@@ -35,6 -48,9 +36,7 @@@ utc-Dali-ItemLayout.cpp utc-Dali-ItemView.cpp utc-Dali-KeyboardFocusManager.cpp + utc-Dali-Magnifier.cpp - utc-Dali-MaskEffect.cpp utc-Dali-NinePatchMaskEffect.cpp utc-Dali-Popup.cpp utc-Dali-PushButton.cpp diff --cc automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp index ca864c2,e25d8d5..2140f2a --- a/automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-BubbleEmitter.cpp @@@ -213,28 -202,30 +213,33 @@@ int UtcDaliBubbleEmitterSetBubbleScale( ToolkitTestApplication application; tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " ); - Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); - BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); - + Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f )); ++ DALI_TEST_CHECK(emitter); Actor root = emitter.GetRootActor(); - MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); - ShaderEffect effect = bubbleMesh.GetShaderEffect(); - DALI_TEST_CHECK( effect ); + Stage::GetCurrent().Add( root ); ++ root.SetPosition( Vector3::ZERO ); ++ root.SetParentOrigin( ParentOrigin::CENTER ); ++ root.SetAnchorPoint( AnchorPoint::CENTER ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + + Wait(application); - Property::Index scalePropertyIndex = effect.GetPropertyIndex( "uDynamicScale" ); float scaleValue; - (effect.GetProperty(scalePropertyIndex)).Get( scaleValue ); - DALI_TEST_EQUALS(scaleValue, 1.f, TEST_LOCATION ); + DALI_TEST_CHECK( gl.GetUniformValue( "uDynamicScale", scaleValue ) ); + DALI_TEST_EQUALS( scaleValue, 1.f, TEST_LOCATION ); emitter.SetBubbleScale( 2.f ); - application.SendNotification(); - application.Render(); - (effect.GetProperty(scalePropertyIndex)).Get( scaleValue ); - DALI_TEST_EQUALS(scaleValue, 2.f, TEST_LOCATION ); + Wait(application); + DALI_TEST_CHECK( gl.GetUniformValue( "uDynamicScale", scaleValue ) ); + DALI_TEST_EQUALS( scaleValue, 2.f, TEST_LOCATION ); emitter.SetBubbleScale( 0.5f ); - application.SendNotification(); - application.Render(); - (effect.GetProperty(scalePropertyIndex)).Get( scaleValue ); - DALI_TEST_EQUALS(scaleValue, 0.5f, TEST_LOCATION ); + Wait(application); + DALI_TEST_CHECK( gl.GetUniformValue( "uDynamicScale", scaleValue ) ); + DALI_TEST_EQUALS( scaleValue, 0.5f, TEST_LOCATION ); ++ END_TEST; } @@@ -284,32 -275,27 +289,36 @@@ int UtcDaliBubbleEmitterSetBlendMode(vo ToolkitTestApplication application; tet_infoline( " UtcDaliBubbleEmitterSetBlendMode " ); - Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); - BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); - + Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 150, Vector2( 5.f, 10.f )); ++ DALI_TEST_CHECK(emitter); Actor root = emitter.GetRootActor(); - MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); - - BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha; + Stage::GetCurrent().Add( root ); ++ root.SetPosition( Vector3::ZERO ); ++ root.SetParentOrigin( ParentOrigin::CENTER ); ++ root.SetAnchorPoint( AnchorPoint::CENTER ); + + TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); + Wait(application); + DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION ); emitter.SetBlendMode( true ); - bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA ); - DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE ); - DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ZERO ); - DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE ); + Wait(application); + DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ZERO, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION ); emitter.SetBlendMode( false ); - bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA ); - DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA ); - DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE ); - DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA ); + Wait(application); + DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION ); + DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION ); + END_TEST; } @@@ -356,36 -340,58 +365,39 @@@ int UtcDaliBubbleEmitterEmitBubble(void END_TEST; } -int UtcDaliBubbleEmitterStartExplosion(void) +int UtcDaliBubbleEmitterRestore(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliBubbleEmitterStartExplosion " ); + tet_infoline( " UtcDaliBubbleEmitterRestore " ); - Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); - BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); + Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); + BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 90, Vector2( 5.f, 10.f )); Actor root = emitter.GetRootActor(); - MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); - ShaderEffect effect = bubbleMesh.GetShaderEffect(); - DALI_TEST_CHECK( effect ); - - Property::Index propertyIndex = effect.GetPropertyIndex( "uMagnification" ); - float value; - (effect.GetProperty(propertyIndex)).Get( value ); - DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION ); - - emitter.StartExplosion( 0.4, 4.f ); + Stage::GetCurrent().Add( root ); ++ root.SetPosition( Vector3::ZERO ); ++ root.SetParentOrigin( ParentOrigin::CENTER ); ++ root.SetAnchorPoint( AnchorPoint::CENTER ); - Wait(application, 200); // 0.2s - (effect.GetProperty(propertyIndex)).Get( value ); - DALI_TEST_CHECK( value >= 2.f ); + Actor bubbleMesh = root.GetChildAt( 0 ); + Renderer renderer = bubbleMesh.GetRendererAt( 0 ); + DALI_TEST_CHECK( renderer ); - Wait(application, 100); // 0.3s - (effect.GetProperty(propertyIndex)).Get( value ); - DALI_TEST_CHECK( value >= 3.f ); + TestGlAbstraction& gl = application.GetGlAbstraction(); - Wait(application, 100); // 0.4s - (effect.GetProperty(propertyIndex)).Get( value ); - DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION ); - END_TEST; -} + float percentageValue; + Vector4 startEndPosValue; -int UtcDaliBubbleEmitterRestore(void) -{ - ToolkitTestApplication application; - tet_infoline( " UtcDaliBubbleEmitterRestore " ); + Animation animation = Animation::New( 0.5f ); + emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) ); - Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); - BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f )); - Actor root = emitter.GetRootActor(); - MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) ); - ShaderEffect effect = bubbleMesh.GetShaderEffect(); - DALI_TEST_CHECK( effect ); + Wait(application); - Property::Index percentagePropertyIndex = effect.GetPropertyIndex( "uPercentage[0]" ); - float percentage; + DALI_TEST_CHECK( gl.GetUniformValue( "uPercentage[0]", percentageValue ) ); + DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION ); - Animation animation = Animation::New( 0.5f ); - emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) ); - (effect.GetProperty(percentagePropertyIndex)).Get( percentage ); - DALI_TEST_EQUALS(percentage, 0.f, TEST_LOCATION ); + DALI_TEST_CHECK( gl.GetUniformValue( "uStartEndPosition[0]", startEndPosValue ) ); + DALI_TEST_EQUALS( startEndPosValue.x, 40.f, TEST_LOCATION ); + DALI_TEST_EQUALS( startEndPosValue.y, 40.f, TEST_LOCATION ); animation.Play(); Wait(application, 200); @@@ -402,10 -404,7 +414,11 @@@ application.SendNotification(); application.Render(); - (effect.GetProperty(percentagePropertyIndex)).Get( percentage ); - DALI_TEST_EQUALS(percentage, 1.f, TEST_LOCATION ); + DALI_TEST_CHECK( gl.GetUniformValue( "uPercentage[0]", percentageValue ) ); + DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION ); + + DALI_TEST_CHECK( gl.GetUniformValue( "uStartEndPosition[0]", startEndPosValue ) ); + DALI_TEST_EQUALS( startEndPosValue, Vector4::ZERO, TEST_LOCATION ); ++ END_TEST; } diff --cc automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index d19b3a1,2d8a983..2838251 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@@ -18,6 -18,8 +18,7 @@@ #include #include #include + #include -#include #include #include #include diff --cc dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp index 15baf37,266e8b9..a5f0462 --- a/dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp +++ b/dali-toolkit/internal/atlas-manager/atlas-manager-impl.cpp @@@ -690,7 -651,8 +690,8 @@@ void AtlasManager::UploadImage( const B void AtlasManager::GenerateMeshData( ImageId id, const Vector2& position, - Toolkit::AtlasManager::Mesh2D& meshData ) - MeshData& meshData, ++ Toolkit::AtlasManager::Mesh2D& meshData, + bool addReference ) { // Read the atlas Id to use for this image SizeType imageId = id - 1u; diff --cc dali-toolkit/internal/atlas-manager/atlas-manager-impl.h index 5336e1b,7c8470d..88f3302 --- a/dali-toolkit/internal/atlas-manager/atlas-manager-impl.h +++ b/dali-toolkit/internal/atlas-manager/atlas-manager-impl.h @@@ -112,7 -111,8 +112,8 @@@ public */ void GenerateMeshData( ImageId id, const Vector2& position, - Toolkit::AtlasManager::Mesh2D& mesh ); - MeshData& mesh, ++ Toolkit::AtlasManager::Mesh2D& mesh, + bool addReference ); /** * @copydoc Toolkit::AtlasManager::StitchMesh diff --cc dali-toolkit/internal/atlas-manager/atlas-manager.cpp index 977c8dc,6773416..e6b041c --- a/dali-toolkit/internal/atlas-manager/atlas-manager.cpp +++ b/dali-toolkit/internal/atlas-manager/atlas-manager.cpp @@@ -69,15 -69,17 +69,17 @@@ bool AtlasManager::Remove( ImageId id void AtlasManager::GenerateMeshData( ImageId id, const Vector2& position, - Mesh2D& mesh ) - MeshData& meshData, ++ Mesh2D& mesh, + bool addReference ) { GetImplementation(*this).GenerateMeshData( id, position, - mesh ); - meshData, ++ mesh, + addReference ); } -void AtlasManager::StitchMesh( MeshData& first, - const MeshData& second, +void AtlasManager::StitchMesh( Mesh2D& first, + const Mesh2D& second, bool optimize ) { GetImplementation(*this).StitchMesh( first, second, optimize ); diff --cc dali-toolkit/internal/atlas-manager/atlas-manager.h index f0ecc22,2330647..79eb9b7 --- a/dali-toolkit/internal/atlas-manager/atlas-manager.h +++ b/dali-toolkit/internal/atlas-manager/atlas-manager.h @@@ -289,7 -278,8 +290,8 @@@ public */ void GenerateMeshData( ImageId id, const Vector2& position, - Mesh2D& mesh ); - MeshData& mesh, ++ Mesh2D& mesh, + bool addReference = true ); /** * @brief Append second mesh to the first mesh diff --cc dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index c687f9e,126518d..ce6e9f0 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@@ -917,40 -931,54 +932,58 @@@ void TextField::OnRelayout( const Vecto mRenderer = Backend::Get().NewRenderer( mRenderingBackend ); } - RenderableActor renderableActor; - if( mRenderer ) - { - renderableActor = mRenderer->Render( mController->GetView() ); - } - + RenderText(); EnableClipping( (Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy), size ); + } +} - if( renderableActor != mRenderableActor ) - { - UnparentAndReset( mRenderableActor ); - mRenderableActor = renderableActor; - } +void TextField::RenderText() +{ + Actor renderableActor; + if( mRenderer ) + { + renderableActor = mRenderer->Render( mController->GetView(), mDepth ); + } - if( mRenderableActor ) - { - const Vector2 offset = mController->GetScrollPosition() + mController->GetAlignmentOffset(); + if( renderableActor != mRenderableActor ) + { + UnparentAndReset( mRenderableActor ); + mRenderableActor = renderableActor; + } - mRenderableActor.SetPosition( offset.x, offset.y ); + if( mRenderableActor ) + { + const Vector2 offset = mController->GetScrollPosition() + mController->GetAlignmentOffset(); - // Make sure the actor is parented correctly with/without clipping - if( mClipper ) - { - mClipper->GetRootActor().Add( mRenderableActor ); - } - else - { - Self().Add( mRenderableActor ); - } + mRenderableActor.SetPosition( offset.x, offset.y ); + + // Make sure the actor is parented correctly with/without clipping + if( mClipper ) + { + mClipper->GetRootActor().Add( mRenderableActor ); + } + else + { + Self().Add( mRenderableActor ); } + + for( std::vector::const_iterator it = mClippingDecorationActors.begin(), + endIt = mClippingDecorationActors.end(); + it != endIt; + ++it ) + { + Actor actor = *it; + + if( mClipper ) + { + mClipper->GetRootActor().Add( actor ); + } + else + { + Self().Add( actor ); + } + } + mClippingDecorationActors.clear(); } } diff --cc dali-toolkit/internal/controls/text-controls/text-field-impl.h index 6fdab15,876972d..a305880 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.h @@@ -223,8 -215,9 +228,9 @@@ private: // Dat Text::RendererPtr mRenderer; Text::DecoratorPtr mDecorator; Text::ClipperPtr mClipper; ///< For EXCEED_POLICY_CLIP + std::vector mClippingDecorationActors; ///< Decoration actors which need clipping. - RenderableActor mRenderableActor; + Actor mRenderableActor; int mRenderingBackend; int mExceedPolicy; diff --cc dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index d4b5171,77da8f9..4bbadfb --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@@ -510,9 -503,14 +524,14 @@@ void TextLabel::OnStageConnect( Dali::A } } + void TextLabel::AddDecoration( Actor& actor, bool needsClipping ) + { + // TextLabel does not show decorations + } + -void TextLabel::RequestTextRelayout() +void TextLabel::OnStageConnection( unsigned int depth ) { - RelayoutRequest(); + mDepth = depth; } void TextLabel::TextChanged() diff --cc dali-toolkit/internal/controls/text-controls/text-label-impl.h index 37e531c,e45797a..0984475 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.h @@@ -93,11 -93,11 +93,16 @@@ private: // From Contro virtual float GetHeightForWidth( float width ); /** + * @copydoc Text::ControlInterface::AddDecoration() + */ + virtual void AddDecoration( Actor& actor, bool needsClipping ); + + /** + * @copydoc Control::OnStageConnection() + */ + virtual void OnStageConnection( unsigned int depth ); + + /** * @copydoc Text::ControlInterface::RequestTextRelayout() */ virtual void RequestTextRelayout(); diff --cc dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index e2ee154,91ef03b..e0d6435 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@@ -19,8 -19,7 +19,8 @@@ #include // INTERNAL INCLUDES - #include + #include +#include #include #include @@@ -421,17 -575,17 +576,15 @@@ Dali::Image TextSelectionPopup::GetButt // 1. Create the backgrounds for the popup option both normal and pressed. // Both containers will be added to a button. - Toolkit::TableView optionContainer = Toolkit::TableView::New( (showIcons)?2:1 , 1 ); - optionContainer.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - optionContainer.SetMinimumSize( Vector2( OPTION_MIN_WIDTH, 0 ) ); + Toolkit::TableView optionContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 ); - optionContainer.SetDrawMode( DrawMode::OVERLAY ); + optionContainer.SetFitHeight( 0 ); optionContainer.SetFitWidth( 0 ); - Toolkit::TableView optionPressedContainer = Toolkit::TableView::New( (showIcons)?2:1 , 1 ); - optionPressedContainer.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - optionPressedContainer.SetMinimumSize( Vector2( OPTION_MIN_WIDTH, 0 ) ); + Toolkit::TableView optionPressedContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 ); - optionPressedContainer.SetDrawMode( DrawMode::OVERLAY ); + optionPressedContainer.SetFitHeight( 0 ); optionPressedContainer.SetFitWidth( 0 ); + optionPressedContainer.SetBackgroundColor( mPressedColor ); + #ifdef DECORATOR_DEBUG optionContainer.SetName("optionContainer"); optionPressedContainer.SetName("optionPressedContainer"); @@@ -440,39 -594,47 +593,49 @@@ if ( showCaption ) { - Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New(); - captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption ); - optionContainer.SetFitHeight( 0 ); - - Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New(); - pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption ); - optionPressedContainer.SetFitHeight( 0 ); - - captionTextLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); - captionTextLabel.SetMaximumSize( Vector2( OPTION_MAX_WIDTH - 2.f * OPTION_MARGIN_WIDTH , FLT_MAX ) ); //todo FLT_MAX Size negotiation feature needed - - pressedCaptionTextLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); - pressedCaptionTextLabel.SetMaximumSize( Vector2( OPTION_MAX_WIDTH - 2.f * OPTION_MARGIN_WIDTH , FLT_MAX) ); //todo FLT_MAX Size negotiation feature needed - - optionContainer.AddChild( captionTextLabel, Toolkit::TableView::CellPosition( 1, 0 ) ); // todo Labels need ellipsis or similar - optionPressedContainer.AddChild( pressedCaptionTextLabel, Toolkit::TableView::CellPosition( 1, 0 ) ); // todo Labels need ellipsis or similar + Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New(); + captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption ); + captionTextLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + + Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New(); + pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption ); + pressedCaptionTextLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + + Padding padding; + padding.left = 24.0f; + padding.right = 24.0f; + padding.top = 14.0f; + padding.bottom = 14.0f; + captionTextLabel.SetPadding( padding ); + pressedCaptionTextLabel.SetPadding( padding ); + + optionContainer.AddChild( captionTextLabel, Toolkit::TableView::CellPosition(( showIcons&showCaption)?1:0, 0 ) ); + optionPressedContainer.AddChild( pressedCaptionTextLabel, Toolkit::TableView::CellPosition(( showIcons&showCaption)?1:0, 0 ) ); } + // 3. Create the icons if ( showIcons ) { - // 3. Create the icons ImageActor pressedIcon = ImageActor::New( iconImage ); ImageActor icon = ImageActor::New( iconImage ); + icon.SetSortModifier( DECORATION_DEPTH_INDEX - 1 ); + pressedIcon.SetSortModifier( DECORATION_DEPTH_INDEX - 1 ); - icon.SetName("image-icon-2014"); + icon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); pressedIcon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - pressedIcon.SetColor( mIconPressedColor ); - optionContainer.SetFitHeight( 0 ); - optionPressedContainer.SetFitHeight( 0 ); + icon.SetColor( mIconColor ); + + if ( showCaption & showIcons ) + { + optionContainer.SetFitHeight( 1 ); + optionContainer.SetFitWidth( 1 ); + optionPressedContainer.SetFitHeight( 1 ); + optionPressedContainer.SetFitWidth( 1 ); + } + optionContainer.AddChild( icon, Toolkit::TableView::CellPosition( 0, 0 ) ); optionPressedContainer.AddChild( pressedIcon, Toolkit::TableView::CellPosition( 0, 0 ) ); + icon.SetPadding( Padding( 10.0f, 10.0f, 10.0f, 10.0f ) ); pressedIcon.SetPadding( Padding( 10.0f, 10.0f, 10.0f, 10.0f ) ); } diff --cc dali-toolkit/internal/text/decorator/text-decorator.cpp index 8e7529a,31c62c5..e12ddca --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@@ -627,12 -673,12 +677,13 @@@ struct Decorator::Impl : public Connect mHighlightMeshActor.SetName( "HighlightMeshActor" ); #endif mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET ); - Actor parent = mTextControlParent.Self(); - parent.Add( mHighlightMeshActor ); + // Add the highlight box telling the controller it needs clipping. + mController.AddDecoration( mHighlightMeshActor, true ); } + + mHighlightMeshActor.SetPosition( mHighlightPosition.x, mHighlightPosition.y, DISPLAYED_HIGHLIGHT_Z_OFFSET ); + */ } void UpdateHighlight() @@@ -1018,10 -1179,13 +1187,13 @@@ Timer mScrollTimer; ///< Timer used to scroll the text when the grab handle is moved close to the edges. Layer mActiveLayer; ///< Layer for active handles and alike that ensures they are above all else. - ImageActor mPrimaryCursor; - ImageActor mSecondaryCursor; - MeshActor mHighlightMeshActor; ///< Mesh Actor to display highlight + //ImageActor mPrimaryCursor; + //ImageActor mSecondaryCursor; + //MeshActor mHighlightMeshActor; ///< Mesh Actor to display highlight - TextSelectionPopup mCopyPastePopup; + + PopupImpl mCopyPastePopup; + TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons + TextSelectionPopupCallbackInterface& mTextSelectionPopupCallbackInterface; Image mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT]; Image mCursorImage; diff --cc dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp index cb90d03,d7fde4e..fea111d --- a/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.cpp @@@ -109,24 -65,64 +122,46 @@@ void AtlasGlyphManager::Add( Text::Font const BufferImage& bitmap, Dali::Toolkit::AtlasManager::AtlasSlot& slot ) { - GlyphRecord record; - record.mFontId = glyph.fontId; - record.mIndex = glyph.index; - mAtlasManager.Add( bitmap, slot ); + + GlyphRecordEntry record; + record.mIndex = glyph.index; record.mImageId = slot.mImageId; - mGlyphRecords.PushBack( record ); + record.mCount = 1; + + // Have glyph records been created for this fontId ? + bool foundGlyph = false; + for ( std::vector< FontGlyphRecord >::iterator fontGlyphRecordIt = mFontGlyphRecords.begin(); + fontGlyphRecordIt != mFontGlyphRecords.end(); ++fontGlyphRecordIt ) + { + if ( fontGlyphRecordIt->mFontId == fontId ) + { + fontGlyphRecordIt->mGlyphRecords.PushBack( record ); + foundGlyph = true; + break; + } + } + + if ( !foundGlyph ) + { + // We need to add a new font entry + FontGlyphRecord fontGlyphRecord; + fontGlyphRecord.mFontId = fontId; + fontGlyphRecord.mGlyphRecords.PushBack( record ); + mFontGlyphRecords.push_back( fontGlyphRecord ); + } - -#ifdef DISPLAY_ATLAS - { - uint32_t atlasCount = mAtlasManager.GetAtlasCount(); - if ( atlasCount > mCount ) - { - for ( uint32_t i = 0; i < atlasCount; ++i ) - { - ImageActor actor = ImageActor::New( mAtlasManager.GetAtlasContainer( i + 1u ) ); - actor.SetParentOrigin( Vector3( 0.5f, 0.25f + ( static_cast< float >( i ) * 0.25f ), 0.5f ) ); - actor.SetAnchorPoint( AnchorPoint::CENTER ); - actor.SetSize( 256.0f, 256.0f ); - Stage::GetCurrent().Add( actor ); - } - } - mCount = atlasCount; - } -#endif } void AtlasGlyphManager::GenerateMeshData( uint32_t imageId, const Vector2& position, - MeshData& meshData ) + Toolkit::AtlasManager::Mesh2D& mesh ) { - mAtlasManager.GenerateMeshData( imageId, position, mesh ); + // Generate mesh data and tell Atlas Manager not to handle reference counting ( we'll do it ) - mAtlasManager.GenerateMeshData( imageId, position, meshData, false ); ++ mAtlasManager.GenerateMeshData( imageId, position, mesh, false ); } -void AtlasGlyphManager::StitchMesh( MeshData& first, - const MeshData& second ) +void AtlasGlyphManager::StitchMesh( Toolkit::AtlasManager::Mesh2D& first, + const Toolkit::AtlasManager::Mesh2D& second ) { mAtlasManager.StitchMesh( first, second ); } @@@ -178,28 -209,6 +248,16 @@@ void AtlasGlyphManager::AdjustReference } } - Pixel::Format AtlasGlyphManager::GetPixelFormat( uint32_t atlasId ) - { - return mAtlasManager.GetPixelFormat( atlasId ); - } - +Material AtlasGlyphManager::GetMaterial( uint32_t atlasId ) const +{ + return mAtlasManager.GetMaterial( atlasId ); +} + +Sampler AtlasGlyphManager::GetSampler( uint32_t atlasId ) const +{ + return mAtlasManager.GetSampler( atlasId ); +} + - const Toolkit::AtlasGlyphManager::Metrics& AtlasGlyphManager::GetMetrics() - { - mMetrics.mGlyphCount = mGlyphRecords.Size(); - mAtlasManager.GetMetrics( mMetrics.mAtlasMetrics ); - return mMetrics; - } - } // namespace Internal } // namespace Toolkit diff --cc dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h index 3b2b8af,5008106..9fe8ead --- a/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h +++ b/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h @@@ -103,27 -110,12 +110,27 @@@ public void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight ); /** - * @copydoc Toolkit::AtlasGlyphManager::Remove - * @copydoc toolkit::AtlasGlyphManager::GetPixelFormat ++ * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat */ - void Remove( uint32_t imageId ); + Pixel::Format GetPixelFormat( uint32_t atlasId ); /** - * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat - * @copydoc toolkit::AtlasGlyphManager::GetMetrics ++ * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount + */ - Pixel::Format GetPixelFormat( uint32_t atlasId ); ++ void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta ); + + /** + * @copydoc Toolkit::AtlasGlyphManager::GetMaterial + */ + Material GetMaterial( uint32_t atlasId ) const; + + /** + * @copydoc Toolkit::AtlasGlyphManager::GetMaterial + */ + Sampler GetSampler( uint32_t atlasId ) const; + + /** + * @copydoc Toolkit::AtlasGlyphManager::GetMetrics */ const Toolkit::AtlasGlyphManager::Metrics& GetMetrics(); @@@ -145,11 -126,10 +152,11 @@@ private: - Dali::Toolkit::AtlasManager mAtlasManager; + Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager - Vector< GlyphRecord > mGlyphRecords; ///> Cached glyph information + std::vector< FontGlyphRecord > mFontGlyphRecords; - uint32_t mCount; - Toolkit::AtlasGlyphManager::Metrics mMetrics; + Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status + Shader mEffectBufferShader; ///> Shader used to render drop shadow buffer textures + Shader mShadowShader; ///> Shader used to render drop shadow into buffer }; } // namespace Internal @@@ -177,4 -157,4 +184,4 @@@ inline Internal::AtlasGlyphManager& Get } // namespace Dali -- #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__ ++ #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__ diff --cc dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.cpp index 7292012,0438314..304a531 --- a/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.cpp @@@ -133,16 -119,11 +129,21 @@@ const Toolkit::AtlasGlyphManager::Metri return GetImplementation(*this).GetMetrics(); } + void AtlasGlyphManager::AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta ) + { + GetImplementation(*this).AdjustReferenceCount( fontId, imageId, delta ); + } + +Shader AtlasGlyphManager::GetEffectBufferShader() const +{ + return GetImplementation(*this).GetEffectBufferShader(); +} + +Shader AtlasGlyphManager::GetGlyphShadowShader() const +{ + return GetImplementation(*this).GetGlyphShadowShader(); +} + } // namespace Toolkit } // namespace Dali diff --cc dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h index 0f8468d,fdc4141..cda8fb6 --- a/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h +++ b/dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h @@@ -171,19 -150,14 +168,28 @@@ public const Metrics& GetMetrics(); /** + * @brief Adjust the reference count for an imageId and remove cache entry if it becomes free + * + * @param[in] fontId the font this image came from + * @param[in] imageId The imageId + * @param[in] delta adjustment to make to reference count + */ + void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta ); + ++ /** + * @brief Get Shader used for rendering glyph effect buffers + * + * @return Handle of shader needed + */ + Shader GetEffectBufferShader() const; + + /** + * @brief Get Shader used rendering Glyph Shadows + * + * @return Handle of shader needed + */ + Shader GetGlyphShadowShader() const; + private: explicit DALI_INTERNAL AtlasGlyphManager(Internal::AtlasGlyphManager *impl); diff --cc dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp index 1def1b1,5eca29d..457959f --- a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp @@@ -112,7 -125,7 +119,8 @@@ struct AtlasRenderer::Impl : public Con AtlasManager::AtlasSlot slot; std::vector< MeshRecord > meshContainer; Vector< Extent > extents; + TextCacheEntry textCacheEntry; + mDepth = static_cast< int >( depth ); float currentUnderlinePosition = ZERO; float currentUnderlineThickness = underlineHeight; @@@ -177,18 -190,10 +185,10 @@@ } const Vector2& position = positions[ i ]; - MeshData newMeshData; + AtlasManager::Mesh2D newMesh; - mGlyphManager.Cached( glyph.fontId, glyph.index, slot ); - if ( slot.mImageId ) - { - // This glyph already exists so generate mesh data plugging in our supplied position - mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh ); - mImageIds.PushBack( slot.mImageId ); - } - else + if ( !mGlyphManager.Cached( glyph.fontId, glyph.index, slot ) ) { - // Select correct size for new atlas if needed....? if ( lastFontId != glyph.fontId ) { @@@ -231,19 -236,20 +231,20 @@@ } // Locate a new slot for our glyph - mGlyphManager.Add( glyph, bitmap, slot ); - - // Generate mesh data for this quad, plugging in our supplied position - if ( slot.mImageId ) - { - mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh ); - mImageIds.PushBack( slot.mImageId ); - } + mGlyphManager.Add( glyph.fontId, glyph, bitmap, slot ); } } + + // Generate mesh data for this quad, plugging in our supplied position - mGlyphManager.GenerateMeshData( slot.mImageId, position, newMeshData ); ++ mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh ); + textCacheEntry.mFontId = glyph.fontId; + textCacheEntry.mImageId = slot.mImageId; + textCacheEntry.mIndex = glyph.index; + mTextCache.PushBack( textCacheEntry ); + // Find an existing mesh data object to attach to ( or create a new one, if we can't find one using the same atlas) StitchTextMesh( meshContainer, - newMeshData, + newMesh, extents, textColor, position.y + glyph.yBearing, @@@ -676,15 -713,15 +713,15 @@@ } } - RenderableActor mActor; ///< The actor parent which renders the text + Actor mActor; ///< The actor parent which renders the text AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching - Vector< uint32_t > mImageIds; ///< A list of imageIDs used by the renderer TextAbstraction::FontClient mFontClient; ///> The font client used to supply glyph information - ShaderEffect mBasicShader; ///> Shader used to render L8 glyphs - ShaderEffect mBgraShader; ///> Shader used to render BGRA glyphs - ShaderEffect mBasicShadowShader; ///> Shader used to render drop shadow into buffer std::vector< MaxBlockSize > mBlockSizes; ///> Maximum size needed to contain a glyph in a block within a new atlas - std::vector< MeshData::FaceIndex > mFace; ///> Face indices for a quad + std::vector< uint32_t > mFace; ///> Face indices for a quad + Vector< TextCacheEntry > mTextCache; + Property::Map mQuadVertexFormat; + Property::Map mQuadIndexFormat; + int mDepth; }; Text::RendererPtr AtlasRenderer::New() diff --cc dali-toolkit/public-api/controls/control-impl.cpp index 7bcaad4,ee5d0fd..88b588d --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@@ -494,14 -412,13 +489,12 @@@ public Property::Map map; Background* back = controlImpl.mImpl->mBackground; - if( back ) + if ( back && back->actor && back->actor.GetRendererAt(0).GetMaterial().GetNumberOfSamplers() > 0) { - ImageActor imageActor = ImageActor::DownCast( back->actor ); - if ( imageActor ) + Image image = back->actor.GetRendererAt(0).GetMaterial().GetSamplerAt(0).GetImage(); + if ( image ) { - Property::Map imageMap; - Scripting::CreatePropertyMap( image, imageMap ); - map[ "image" ] = imageMap; - Image image = imageActor.GetImage(); + Scripting::CreatePropertyMap( image, map ); } }