X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fdecorator%2Ftext-decorator.cpp;h=0cb8b4c5eaec03990b1619787ff92a8b43a0c688;hp=da49940c7f2ed86fb1e7aceef8a6d0b1b97e22d9;hb=41d36118a13932bcf1db39b780ac437fcda8aa08;hpb=c5651d9850075a3d2d96444883ee8e23844a5f3e diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index da49940..0cb8b4c 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -46,7 +46,7 @@ namespace { const char* VERTEX_SHADER = MAKE_SHADER( attribute mediump vec2 aPosition; -uniform mediump mat4 uMvpMatrix; +uniform highp mat4 uMvpMatrix; void main() { @@ -164,7 +164,8 @@ struct Decorator::Impl : public ConnectionTracker : color( Dali::Color::BLACK ), position(), cursorHeight( 0.0f ), - lineHeight( 0.0f ) + lineHeight( 0.0f ), + glyphOffset( 0.0f ) { } @@ -172,6 +173,7 @@ struct Decorator::Impl : public ConnectionTracker Vector2 position; float cursorHeight; float lineHeight; + float glyphOffset; }; struct HandleImpl @@ -234,6 +236,9 @@ struct Decorator::Impl : public ConnectionTracker mBoundingBox(), mHighlightColor( LIGHT_BLUE ), mHighlightPosition( Vector2::ZERO ), + mHighlightSize( Vector2::ZERO ), + mControlSize( Vector2::ZERO ), + mHighlightOutlineOffset( 0.f ), mActiveCursor( ACTIVE_CURSOR_NONE ), mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ), mCursorBlinkDuration( 0.0f ), @@ -1143,9 +1148,7 @@ struct Decorator::Impl : public ConnectionTracker { mHighlightActor = Actor::New(); -#ifdef DECORATOR_DEBUG mHighlightActor.SetName( "HighlightActor" ); -#endif mHighlightActor.SetParentOrigin( ParentOrigin::TOP_LEFT ); mHighlightActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mHighlightActor.SetColor( mHighlightColor ); @@ -1161,8 +1164,8 @@ struct Decorator::Impl : public ConnectionTracker if ( mHighlightActor ) { // Sets the position of the highlight actor inside the decorator. - mHighlightActor.SetPosition( mHighlightPosition.x, - mHighlightPosition.y ); + mHighlightActor.SetPosition( mHighlightPosition.x + mHighlightOutlineOffset, + mHighlightPosition.y + mHighlightOutlineOffset ); const unsigned int numberOfQuads = mHighlightQuadList.Count(); if( 0u != numberOfQuads ) @@ -1910,6 +1913,7 @@ struct Decorator::Impl : public ConnectionTracker Vector2 mHighlightPosition; ///< The position of the highlight actor. Size mHighlightSize; ///< The size of the highlighted text. Size mControlSize; ///< The control's size. Set by the Relayout. + float mHighlightOutlineOffset; ///< The outline's offset. unsigned int mActiveCursor; unsigned int mCursorBlinkInterval; @@ -2006,6 +2010,18 @@ const Vector2& Decorator::GetPosition( Cursor cursor ) const return mImpl->mCursor[cursor].position; } +void Decorator::SetGlyphOffset( Cursor cursor, float glyphOffset ) +{ + Impl::CursorImpl& cursorImpl = mImpl->mCursor[cursor]; + + cursorImpl.glyphOffset = glyphOffset; +} + +const float Decorator::GetGlyphOffset( Cursor cursor) const +{ + return mImpl->mCursor[cursor].glyphOffset; +} + void Decorator::SetCursorColor( Cursor cursor, const Dali::Vector4& color ) { mImpl->mCursor[cursor].color = color; @@ -2185,16 +2201,18 @@ void Decorator::AddHighlight( unsigned int index, const Vector4& quad ) *( mImpl->mHighlightQuadList.Begin() + index ) = quad; } -void Decorator::SetHighLightBox( const Vector2& position, const Size& size ) +void Decorator::SetHighLightBox( const Vector2& position, const Size& size, float outlineOffset ) { mImpl->mHighlightPosition = position; mImpl->mHighlightSize = size; + mImpl->mHighlightOutlineOffset = outlineOffset; } void Decorator::ClearHighlights() { mImpl->mHighlightQuadList.Clear(); mImpl->mHighlightPosition = Vector2::ZERO; + mImpl->mHighlightOutlineOffset = 0.f; } void Decorator::ResizeHighlightQuads( unsigned int numberOfQuads ) @@ -2222,6 +2240,11 @@ bool Decorator::IsHighlightActive() const return mImpl->mIsHighlightBoxActive; } +bool Decorator::IsHighlightVisible() const +{ + return ( mImpl->mHighlightActor && mImpl->mHighlightActor.GetParent() ); +} + void Decorator::SetTextDepth( int textDepth ) { mImpl->mTextDepth = textDepth;