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
utc-Dali-ItemLayout.cpp
utc-Dali-ItemView.cpp
utc-Dali-KeyboardFocusManager.cpp
- utc-Dali-MaskEffect.cpp
+ utc-Dali-Magnifier.cpp
utc-Dali-NinePatchMaskEffect.cpp
utc-Dali-Popup.cpp
utc-Dali-PushButton.cpp
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<float>( "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<float>( "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<float>( "uDynamicScale", scaleValue ) );
+ DALI_TEST_EQUALS( scaleValue, 0.5f, TEST_LOCATION );
++
END_TEST;
}
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;
}
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<float>( "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<Vector4>( "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);
application.SendNotification();
application.Render();
- (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
- DALI_TEST_EQUALS(percentage, 1.f, TEST_LOCATION );
+ DALI_TEST_CHECK( gl.GetUniformValue<float>( "uPercentage[0]", percentageValue ) );
+ DALI_TEST_EQUALS( percentageValue, 0.f, TEST_LOCATION );
+
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uStartEndPosition[0]", startEndPosValue ) );
+ DALI_TEST_EQUALS( startEndPosValue, Vector4::ZERO, TEST_LOCATION );
++
END_TEST;
}
#include <iostream>
#include <stdlib.h>
#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/devel-api/actors/mesh-actor.h>
+ #include <dali/integration-api/events/tap-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/styling/style-manager.h>
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;
*/
void GenerateMeshData( ImageId id,
const Vector2& position,
- Toolkit::AtlasManager::Mesh2D& mesh );
- MeshData& mesh,
++ Toolkit::AtlasManager::Mesh2D& mesh,
+ bool addReference );
/**
* @copydoc Toolkit::AtlasManager::StitchMesh
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 );
*/
void GenerateMeshData( ImageId id,
const Vector2& position,
- Mesh2D& mesh );
- MeshData& mesh,
++ Mesh2D& mesh,
+ bool addReference = true );
/**
* @brief Append second mesh to the first mesh
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<Actor>::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();
}
}
Text::RendererPtr mRenderer;
Text::DecoratorPtr mDecorator;
Text::ClipperPtr mClipper; ///< For EXCEED_POLICY_CLIP
+ std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
- RenderableActor mRenderableActor;
+ Actor mRenderableActor;
int mRenderingBackend;
int mExceedPolicy;
}
}
-void TextLabel::RequestTextRelayout()
+ void TextLabel::AddDecoration( Actor& actor, bool needsClipping )
+ {
+ // TextLabel does not show decorations
+ }
+
+void TextLabel::OnStageConnection( unsigned int depth )
{
- RelayoutRequest();
+ mDepth = depth;
}
void TextLabel::TextChanged()
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();
#include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
// INTERNAL INCLUDES
- #include <dali-toolkit/public-api/controls/buttons/push-button.h>
+ #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
// 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");
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.SetName("image-icon-2014");
+ icon.SetSortModifier( DECORATION_DEPTH_INDEX - 1 );
+ pressedIcon.SetSortModifier( DECORATION_DEPTH_INDEX - 1 );
+
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 ) );
}
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()
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;
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 );
}
}
}
- 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
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();
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
} // namespace Dali
-- #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
++ #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
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
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);
AtlasManager::AtlasSlot slot;
std::vector< MeshRecord > meshContainer;
Vector< Extent > extents;
+ TextCacheEntry textCacheEntry;
+ mDepth = static_cast< int >( depth );
float currentUnderlinePosition = ZERO;
float currentUnderlineThickness = underlineHeight;
}
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 )
{
}
// 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 );
}
}
- mGlyphManager.GenerateMeshData( slot.mImageId, position, newMeshData );
+
+ // Generate mesh data for this quad, plugging in our supplied position
++ 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,
}
}
- 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()
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 );
}
}