X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fdecorator%2Ftext-decorator.cpp;h=ff03ac9db308aff0e41e16fa85c56d4b161a52b5;hb=96ffd67201c91f09328e018326fa37ec97249ada;hp=e06ea8bc22de861d383a8f7b3e2ade4470dec0e9;hpb=2a8f032f9d3e1a78a31986a95ea72964a5b515b0;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index e06ea8b..ff03ac9 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -33,7 +33,6 @@ #include // INTERNAL INCLUDES -#include #include #include #include @@ -284,9 +283,7 @@ struct Decorator::Impl : public ConnectionTracker mNotifyEndOfScroll( false ) { mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2; - mQuadIndexFormat[ "indices" ] = Property::INTEGER; - mHighlightMaterial = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) ); - + mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); SetupTouchEvents(); } @@ -489,7 +486,6 @@ struct Decorator::Impl : public ConnectionTracker { const HandleImpl& primaryHandle = mHandle[LEFT_SELECTION_HANDLE]; const HandleImpl& secondaryHandle = mHandle[RIGHT_SELECTION_HANDLE]; - const HandleImpl& grabHandle = mHandle[GRAB_HANDLE]; const CursorImpl& cursor = mCursor[PRIMARY_CURSOR]; if( primaryHandle.active || secondaryHandle.active ) @@ -505,7 +501,15 @@ struct Decorator::Impl : public ConnectionTracker else { // Calculates the popup's position if the grab handle is active. - mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height - grabHandle.size.height + cursor.position.y, 0.0f ); + const HandleImpl& grabHandle = mHandle[GRAB_HANDLE]; + if( grabHandle.verticallyFlipped ) + { + mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height - grabHandle.size.height + cursor.position.y, 0.0f ); + } + else + { + mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height + cursor.position.y, 0.0f ); + } } } @@ -529,7 +533,7 @@ struct Decorator::Impl : public ConnectionTracker { cursor = Control::New(); cursor.SetBackgroundColor( color ); - cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one. + cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); cursor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); } @@ -637,7 +641,6 @@ struct Decorator::Impl : public ConnectionTracker mActiveLayer.SetParentOrigin( ParentOrigin::CENTER ); mActiveLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION ); // Add the active layer telling the controller it doesn't need clipping. mController.AddDecoration( mActiveLayer, false ); @@ -1008,7 +1011,7 @@ struct Decorator::Impl : public ConnectionTracker if( !mHighlightQuadList.empty() ) { Vector< Vector2 > vertices; - Vector< unsigned int> indices; + Vector< unsigned short> indices; Vector2 vertex; std::vector::iterator iter = mHighlightQuadList.begin(); @@ -1049,37 +1052,23 @@ struct Decorator::Impl : public ConnectionTracker indices.PushBack( v + 3 ); } - if( mQuadVertices ) - { - mQuadVertices.SetSize( vertices.Size() ); - } - else - { - mQuadVertices = PropertyBuffer::New( mQuadVertexFormat, vertices.Size() ); - } - - if( mQuadIndices ) - { - mQuadIndices.SetSize( indices.Size() ); - } - else + if( ! mQuadVertices ) { - mQuadIndices = PropertyBuffer::New( mQuadIndexFormat, indices.Size() ); + mQuadVertices = PropertyBuffer::New( mQuadVertexFormat ); } - mQuadVertices.SetData( &vertices[ 0 ] ); - mQuadIndices.SetData( &indices[ 0 ] ); + mQuadVertices.SetData( &vertices[ 0 ], vertices.Size() ); if( !mQuadGeometry ) { mQuadGeometry = Geometry::New(); mQuadGeometry.AddVertexBuffer( mQuadVertices ); } - mQuadGeometry.SetIndexBuffer( mQuadIndices ); + mQuadGeometry.SetIndexBuffer( &indices[ 0 ], indices.Size() ); if( !mHighlightRenderer ) { - mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightMaterial ); + mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightShader ); mHighlightActor.AddRenderer( mHighlightRenderer ); } } @@ -1108,11 +1097,11 @@ struct Decorator::Impl : public ConnectionTracker { if( Gesture::Started == gesture.state ) { - handle.grabDisplacementX = handle.grabDisplacementY = 0; + handle.grabDisplacementX = handle.grabDisplacementY = 0.f; } handle.grabDisplacementX += gesture.displacement.x; - handle.grabDisplacementY += gesture.displacement.y; + handle.grabDisplacementY += ( handle.verticallyFlipped ? -gesture.displacement.y : gesture.displacement.y ); const float x = handle.position.x + handle.grabDisplacementX; const float y = handle.position.y + handle.lineHeight*0.5f + handle.grabDisplacementY; @@ -1663,9 +1652,8 @@ struct Decorator::Impl : public ConnectionTracker Actor mHighlightActor; ///< Actor to display highlight Renderer mHighlightRenderer; - Material mHighlightMaterial; ///< Material used for highlight + Shader mHighlightShader; ///< Shader used for highlight Property::Map mQuadVertexFormat; - Property::Map mQuadIndexFormat; PopupImpl mCopyPastePopup; TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons TextSelectionPopupCallbackInterface& mTextSelectionPopupCallbackInterface; @@ -1677,7 +1665,6 @@ struct Decorator::Impl : public ConnectionTracker HandleImpl mHandle[HANDLE_TYPE_COUNT]; PropertyBuffer mQuadVertices; - PropertyBuffer mQuadIndices; Geometry mQuadGeometry; QuadContainer mHighlightQuadList; ///< Sub-selections that combine to create the complete selection highlight