X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-label-impl.cpp;h=13cf69657a2e73d5081f9d2b230fa8ddbcad5595;hp=5a958d40e26d7c9874d0a82cdb56153a3e6a91d9;hb=215472e2dbc7b0727fefa97db1b80bf6128cccba;hpb=f8ca770d5047cfb0dc60e321e1194c5dcf5e59cb diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 5a958d4..13cf696 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -913,9 +913,14 @@ void TextLabel::SetUpAutoScrolling() mTextScroller = Text::TextScroller::New( *this ); } + // Calculate the actual gap before scrolling wraps. + int textPadding = std::max( controlSize.x - textNaturalSize.x, 0.0f ); + float wrapGap = std::max( mTextScroller->GetGap(), textPadding ); + Vector2 textureSize = textNaturalSize + Vector2(wrapGap, 0.0f); // Add the gap as a part of the texture + // Create a texture of the text for scrolling Text::TypesetterPtr typesetter = Text::Typesetter::New( mController->GetTextModel() ); - PixelData data = typesetter->Render( textNaturalSize, Text::Typesetter::RENDER_TEXT_AND_STYLES, true, Pixel::RGBA8888 ); // ignore the horizontal alignment + PixelData data = typesetter->Render( textureSize, Text::Typesetter::RENDER_TEXT_AND_STYLES, true, Pixel::RGBA8888 ); // ignore the horizontal alignment Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, data.GetPixelFormat(), data.GetWidth(), @@ -928,11 +933,12 @@ void TextLabel::SetUpAutoScrolling() // Filter mode needs to be set to linear to produce better quality while scaling. Sampler sampler = Sampler::New(); sampler.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR ); + sampler.SetWrapMode( Dali::WrapMode::DEFAULT, Dali::WrapMode::REPEAT, Dali::WrapMode::DEFAULT ); // Wrap the texture in the x direction textureSet.SetSampler( 0u, sampler ); // Set parameters for scrolling Renderer renderer = static_cast( GetImplementation( mVisual ) ).GetRenderer(); - mTextScroller->SetParameters( Self(), renderer, textureSet, controlSize, textNaturalSize, direction, mController->GetHorizontalAlignment(), mController->GetVerticalAlignment() ); + mTextScroller->SetParameters( Self(), renderer, textureSet, controlSize, textureSize, wrapGap, direction, mController->GetHorizontalAlignment(), mController->GetVerticalAlignment() ); } void TextLabel::ScrollingFinished()